summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-28 21:23:38 -0400
committerDavid Gay <david@davidgay.org>2021-05-28 21:23:38 -0400
commitca98987c1a14655aedb4bdcf8fef7311131ca1be (patch)
tree38fdd410cd6fdf97df7fe6215b66765875589ed9 /app
parentdbc5bea2712344664e0760dc287a7f53754b14d1 (diff)
Monsters controller, activities index, and links to activities and items indexes
Diffstat (limited to 'app')
-rw-r--r--app/controllers/activities_controller.rb4
-rw-r--r--app/monsters_controller.rb9
-rw-r--r--app/views/activities/index.html.erb8
-rw-r--r--app/views/activities/show.html.erb2
-rw-r--r--app/views/application/_header.html.erb8
-rw-r--r--app/views/monsters/index.html.erb8
-rw-r--r--app/views/monsters/show.html.erb12
7 files changed, 49 insertions, 2 deletions
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 8e18ec9..2f9e9a5 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -1,4 +1,8 @@
class ActivitiesController < ApplicationController
+ def index
+ @activities = Activity.all.order(:name)
+ end
+
def show
@activity = Activity.find(params[:id])
end
diff --git a/app/monsters_controller.rb b/app/monsters_controller.rb
new file mode 100644
index 0000000..4f947b3
--- /dev/null
+++ b/app/monsters_controller.rb
@@ -0,0 +1,9 @@
+class MonstersController < ApplicationController
+ def index
+ @monsters = Monster.all.order(:name)
+ end
+
+ def show
+ @monster = Monster.find(params[:id])
+ end
+end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
new file mode 100644
index 0000000..593adca
--- /dev/null
+++ b/app/views/activities/index.html.erb
@@ -0,0 +1,8 @@
+<h1 class="text-3xl mb-4">Activities</h1>
+
+<% @activities.each do |activity| %>
+ <div class="my-2">
+ <div><%= link_to activity.name, activity_path(activity) %></div>
+ <p class="italic"><%= activity.description %></p>
+ </div>
+<% end %>
diff --git a/app/views/activities/show.html.erb b/app/views/activities/show.html.erb
index 4516b51..50dbe4b 100644
--- a/app/views/activities/show.html.erb
+++ b/app/views/activities/show.html.erb
@@ -7,6 +7,6 @@
<% if @activity.whatnot %>
<div class="text-code my-2"><%= JSON.pretty_generate(@activity.whatnot) %></div>
<% else %>
- <p>Item has no additional data.</p>
+ <p>Activity has no additional data.</p>
<% end %>
</div>
diff --git a/app/views/application/_header.html.erb b/app/views/application/_header.html.erb
index 6ca0671..25067f3 100644
--- a/app/views/application/_header.html.erb
+++ b/app/views/application/_header.html.erb
@@ -5,9 +5,15 @@
<div id="header_center" data-turbolinks-permanent>
</div>
<div>
- <ul class="flex flex-row-reverse text-sm">
+ <ul class="flex flex-row text-sm">
<% if user_signed_in? %>
<li class="mr-3">
+ <%= link_to "Activities", activities_path %>
+ </li>
+ <li class="mr-3">
+ <%= link_to "Items", items_path %>
+ </li>
+ <li class="mr-3">
<%= link_to "Logout", logout_path %>
</li>
<% else %>
diff --git a/app/views/monsters/index.html.erb b/app/views/monsters/index.html.erb
new file mode 100644
index 0000000..621f696
--- /dev/null
+++ b/app/views/monsters/index.html.erb
@@ -0,0 +1,8 @@
+<h1 class="text-3xl mb-4">Monsters</h1>
+
+<% @monsters.each do |monster| %>
+ <div class="my-2">
+ <div><%= link_to monster.name, monster_path(monster) %></div>
+ <p class="italic"><%= monster.description %></p>
+ </div>
+<% end %>
diff --git a/app/views/monsters/show.html.erb b/app/views/monsters/show.html.erb
new file mode 100644
index 0000000..9c4dfeb
--- /dev/null
+++ b/app/views/monsters/show.html.erb
@@ -0,0 +1,12 @@
+<h1 class="text-3xl mb-2"><%= @monster.name %></h1>
+<p class="italic"><%= @monster.description %></p>
+
+<div class="my-6">
+ <h2 class="text-xl">Game Data</h2>
+ <p>GID: <span class="text-code"><%= @monster.gid %></span></p>
+ <% if @monster.whatnot %>
+ <div class="text-code my-2"><%= JSON.pretty_generate(@monster.whatnot) %></div>
+ <% else %>
+ <p>Monster has no additional data.</p>
+ <% end %>
+</div>