Mattias Bodlund 7 months ago
parent
commit
ef22c0bc87
5 changed files with 12 additions and 9 deletions
  1. +2
    -2
      app/controllers/concerns/quiz_helper_methods.rb
  2. +6
    -3
      app/controllers/languages_controller.rb
  3. +2
    -2
      app/views/players/new.html.erb
  4. +1
    -1
      app/views/questions/answer.html.erb
  5. +1
    -1
      config/locales/en.yml

+ 2
- 2
app/controllers/concerns/quiz_helper_methods.rb View File

@ -39,12 +39,12 @@ private
def questions_size
@questions_size ||= questions.size + 1
@questions_size ||= questions.size
end
def question_index
@question_index ||= (params[:id].to_i + 1)
@question_index ||= (params[:id].to_i)
end


+ 6
- 3
app/controllers/languages_controller.rb View File

@ -2,11 +2,11 @@ class LanguagesController < ApplicationController
before_action :set_locale_to_default, only: :index
before_action :set_locale, only: :show
before_action :set_node
helper_method :accept_language
def index
@node = Node.roots.viewable.first
not_found unless @node
end
@ -14,7 +14,6 @@ class LanguagesController < ApplicationController
def show
@accept_language = params[:locale]
@node = Node.roots.viewable.first
not_found unless @node
@ -33,6 +32,10 @@ class LanguagesController < ApplicationController
private
def set_node
@node = Node.roots.viewable.first
end
def accept_language
@accept_language ||= first_matching_language
end
@ -42,7 +45,7 @@ private
accept_languages = request.env['HTTP_ACCEPT_LANGUAGE'].to_s.split(',').map { |l|
lang, q_factor = l.split(';q=')
[lang, (q_factor || '1').to_f]
}.sort_by { |_, q| -q }.map(&:first)
}.sort_by { |_, q| -q }.map(&:first)
available_languages = I18n.t('languages').keys.map(&:to_s)


+ 2
- 2
app/views/players/new.html.erb View File

@ -7,9 +7,9 @@
<div class="question-container">
<div class="question-step">
<!--<div class="question-step">
<div>1/<%= questions_size %></div>
</div>
</div>-->
<div class="question-header">
<%= t 'what_is_your_name' %>


+ 1
- 1
app/views/questions/answer.html.erb View File

@ -26,7 +26,7 @@
<% if question == questions.last %>
<%= link_to t('see_results'), url_for(controller: 'questions', action: 'result'), class: 'button__base' %>
<% else %>
<%= link_to t('next_question'), url_for(controller: 'questions', action: 'show', id: question_index), class: 'button__base' %>
<%= link_to t('next_question'), url_for(controller: 'questions', action: 'show', id: question_index.next), class: 'button__base' %>
<% end %>
</div>

+ 1
- 1
config/locales/en.yml View File

@ -4,7 +4,7 @@ en:
client_name: IKEA Foundation
get_started: Let’s go!
what_is_your_name: What's your name
what_is_your_name: What's your name?
please_type_your_name_here: Please type your name here…
submit: Submit
next_question: Next question


Loading…
Cancel
Save