diff options
author | David Gay <david@davidgay.org> | 2021-05-18 18:16:04 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-18 18:16:04 -0400 |
commit | 4a6c06eb681575dbf1ee58d3b1f667e79051b1e2 (patch) | |
tree | 194a555305ec8c12271160a2c7ccf3087f16cd41 /app | |
parent | 25c499ae942086b460b886e3d79dc5a55e5f1214 (diff) |
Hearths, HearthAmenities, and BuiltHearthAmenities
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/characters/hearth_controller.rb | 4 | ||||
-rw-r--r-- | app/models/built_hearth_amenity.rb | 4 | ||||
-rw-r--r-- | app/models/character.rb | 1 | ||||
-rw-r--r-- | app/models/hearth.rb | 3 | ||||
-rw-r--r-- | app/models/hearth_amenity.rb | 2 | ||||
-rw-r--r-- | app/views/application/_navbar.html.erb | 3 | ||||
-rw-r--r-- | app/views/characters/hearth/index.html.erb | 6 |
7 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/characters/hearth_controller.rb b/app/controllers/characters/hearth_controller.rb new file mode 100644 index 0000000..010404d --- /dev/null +++ b/app/controllers/characters/hearth_controller.rb @@ -0,0 +1,4 @@ +class Characters::HearthController < ApplicationController + def index + end +end diff --git a/app/models/built_hearth_amenity.rb b/app/models/built_hearth_amenity.rb new file mode 100644 index 0000000..c4d5a53 --- /dev/null +++ b/app/models/built_hearth_amenity.rb @@ -0,0 +1,4 @@ +class BuiltHearthAmenity < ApplicationRecord + belongs_to :hearth + belongs_to :hearth_amenity +end diff --git a/app/models/character.rb b/app/models/character.rb index 7df48e8..661521b 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -1,6 +1,7 @@ class Character < ApplicationRecord belongs_to :user belongs_to :activity, optional: true + has_one :hearth has_many :character_items has_many :items, through: :character_items has_many :character_skills diff --git a/app/models/hearth.rb b/app/models/hearth.rb new file mode 100644 index 0000000..8885a08 --- /dev/null +++ b/app/models/hearth.rb @@ -0,0 +1,3 @@ +class Hearth < ApplicationRecord + belongs_to :character +end diff --git a/app/models/hearth_amenity.rb b/app/models/hearth_amenity.rb new file mode 100644 index 0000000..ecc136a --- /dev/null +++ b/app/models/hearth_amenity.rb @@ -0,0 +1,2 @@ +class HearthAmenity < ApplicationRecord +end diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb index 104c349..ef81d6c 100644 --- a/app/views/application/_navbar.html.erb +++ b/app/views/application/_navbar.html.erb @@ -9,5 +9,8 @@ <li class="mr-6 inline"> <%= link_to "Inventory", character_items_path(current_char) %> </li> + <li class="mr-6 inline"> + <%= link_to "Hearth", character_hearth_path(current_char) %> + </li> <% end %> </ul> diff --git a/app/views/characters/hearth/index.html.erb b/app/views/characters/hearth/index.html.erb new file mode 100644 index 0000000..ec055d1 --- /dev/null +++ b/app/views/characters/hearth/index.html.erb @@ -0,0 +1,6 @@ +<h1 class="text-3xl">Hearth</h1> + +<% if current_char.hearth %> +<% else %> + <p>You haven't built your hearth yet. First, you'll need to start with a foundation.</p> +<% end %> |