summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-19 19:41:34 -0400
committerDavid Gay <david@davidgay.org>2021-05-19 19:41:34 -0400
commit8323f7da46f48b17646f5e7d6b407e1a994d7a3f (patch)
tree6b34204e7a8f80a487aa9b43067cf5b6e807abaa
parent38fff0e2d09f2954d747baf65ab555427ba653be (diff)
Show constructed amenities and provide links for building new ones
-rw-r--r--app/controllers/characters/hearth_controller.rb1
-rw-r--r--app/views/characters/hearth/index.html.erb22
2 files changed, 22 insertions, 1 deletions
diff --git a/app/controllers/characters/hearth_controller.rb b/app/controllers/characters/hearth_controller.rb
index 27cd77d..f2d2bf7 100644
--- a/app/controllers/characters/hearth_controller.rb
+++ b/app/controllers/characters/hearth_controller.rb
@@ -1,5 +1,6 @@
class Characters::HearthController < ApplicationController
def index
@all_amenities = HearthAmenity.all
+ @construct_activities = Activity.where("gid like ?", "construct_%")
end
end
diff --git a/app/views/characters/hearth/index.html.erb b/app/views/characters/hearth/index.html.erb
index f087ede..487bd46 100644
--- a/app/views/characters/hearth/index.html.erb
+++ b/app/views/characters/hearth/index.html.erb
@@ -1,7 +1,27 @@
<% foundation = @all_amenities.find_by_gid("foundation") %>
-<h1 class="text-3xl">Hearth</h1>
+<h1 class="text-3xl mb-2">Hearth</h1>
<% if current_char.hearth.has_amenity?(foundation) %>
+ <p class="mb-2">Here is your hearth, your safe haven and stronghold against all that ravages and thrashes
+ in these realms. Amidst this great dream of planar chaos and destruction, you have built something.
+ </p>
+
+ <ul class="my-4">
+ <% @construct_activities.each do |activity| %>
+ <li><%= link_to activity.name, start_activity_path(activity), method: :post %>
+ (costs <%= activity.cost_string %>)</li>
+ <% end %>
+ </ul>
+
+ <div class="grid grid-cols-2 gap-4">
+ <% current_char.hearth.built_hearth_amenities.each do |bhi| %>
+ <div class="border-2 border-gray-800 rounded p-4">
+ <h2 class="text-lg font-bold"><%= bhi.hearth_amenity.name %></h2>
+ <p>Level <%= bhi.level %></p>
+ <p><%= bhi.hearth_amenity.description %></p>
+ </div>
+ <% end %>
+ </div>
<% else %>
<p>You haven't built your hearth yet. First, you'll need to start with a foundation.</p>
<% construct_activity = foundation.construct_activity(1) %>