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

41 lines
1.4 KiB
Plaintext
Raw Normal View History

2014-02-14 10:48:03 +00:00
<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? %>
2014-02-14 10:48:03 +00:00
</span>
</div>
2014-02-09 11:32:45 +00:00
<div class="row">
<% unless @resources.blank? %>
2014-02-09 10:42:17 +00:00
<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| %>
2014-02-09 09:08:08 +00:00
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse_cat_<%= resource_category.id %>">
2014-02-09 09:08:08 +00:00
<h4 class="panel-title">
<%= resource_category.name %>
2014-02-09 09:08:08 +00:00
</h4>
</div>
<div id="collapse_cat_<%= resource_category.id %>" class="panel-collapse collapse">
2014-02-09 09:08:08 +00:00
<div class="panel-body">
2014-02-14 08:09:16 +00:00
<% resources.each do |resource| %>
2014-02-14 10:48:03 +00:00
<div class="col-xs-2">
2014-02-14 08:09:16 +00:00
<%= render resource %>
</div>
<% end %>
2014-02-09 09:08:08 +00:00
</div>
</div>
</div>
<% end %>
2014-02-09 09:08:08 +00:00
</div>
<% end %>
2014-02-09 11:32:45 +00:00
</div>
<br />