summaryrefslogtreecommitdiff
path: root/app/views/characters/items/index.html.erb
blob: 14d4b13a79abc3165462d6d134b55a03ac5a8623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<h1 class="text-3xl mb-4">Inventory</h1>

<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.order(:slot).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>
  </tr>
  </thead>
  <tbody>
  <% @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"><%= link_to ci.item.name, item_path(ci.item) %></td>
      <td class="table-cell-padded">
        <% if ci.item.equipment? %>
          <%= button_to "Equip", character_item_equip_path(item_id: ci.item.id) %>
        <% end %>
      </td>
      <td class="table-cell-padded">
        <% if ci.item.usable? %>
          <%= button_to "Use", character_item_use_path(item_id: ci.item.id) %>
        <% end %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>