sanger/sequencescape

View on GitHub
app/views/users/show.html.erb

Summary

Maintainability
Test Coverage

<% add :about, "Your user profile." -%>
<% add :menu, "Edit profile" => edit_profile_path(@user) -%>
<% add :menu, "View Projects" => projects_profile_path(@user) -%>
<% add :menu, "Qc Reports" => study_reports_profile_path(@user)  -%>
<% add :menu, "Administer users" => admin_users_path if can? :administer, User -%>

<%= page_title @user.name, @user.login %>

<% if @user.profile_complete? %>
  <%= alert(:success) do %>
    Your profile is up to date and complete.
  <% end %>
<% else %>
  <%= alert(:warning) do %>
    Your profile is not complete!
  <% end %>
<% end %>
<div class="card-columns">
<%= summary do
 [
  ['First name', @user.first_name.blank? ? "Unknown" : @user.first_name ],
  ['Last name',  @user.last_name.blank? ? "Unknown" : @user.last_name ],
  ['Preferred email', @user.email.blank? ? "Unknown" : @user.email ]
 ]
end %>

<% logged_in_user?(@user) do -%>
  <%= panel(:info, title:'API access') do %>
    <dl>
      <dt>API Key</dt>
      <dd><code><%= @user.api_key %></code></dd>
    </dl>
    <p>You can use your API key to access your studies, samples and requests programmatically.</p>
  <% end %>
<% end %>
</div>

<div class="card-default">
<%= panel(:default, title: 'Print Swipecard Barcode') do %>
  <%= form_tag(print_swipecard_profile_path) do %>
    <table>
      <tr>
        <th><%= label_tag 'Swipe card' %></th>
        <th><%= label_tag 'Printer' %></th>
      </tr>
      <tr>
        <td><%= password_field_tag 'swipecard' %></td>
        <td><%= select_tag 'printer', options_for_select(@printer_list), class: 'form-control select2'%></td>
        <td><%= button_tag 'Print Swipecard', :class => 'btn btn-success' %></td>
      </tr>
    </table>
  <% end %>
<% end %>
</div>