summaryrefslogtreecommitdiff
path: root/app/views/characters/items/index.html.erb
blob: a7c932d73b395d84d5ab472eacf352e1e2c7be5b (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.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"><%= ci.item.name %></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? %>
          <%= link_to "[Use]", "#" %>
        <% end %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>