summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-27 18:26:25 -0400
committerDavid Gay <david@davidgay.org>2021-05-27 18:26:25 -0400
commit2c2de801b4481695f3d1b6b14527116092cb1197 (patch)
tree63656e5870438ce2b1185b198ff38ce73c5cf78c /app/views
parent82ebb73bb4fc53ec5af428a88809ab8f11e52c0b (diff)
ItemsController that displays item game data
Diffstat (limited to 'app/views')
-rw-r--r--app/views/activities/_results.html.erb2
-rw-r--r--app/views/characters/items/index.html.erb2
-rw-r--r--app/views/items/index.html.erb8
-rw-r--r--app/views/items/show.html.erb12
4 files changed, 22 insertions, 2 deletions
diff --git a/app/views/activities/_results.html.erb b/app/views/activities/_results.html.erb
index b7728fb..36e8103 100644
--- a/app/views/activities/_results.html.erb
+++ b/app/views/activities/_results.html.erb
@@ -2,7 +2,7 @@
<% results.each do |result| %>
<% case result[:type] %>
<% when "item" %>
- <p>You got <%= result[:quantity] %> <%= result[:item].name %>
+ <p>You got <%= result[:quantity] %> <%= link_to result[:item].name, item_path(result[:item])%>
<% if result[:xp]&.any? %>
(<%= result[:xp].map { |award| "#{award[:amount] * result[:quantity]} xp #{award[:skill].name}" }.join(", ") %>)
<% end %>
diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb
index 64b58da..14d4b13 100644
--- a/app/views/characters/items/index.html.erb
+++ b/app/views/characters/items/index.html.erb
@@ -40,7 +40,7 @@
<% @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"><%= 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) %>
diff --git a/app/views/items/index.html.erb b/app/views/items/index.html.erb
new file mode 100644
index 0000000..5d004d3
--- /dev/null
+++ b/app/views/items/index.html.erb
@@ -0,0 +1,8 @@
+<h1 class="text-3xl mb-4">Items</h1>
+
+<% @items.each do |item| %>
+ <div class="my-2">
+ <div><%= link_to item.name, item_path(item) %></div>
+ <p class="italic"><%= item.description %></p>
+ </div>
+<% end %>
diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb
new file mode 100644
index 0000000..675c518
--- /dev/null
+++ b/app/views/items/show.html.erb
@@ -0,0 +1,12 @@
+<h1 class="text-3xl mb-2"><%= @item.name %></h1>
+<p class="italic"><%= @item.description %></p>
+
+<div class="my-6">
+ <h2 class="text-xl">Game Data</h2>
+ <p>GID: <span class="text-code"><%= @item.gid %></span></p>
+ <% if @item.whatnot %>
+ <div class="text-code my-2"><%= JSON.pretty_generate(@item.whatnot) %></div>
+ <% else %>
+ <p>Item has no additional data.</p>
+ <% end %>
+</div>