From b838c52d7895e7d1e3ac206c8ff530a11a3f5789 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 6 Jun 2021 00:47:30 -0400 Subject: Improved inventory section for equipped items --- app/views/characters/items/index.html.erb | 38 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'app/views/characters') diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb index 140b737..8d0220b 100644 --- a/app/views/characters/items/index.html.erb +++ b/app/views/characters/items/index.html.erb @@ -1,25 +1,23 @@ -

Equipped Items

+

Equipped Items

- - - - - - - - - - <% @character.equipment.order(:slot).each do |eq| %> - - - - - +
+ <% Equipment.slots.each do |slot| %> +
+
<%= slot[0].to_s.humanize %>
+ <% eq = @character.equipment.find_by(slot: slot)%> + <% if eq.present? %> +
<%= eq.item.name %>
+ <% else %> +
+ <% end %> + <% if eq.present? %> +
+ <%= button_to "Unequip", character_item_unequip_path(slot: eq.slot ) %> +
+ <% end %> +
<% end %> -
-
SlotItemUnequip
<%= eq.slot.to_s.humanize %><%= eq.item.name %> - <%= button_to "Unequip", character_item_unequip_path(slot: eq.slot ) %> -
+ <%= render "characters/items/inventory_section", heading: "Equipment", character_items: @character.character_items.ordered_by_item_name.select { |ci| -- cgit v1.2.3