summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-02 22:38:32 -0400
committerDavid Gay <david@davidgay.org>2021-05-02 22:38:32 -0400
commit1b2de86007508ba86c6c9cb99fbdcac178045131 (patch)
treea007fc55acd2b54b5db108e3580928a9a006d71e /app/views
parent1d5083ddf7f2b285e63bb8019d38199e862fa1d8 (diff)
Character items and inventory, with ability to add and remove items
Diffstat (limited to 'app/views')
-rw-r--r--app/views/application/_navbar.html.erb11
-rw-r--r--app/views/characters/items/index.html.erb36
2 files changed, 40 insertions, 7 deletions
diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb
index 5d3a2cb..85f4642 100644
--- a/app/views/application/_navbar.html.erb
+++ b/app/views/application/_navbar.html.erb
@@ -1,16 +1,13 @@
<ul class="py-2 px-2 col-span-12 text-display">
- <% if user_signed_in? %> <%# Will replace this with `current_character` or equivalent, eventually %>
+ <% if current_char %>
<li class="mr-6 inline">
- LinkA
+ Actions
</li>
<li class="mr-6 inline">
- LinkB
+ <%= link_to "Character", character_path(current_char) %>
</li>
<li class="mr-6 inline">
- LinkC
- </li>
- <li class="mr-6 inline">
- LinkD
+ <%= link_to "Inventory", character_items_path(current_char) %>
</li>
<% end %>
</ul>
diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb
new file mode 100644
index 0000000..e313f7e
--- /dev/null
+++ b/app/views/characters/items/index.html.erb
@@ -0,0 +1,36 @@
+<h1 class="text-xl">Inventory</h1>
+
+<table class="table-auto">
+ <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| %>
+ <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]", "#" %>
+ <% end %>
+ </td>
+ <td class="table-cell-padded">
+ <% if ci.item.usable? %>
+ <%= link_to "[Use]", "#" %>
+ <% end %>
+ </td>
+ <td class="table-cell-padded">
+ <%= link_to "[Destroy]", "#" %>
+ <%= link_to "[Destroy All]", "#" %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+