render list of equipment in universe on universe#show

This commit is contained in:
Andrew Brown 2014-01-09 14:11:23 +00:00
parent cde90ead99
commit 34deb80518
4 changed files with 45 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<th>Name</th>
<th>Role</th>
<th>Universe</th>
<% if session[:user] and session[:user] == @characters.first.user.id %>
<% if session[:user] %>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
<% end %>
</tr>
@ -15,9 +15,8 @@
<td style="width: 160px;"><%= simple_format link_to character.name, character_path(character) %></td>
<td><%= simple_format character.role %></td>
<td><%= character.universe ? character.universe.name : "" %></td>
<% if session[:user] and session[:user] == @characters.first.user.id %>
<td style="width: 180px;">
<td style="width: 180px;">
<% if session[:user] and session[:user] == character.user.id %>
<%= link_to t('.view', :default => t("helpers.links.view")),
character_path(character), :class => 'btn' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
@ -27,8 +26,8 @@
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-danger' %>
</td>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>

View File

@ -0,0 +1,35 @@
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<% if session[:user] %>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @equipment.each do |equipment| %>
<tr>
<td style="width: 160px;"><%= simple_format link_to equipment.name, equipment_path(equipment) %></td>
<td><%= simple_format equipment.equip_type %></td>
<td><%= simple_format equipment.description %></td>
<td style="width: 180px;">
<% if session[:user] and session[:user] == equipment.user.id %>
<%= link_to t('.view', :default => t("helpers.links.view")),
equipment_path(equipment), :class => 'btn' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
equipment_edit_path(equipment), :class => 'btn' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
equipment_path(equipment),
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-danger' %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -6,6 +6,9 @@
<small>from <%= universe_filter %></small>
<% end %>
</h3>
<%= render 'list' %>
<table class="table table-striped">
<thead>
<tr>

View File

@ -66,7 +66,8 @@
<%= render 'characters/list' %>
</dl>
<dl class="dl-horizontal hidden content-section equipment_section">
Eq
<% @equipment = @universe.equipment %>
<%= render 'equipment/list' %>
</dl>
<dl class="dl-horizontal hidden content-section languages_section">
Lang