diff --git a/Gemfile.lock b/Gemfile.lock index c5dcddb..938f1f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM activesupport (>= 7.0.0) rack railties (>= 7.0.0) - psych (5.2.3) + psych (5.2.4) date stringio public_suffix (6.0.2) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 55901a6..f9e6150 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -318,6 +318,16 @@ main { padding: 1.6rem 1.2rem; } +.error { + padding: 1.6rem 1.2rem; + border-radius: 1.6rem; + background-color: var(--clr-text-highlight); + color: var(--clr-black); + font-size: var(--fs-s); + line-height: 1.2; + +} + .question-answer { font-size: var(--fs-lg); @@ -342,8 +352,7 @@ main { &:has(input[type=radio]:checked) { & label { - outline: 4px solid var(--clr-text-highlight); - outline-offset: -4px; + background-color: var(--clr-text-highlight); } } @@ -454,7 +463,7 @@ label.question-answer { } &:has(.field_with_errors) { - outline: 4px solid var(--clr-error); + outline: 4px solid var(--clr-text-highlight); outline-offset: -4px; } } diff --git a/app/models/player.rb b/app/models/player.rb index e17d071..fdc65ff 100644 --- a/app/models/player.rb +++ b/app/models/player.rb @@ -1,6 +1,6 @@ class Player < ApplicationRecord - validates_presence_of :name + validates_presence_of :name, message: I18n.t('please_type_your_name_to_continue') has_many :answers, dependent: :destroy diff --git a/app/views/players/new.html.erb b/app/views/players/new.html.erb index 6ee0ab7..3a2bb69 100644 --- a/app/views/players/new.html.erb +++ b/app/views/players/new.html.erb @@ -14,6 +14,14 @@
<%= t 'what_is_your_name' %>
+ + <% if form.object.errors.any? %> +
+ <% form.object.errors.messages.each do |k, v| %> + <%= v.join(', ') %> + <% end %> +
+ <% end %> <%= form.label :name, class: "question-answer" do %> <%= form.text_field :name, placeholder: t('what_is_your_name') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e65842f..4ee6b2a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,7 +12,8 @@ en: see_results: See results results: Results read_more: Read more - share_on_story: Share on story + share_on_story: Share on story + please_type_your_name_to_continue: Please type your name to continue languages: