Open-Source-Access-Control-.../app/views/resources/index.html.erb

41 lines
1.4 KiB
Plaintext
Executable File

<div class="row">
<h1 class="col-md-8">Lab Resources
<%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %>
<%= link_to 'Categories', resource_categories_path, :class => "btn btn-primary" if can? :read, ResourceCategory %>
<a class="btn btn-default" onclick="$('#accordion .collapse').collapse('toggle')" />Expand/Collapse All</a>
</h1>
<span class="col-md-2 col-xs-6">
<h3>Featured item:</h3>
<%= render @featured_resource unless @featured_resource.blank? %>
</span>
</div>
<div class="row">
<% unless @resources.blank? %>
<div class="panel-group col-sm-8" id="accordion">
<% @resources.sort_by{|r| [r.resource_category_name,r.name] }.group_by(&:resource_category).each do |resource_category,resources| %>
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse_cat_<%= resource_category.id %>">
<h4 class="panel-title">
<%= resource_category.name %>
</h4>
</div>
<div id="collapse_cat_<%= resource_category.id %>" class="panel-collapse collapse">
<div class="panel-body">
<% resources.each do |resource| %>
<div class="col-xs-2">
<%= render resource %>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
<br />