diff --git a/Gemfile.lock b/Gemfile.lock index ff2bf84..d7b59cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,7 +84,7 @@ GEM benchmark (0.4.0) bigdecimal (3.1.9) bindex (0.8.1) - bootsnap (1.18.5) + bootsnap (1.18.6) msgpack (~> 1.2) builder (3.3.0) concurrent-ruby (1.3.5) @@ -101,7 +101,8 @@ GEM dotenv-rails (3.1.8) dotenv (= 3.1.8) railties (>= 6.1) - drb (2.2.1) + drb (2.2.3) + erb (5.0.1) erubi (1.13.1) ffi (1.17.2-aarch64-linux-gnu) ffi (1.17.2-arm-linux-gnu) @@ -212,7 +213,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.14) + rack (3.1.15) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -234,7 +235,7 @@ GEM activesupport (= 8.0.2) bundler (>= 1.15.0) railties (= 8.0.2) - rails-dom-testing (2.2.0) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -250,7 +251,8 @@ GEM thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.13.1) + rdoc (6.14.0) + erb psych (>= 4.0.0) redis (5.4.0) redis-client (>= 0.22.0) @@ -291,7 +293,7 @@ GEM base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.7.2) + zeitwerk (2.7.3) PLATFORMS aarch64-linux diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index c544113..4b455b1 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -95,7 +95,7 @@ --flip-deg: 0deg; --flip-scale: 1; --flip-rotate: 0deg; - + font: 10px/1.3 var(--ff-ikea); } @@ -160,6 +160,7 @@ footer { font-family: var(--ff-ikea); writing-mode: vertical-rl; text-orientation: mixed; + z-index: -1 } diff --git a/app/controllers/answers_controller.rb b/app/controllers/answers_controller.rb index ae22234..2398281 100644 --- a/app/controllers/answers_controller.rb +++ b/app/controllers/answers_controller.rb @@ -6,7 +6,8 @@ class AnswersController < ApplicationController def create not_found unless question - @answer = Answer.new(answer_params.merge(player_id: current_player.id, node_id: question.id)) + @answer = Answer.find_or_initialize_by(player_id: current_player.id, node_id: question.id) + @answer.update(answer_params) respond_to do |format| if @answer.save @@ -19,6 +20,10 @@ class AnswersController < ApplicationController end + def update + create + end + private diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index a256ba9..49bd0da 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -6,8 +6,7 @@ class QuestionsController < ApplicationController def show not_found unless question - @answer = Answer.new(player_id: current_player.id, node_id: question.id) - + @answer = Answer.find_or_initialize_by(player_id: current_player.id, node_id: question.id) end diff --git a/config/locales/en.yml b/config/locales/en.yml index 4ee6b2a..72317ca 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,7 +12,7 @@ en: see_results: See results results: Results read_more: Read more - share_on_story: Share on story + share_on_story: Share please_type_your_name_to_continue: Please type your name to continue diff --git a/config/routes.rb b/config/routes.rb index cd37267..5ea2183 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,6 +56,7 @@ Rails.application.routes.draw do post 'player', to: 'players#create' post 'q/:id/answer', to: 'answers#create' + patch 'q/:id/answer', to: 'answers#update' get 'q/:id/answer', to: 'questions#answer' get 'q/:id', to: 'questions#show'