sanger/sequencescape

View on GitHub
app/views/admin/projects/index.html.erb

Summary

Maintainability
Test Coverage

<%- add :about, "Sequencing projects can be edited, approved and managed from here." %>
<%- add :menu, "View all projects" => url_for(controller: "admin/projects", action: "index")  %>

<% if @projects %>
  <%= page_title 'Projects', 'Manage' %>

  <%= form_tag(filter_admin_projects_path, remote: true, id: "filter_form", class: 'remote-form observed', data: { update: "#projects",  throbber: '#update_loader'} ) %>

    <div class='callout_filter'>
      <table width='100%'>
        <tr>
          <td>
            <% state_selection = Project.states.map {|state| [state.to_s.humanize, state.to_s]} + [['All',nil]] %>
            Show <%= select :filter, :status, state_selection -%> projects that are <%= select :filter, :by, project_scopes-%>
          </td>
          <td style='text-align: right;'>
            <div class="spinner-border" role="status" id="update_loader" style="display: none"></div>
            <input type="search" placeholder="Search" name="q" id="q" />
          </td>
        </tr>
      </table>
    </div>
  </form>

  <div id='projects'>
    <%= render partial: "filtered_projects" %>
  </div>

<% else %>
  <div class="page-header"><h1>Manage project: <%= @project.name %></h1></div>
  <p>You can update the billing information and approval status for a project here.</p>
  <%= render partial: "manage_single_project" %>
<% end %>