Reorganize account settings page

This commit is contained in:
Shadowfacts 2019-11-10 11:48:41 -05:00
parent 4888a45243
commit 9a1ecf3b0b
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 54 additions and 41 deletions

View File

@ -1,49 +1,62 @@
<h1>Account Settings</h1> <h1>Account Settings</h1>
<h2><pre><%= @user.username %></pre></h2> <h2>Username: <code><%= @user.username %></code></h2>
<section class="card mt-4">
<h4 class="card-header">Import/Export Data</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<%= form_for @conn, Routes.account_path(@conn, :import), [method: :post, multipart: true], fn f -> %>
<%= file_input f, :file, required: true %>
<%= submit "Import OPML", class: "btn btn-primary" %>
<% end %>
</li>
<li class="list-group-item">
<%= form_for @conn, Routes.account_path(@conn, :export), [method: :post, class: "mt-2"], fn f -> %>
<%= submit "Export OPML", class: "btn btn-primary" %>
<% end %>
</li>
</ul>
</section>
<section class="card mt-4">
<h4 class="card-header">Security</h4>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<a href="<%= Routes.account_path(@conn, :change_password) %>" class="btn btn-secondary">Change Password</a> <a href="<%= Routes.account_path(@conn, :change_password) %>" class="btn btn-secondary">Change Password</a>
<a href="<%= Routes.account_path(@conn, :change_fever_password) %>" class="btn btn-secondary">Change Fever Password</a> <a href="<%= Routes.account_path(@conn, :change_fever_password) %>" class="btn btn-secondary">Change Fever Password</a>
</li>
<section class="mt-4"> <li class="list-group-item">
<h2>Import/Export Data</h2> <h5 class="card-title">Approved Clients</h5>
<%= form_for @conn, Routes.account_path(@conn, :import), [method: :post, multipart: true], fn f -> %> <table class="table table-striped">
<%= file_input f, :file %> <thead>
<%= submit "Import OPML", class: "btn btn-primary" %>
<% end %>
<%= form_for @conn, Routes.account_path(@conn, :export), [method: :post, class: "mt-2"], fn f -> %>
<%= submit "Export OPML", class: "btn btn-primary" %>
<% end %>
</section>
<section class="mt-4">
<h2>Approved Clients</h2>
<table class="table table-striped">
<thead>
<tr>
<th>Client</th>
<th>Revoke Access</th>
</tr>
</thead>
<tbody>
<%= for {approved, fervor} <- @clients do %>
<tr> <tr>
<td> <th>Client</th>
<%= if fervor.website do %> <th>Revoke Access</th>
<a href="<%= fervor.website %>"><%= fervor.client_name %></a>
<% else %>
<%= fervor.client_name %>
<% end %>
</td>
<td>
<%= form_tag Routes.account_path(@conn, :remove_client), method: :post do %>
<input type="hidden" name="client_id" value="<%= approved.client_id %>">
<%= submit "Revoke", class: "btn btn-danger" %>
<% end %>
</td>
</tr> </tr>
<% end %> </thead>
</tbody> <tbody>
</table> <%= for {approved, fervor} <- @clients do %>
<tr>
<td>
<%= if fervor.website do %>
<a href="<%= fervor.website %>"><%= fervor.client_name %></a>
<% else %>
<%= fervor.client_name %>
<% end %>
</td>
<td>
<%= form_tag Routes.account_path(@conn, :remove_client), method: :post do %>
<input type="hidden" name="client_id" value="<%= approved.client_id %>">
<%= submit "Revoke", class: "btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table> </li>
</ul>
</section> </section>