diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/game_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/locations_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/look_controller.rb | 5 | ||||
-rw-r--r-- | app/models/character.rb | 1 | ||||
-rw-r--r-- | app/models/location.rb | 1 | ||||
-rw-r--r-- | app/views/application/_navbar.html.erb | 2 | ||||
-rw-r--r-- | app/views/locations/index.html.erb | 8 | ||||
-rw-r--r-- | app/views/look/look.html.erb (renamed from app/views/locations/show.html.erb) | 0 |
8 files changed, 9 insertions, 19 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index 39ea6c9..4bbbf53 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -18,7 +18,7 @@ class GameController < ApplicationController def stop_activity current_char.stop_activity - redirect_to locations_path + redirect_to look_path end def finish_activity diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb deleted file mode 100644 index 4616c3d..0000000 --- a/app/controllers/locations_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class LocationsController < ApplicationController - def index - @locations = Location.all - end - - def show - @location = Location.find(params[:id]) - end -end diff --git a/app/controllers/look_controller.rb b/app/controllers/look_controller.rb new file mode 100644 index 0000000..e604670 --- /dev/null +++ b/app/controllers/look_controller.rb @@ -0,0 +1,5 @@ +class LookController < ApplicationController + def look + @location = current_char.location + end +end diff --git a/app/models/character.rb b/app/models/character.rb index 2669626..96dafd0 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 + belongs_to :location has_many :title_awards has_many :titles, through: :title_awards belongs_to :active_title, class_name: "Title", optional: true diff --git a/app/models/location.rb b/app/models/location.rb index e008270..7bd1386 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -2,6 +2,7 @@ class Location < ApplicationRecord include HasWhatnot has_many :activities + has_many :characters has_many :monster_spawns validates :gid, :name, presence: true end diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb index e315b42..d80e7b6 100644 --- a/app/views/application/_navbar.html.erb +++ b/app/views/application/_navbar.html.erb @@ -1,7 +1,7 @@ <ul class="py-2 px-2 col-span-12 text-display space-x-2.5"> <% if current_char %> <li class="inline"> - <%= link_to "Locations", locations_path %> + <%= link_to "Look", look_path %> </li> <li class="inline"> <%= link_to "Character", character_path(current_char) %> diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb deleted file mode 100644 index 3c9b837..0000000 --- a/app/views/locations/index.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<h1 class="text-3xl mb-4">Locations</h1> - -<% @locations.each do |location| %> - <div class="my-4"> - <h2 class="text-xl"><%= link_to location.name, location_path(location) %></h2> - <p class="italic"><%= location.description %></p> - </div> -<% end %> diff --git a/app/views/locations/show.html.erb b/app/views/look/look.html.erb index 2f1074a..2f1074a 100644 --- a/app/views/locations/show.html.erb +++ b/app/views/look/look.html.erb |