scinote-web/app/views/projects/archive.html.erb

73 lines
2.8 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% provide(:head_title, t("projects.archive.head_title")) %>
<% if @projects_by_orgs.length > 0 %>
<div id="projects-toolbar">
<form class="form-inline" action="<%= projects_archive_path %>">
<div class="form-group">
<!-- organization filter -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="organizationMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="hidden-xs"><%= t('projects.index.organization_filter') %></span>
2016-07-21 19:11:15 +08:00
<span class="visible-xs-inline"><i class="glyphicon glyphicon-folder-open"></i></span>
2016-02-12 23:52:43 +08:00
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<% if @current_organization_id > 1 %>
<li><a href="?<%= {sort: @current_sort}.reject{|k,v| v.blank?}.to_query %>"><%= t'projects.index.all_filter' %></a></li>
<% end %>
<% @organizations.each do |org| %>
<% if org.id == @current_organization_id %>
<li class="disabled"><a href="#"><%= org.name %></a></li>
<% else %>
<li><a href="?<%= {organization: org.id, sort: @current_sort}.reject{|k,v| v.blank?}.to_query %>"><%= org.name %></a></li>
<% end %>
<% end %>
</ul>
</div>
<!-- project sort -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="hidden-xs"><%= t'projects.index.sort' %></span>
<span class="visible-xs-inline"><i class="glyphicon glyphicon-sort"></i></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="sortMenu">
<% ["new", "old", "atoz", "ztoa"].each do |sort| %>
<% if @current_sort != sort %>
<li><a href="?<%= {organization: @current_organization_id, sort: sort}.reject{|k,v| v.to_s == "0"}.to_query %>"><%= t('projects.index.sort_' + sort) %></a></li>
<% else %>
<li class="disabled"><a href="#"><%= t('projects.index.sort_' + sort) %></a></li>
<% end %>
<% end %>
</ul>
</div>
</div>
</form>
</div>
<% @projects_by_orgs.each do |org, projects| %>
<%= render partial: "projects/archive/org_projects", locals: {org: org, projects: projects} %>
<% end %>
<% else %>
<!-- Some spacing... -->
<div class="row">
<div class="col-xs-12" style="height: 30px;"></div>
</div>
<div class="row">
<div class="col-xs-12">
<h4><%=t "projects.index.no_archived_projects" %></h4>
</div>
</div>
<div>
<div class="col-xs-12">
<%= link_to t("projects.index.back_to_projects_index"), projects_path %>
</div>
</div>
<% end %>