diff options
author | David Gay <david@davidgay.org> | 2021-05-22 15:39:16 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-22 15:39:16 -0400 |
commit | 38f3a39221869483e3468e9f4d8cab5450a70f89 (patch) | |
tree | ef831c35d61e05b46c356d39e30ecc6d6f7353b1 /app/views/characters | |
parent | 88bd4f77db3a4372c118a9faef613615db66bc52 (diff) |
Equiping and unequiping items
Diffstat (limited to 'app/views/characters')
-rw-r--r-- | app/views/characters/items/index.html.erb | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb index e313f7e..a7c932d 100644 --- a/app/views/characters/items/index.html.erb +++ b/app/views/characters/items/index.html.erb @@ -1,23 +1,49 @@ -<h1 class="text-xl">Inventory</h1> +<h1 class="text-3xl mb-4">Inventory</h1> -<table class="table-auto"> +<h2 class="text-xl mb-4">Equipment</h2> + +<table class="table-auto mb-8"> + <thead> + <tr> + <th class="table-header-padded">Slot</th> + <th class="table-header-padded">Item</th> + <th class="table-header-padded">Unequip</th> + </tr> + </thead> + <tbody> + <% @character.equipment.each do |eq| %> + <tr> + <td class="table-cell-padded"><%= eq.slot.to_s %></td> + <td class="table-cell-padded"><%= eq.item.name %></td> + <td class="table-cell-padded"> + <%= button_to "Unequip", character_item_unequip_path(slot: eq.slot ) %> + </td> + </tr> + <% end %> + </tbody> +</table> + + + +<h2 class="text-xl mb-4">Inventory</h2> + +<table class="table-auto mb-8"> <thead> <tr> <th class="table-header-padded">Amount</th> <th class="table-header-padded">Item</th> <th class="table-header-padded">Equip</th> <th class="table-header-padded">Use</th> - <th class="table-header-padded">Destroy</th> </tr> </thead> <tbody> - <% @character_items.ordered_by_item_name.each do |ci| %> + <% @character.character_items.ordered_by_item_name.each do |ci| %> <tr> <td class="table-cell-padded text-right"><%= ci.quantity %></td> <td class="table-cell-padded"><%= ci.item.name %></td> <td class="table-cell-padded"> - <% if ci.item.equip_slot %> - <%= link_to "[Equip]", "#" %> + <% if ci.item.equipment? %> + <%= button_to "Equip", character_item_equip_path(item_id: ci.item.id) %> <% end %> </td> <td class="table-cell-padded"> @@ -25,10 +51,6 @@ <%= link_to "[Use]", "#" %> <% end %> </td> - <td class="table-cell-padded"> - <%= link_to "[Destroy]", "#" %> - <%= link_to "[Destroy All]", "#" %> - </td> </tr> <% end %> </tbody> |