Updating resources
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
<div class="payment_links <%= "payment-highlighted" if params[:flash] == "welcome_msg" %>">
|
||||
|
||||
<%= render '/statistics/index' %>
|
||||
<%= render '/statistics/index' unless params[:flash] == "welcome_msg" %>
|
||||
<% if can? :read, resource.payments.first then %>
|
||||
<h3>Recorded Payments:</h3>
|
||||
<ul>
|
||||
|
||||
9
app/views/resources/_resource.html.erb
Normal file
9
app/views/resources/_resource.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="col-sm-2">
|
||||
<div class="thumbnail">
|
||||
<%= link_to(resource) do %>
|
||||
<%= image_tag(resource.picture.url(:thumb)) if resource.picture? %>
|
||||
<strong><%=h resource.name %></strong>
|
||||
<% end %>
|
||||
<%= "Owned by "+resource.user.name if resource.user %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,38 +1,31 @@
|
||||
<h1>Resources</h1>
|
||||
|
||||
<%= link_to 'New Resource', new_resource_path, :class => "btn" if can? :create, Resource %>
|
||||
<%= link_to 'Add Equipment', new_resource_path, :class => "btn" if can? :create, Resource %>
|
||||
|
||||
<style>
|
||||
.collapsible .thumbnail { height: 150px; }
|
||||
</style>
|
||||
|
||||
<table class="lined-table">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th> <%= sort_link 'Owner', :owner_id %></th>
|
||||
<th> <%= sort_link 'Category', :category_id %></th>
|
||||
<th> <%= sort_link 'Name', :name %></th>
|
||||
<th> <%= sort_link 'Serial', :serial %></th>
|
||||
<th> <%= sort_link 'Status/Location', :status %></th>
|
||||
</tr>
|
||||
|
||||
<% unless @resources.blank? %>
|
||||
<% @resources.group_by(&:supercategory).each do |supercategory,resources| %>
|
||||
<tr><th><%= supercategory %></th></tr>
|
||||
<% resources.each do |resource| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to image_tag(resource.picture.url(:tiny)), resource.picture.url, :popup => ['index_image_preview', 'height=300,width=400'] if resource.picture? %>
|
||||
</td>
|
||||
<td>
|
||||
<%=h resource.owner.name if resource.owner %>
|
||||
<td><%=h resource.category.name unless resource.category.nil? %></td>
|
||||
<td><%=h resource.name %></td>
|
||||
<td><%=h resource.serial %></td>
|
||||
<td><%=h resource.status %></td>
|
||||
<td><%= link_to 'Edit', edit_resource_path(resource) if can? :update, resource %></td>
|
||||
<td><%= link_to 'Destroy', resource, :confirm => 'Are you sure you want to delete this?', :method => :delete if can? :destroy, resource %></td>
|
||||
</tr>
|
||||
<div class="panel-group" id="accordion">
|
||||
<% @resources.sort_by{|r| [r.category_name,r.name] }.group_by(&:category).each do |category,resources| %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||
<%= category.name %>
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<%= render resources %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user