diff options
author | David Gay <david@davidgay.org> | 2021-05-25 20:31:41 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-25 20:31:41 -0400 |
commit | f62c26d1dade224871a3043e1e47963b358bd345 (patch) | |
tree | 9a92abaf99e8ccbde1185c1c5047b81e25e702ba | |
parent | ca9d189e51b7467f539d906a6e891fa4a7caa2fc (diff) |
stop_activity
-rw-r--r-- | app/controllers/game_controller.rb | 5 | ||||
-rw-r--r-- | app/views/activities/_timer.html.erb | 2 | ||||
-rw-r--r-- | config/routes.rb | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index f1387e0..c5bfdbc 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -1,4 +1,9 @@ class GameController < ApplicationController + def stop_activity + current_char.stop_activity + redirect_to locations_path + end + def finish_activity @results = [] return unless current_char.activity_time_remaining <= 0 diff --git a/app/views/activities/_timer.html.erb b/app/views/activities/_timer.html.erb index 27d9272..46e0eb0 100644 --- a/app/views/activities/_timer.html.erb +++ b/app/views/activities/_timer.html.erb @@ -5,5 +5,5 @@ class="text-center"> <span data-timer-target="timer" class="text-3xl"></span> </div> - <%= link_to "Stop", character_path(current_char) %> + <%= button_to "Stop", stop_activity_path %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 69865ee..514ab2e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,5 +35,6 @@ Rails.application.routes.draw do delete "/bazaar/cancel/:id", to: "bazaar#cancel_offer", as: :bazzar_cancel_offer post "/start_activity", to: "activities#start" + post "/stop_activity", to: "game#stop_activity" post "/finish_activity", to: "game#finish_activity" end |