From 8c38de6cfd15325d3e26d27205da020315602155 Mon Sep 17 00:00:00 2001 From: Rahul Date: Mon, 22 Jul 2019 00:59:17 +0530 Subject: [PATCH] add alias for booth Booth can be replaced with any alias by replacing it in alias.en.yml. This change is introduced as some events do not use booth but uses other words such as stand. --- app/controllers/admin/booths_controller.rb | 28 +++++++++---------- app/controllers/booths_controller.rb | 4 +-- app/helpers/application_helper.rb | 2 +- app/views/admin/booths/_all_booths.csv.haml | 4 +-- app/views/admin/booths/_all_booths.pdf.prawn | 4 +-- app/views/admin/booths/_all_booths.xlsx.axlsx | 4 +-- .../booths/_change_state_dropdown.html.haml | 14 +++++----- .../admin/booths/_confirmed_booths.csv.haml | 4 +-- .../admin/booths/_confirmed_booths.pdf.prawn | 2 +- .../admin/booths/_confirmed_booths.xlsx.axlsx | 4 +-- app/views/admin/booths/index.html.haml | 20 ++++++------- app/views/admin/booths/new.html.haml | 2 +- app/views/admin/conferences/edit.html.haml | 2 +- app/views/admin/emails/index.html.haml | 8 +++--- app/views/admin/splashpages/_form.html.haml | 2 +- app/views/admin/splashpages/show.html.haml | 2 +- .../versions/_object_desc_and_link.html.haml | 2 +- app/views/booths/_form.html.haml | 6 ++-- app/views/booths/index.html.haml | 4 +-- app/views/booths/new.html.haml | 2 +- app/views/conferences/_booths.haml | 2 +- app/views/conferences/_call_for_booths.haml | 10 +++---- .../conferences/_conference_details.html.haml | 4 +-- app/views/layouts/_admin_sidebar.html.haml | 2 +- app/views/layouts/_user_menu.html.haml | 2 +- config/locales/alias.en.yml | 3 ++ .../admin/booths_controller_spec.rb | 6 ++-- spec/controllers/booths_controller_spec.rb | 4 +-- spec/spec_helper.rb | 4 +++ 29 files changed, 82 insertions(+), 75 deletions(-) create mode 100644 config/locales/alias.en.yml diff --git a/app/controllers/admin/booths_controller.rb b/app/controllers/admin/booths_controller.rb index 045d24a7..0a8027ca 100644 --- a/app/controllers/admin/booths_controller.rb +++ b/app/controllers/admin/booths_controller.rb @@ -7,7 +7,7 @@ module Admin include Invitation def index - @file_name = "booths_for_#{@conference.short_title}" + @file_name = "#{(t 'booth').pluralize}_for_#{@conference.short_title}" @booth_export_option = params[:booth_export_option] respond_to do |format| format.html @@ -41,9 +41,9 @@ module Admin if @booth.save booth_responsible_invite redirect_to admin_conference_booths_path, - notice: 'Booth successfully created.' + notice: "#{(t 'booth').capitalize} successfully created." else - flash.now[:error] = "Creating booth failed. #{@booth.errors.full_messages.to_sentence}." + flash.now[:error] = "Creating #{t 'booth'} failed. #{@booth.errors.full_messages.to_sentence}." render :new end end @@ -59,9 +59,9 @@ module Admin booth_responsible_invite if @booth.save redirect_to admin_conference_booths_path, - notice: "Successfully updated booth for #{@booth.title}." + notice: "Successfully updated #{t 'booth'} for #{@booth.title}." else - flash.now[:error] = "An error prohibited the Booth for #{@booth.title} "\ + flash.now[:error] = "An error prohibited the #{t'booth'} for #{@booth.title} "\ "#{@booth.errors.full_messages.join('. ')}." render :edit end @@ -75,19 +75,19 @@ module Admin Mailbot.conference_booths_acceptance_mail(@booth).deliver_later end redirect_to admin_conference_booths_path(conference_id: @conference.short_title), - notice: 'Booth successfully accepted!' + notice: "#{(t'booth').capitalize} successfully accepted!" else redirect_to admin_conference_booths_path(conference_id: @conference.short_title) - flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}." + flash[:error] = "#{(t 'booth').capitalize} could not be accepted. #{@booth.errors.full_messages.to_sentence}." end end def to_accept - update_state(:to_accept, 'Booth to accept') + update_state(:to_accept, "#{(t'booth').capitalize} to accept") end def to_reject - update_state(:to_reject, 'Booth to reject') + update_state(:to_reject, "#{(t'booth').capitalize} to reject") end def reject @@ -96,23 +96,23 @@ module Admin if @booth.save Mailbot.conference_booths_rejection_mail(@booth).deliver_later redirect_to admin_conference_booths_path(conference_id: @conference.short_title), - notice: 'Booth successfully rejected.' + notice: "#{(t'booth').capitalize} successfully rejected." else redirect_to admin_conference_booths_path(conference_id: @conference.short_title) - flash[:error] = "Booth could not be rejected. #{@booth.errors.full_messages.to_sentence}." + flash[:error] = "#{(t 'booth').capitalize} could not be rejected. #{@booth.errors.full_messages.to_sentence}." end end def restart - update_state(:restart, 'Booth is submitted') + update_state(:restart, "#{(t 'booth').capitalize} is submitted") end def cancel - update_state(:cancel, 'Booth is canceled') + update_state(:cancel, "#{(t 'booth').capitalize} is canceled") end def confirm - update_state(:confirm, 'Booth successfully confirmed') + update_state(:confirm, "#{(t 'booth').capitalize} successfully confirmed") end private diff --git a/app/controllers/booths_controller.rb b/app/controllers/booths_controller.rb index 4600ab61..9cd6f475 100644 --- a/app/controllers/booths_controller.rb +++ b/app/controllers/booths_controller.rb @@ -25,9 +25,9 @@ class BoothsController < ApplicationController if @booth.save booth_responsible_invite redirect_to conference_booths_path, - notice: 'Booth successfully created.' + notice: "#{(t 'booth').capitalize} successfully created." else - flash.now[:error] = "Creating booth failed. #{@booth.errors.full_messages.to_sentence}." + flash.now[:error] = "Creating #{t 'booth'} failed. #{@booth.errors.full_messages.to_sentence}." render :new end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c8b9acbe..1ddca489 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -127,7 +127,7 @@ module ApplicationHelper user_selector_input( :responsibles, form, - 'The people responsible for the booth. You can only select existing users.' + "The people responsible for the #{t 'booth'}. You can only select existing users." ) end diff --git a/app/views/admin/booths/_all_booths.csv.haml b/app/views/admin/booths/_all_booths.csv.haml index 7a6f10fd..334918ac 100644 --- a/app/views/admin/booths/_all_booths.csv.haml +++ b/app/views/admin/booths/_all_booths.csv.haml @@ -1,4 +1,4 @@ -- headers = ['Booth ID', +- headers = ["#{(t'booth').capitalize } ID", 'Title', 'Description', 'Reasoning', @@ -6,7 +6,7 @@ 'Submitter Relationship', 'Website Url', 'State'] -= CSV.generate_line ['All booths'] += CSV.generate_line ["All #{(t'booth').pluralize}"] = CSV.generate_line headers - @booths.each do |booth| = CSV.generate_line([booth.id, diff --git a/app/views/admin/booths/_all_booths.pdf.prawn b/app/views/admin/booths/_all_booths.pdf.prawn index 168397e8..df034b79 100644 --- a/app/views/admin/booths/_all_booths.pdf.prawn +++ b/app/views/admin/booths/_all_booths.pdf.prawn @@ -1,6 +1,6 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| booths_array = [] - header_array = ['Booth ID', + header_array = ["#{(t'booth').capitalize } ID", 'Title', 'Description', 'Reasoning', @@ -21,6 +21,6 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: row << booth.state booths_array << row end - pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center + pdf.text "#{@conference.short_title} #{(t'booth').pluralize}", font_size: 25, align: :center pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45] end diff --git a/app/views/admin/booths/_all_booths.xlsx.axlsx b/app/views/admin/booths/_all_booths.xlsx.axlsx index 43f77b49..5a0a1d48 100644 --- a/app/views/admin/booths/_all_booths.xlsx.axlsx +++ b/app/views/admin/booths/_all_booths.xlsx.axlsx @@ -1,9 +1,9 @@ # frozen_string_literal: true -wb.add_worksheet(name: 'all booths') do |sheet| +wb.add_worksheet(name: "all #{(t 'booth').pluralize}") do |sheet| bold_style = wb.styles.add_style(b: true) wrap_text = wb.styles.add_style alignment: {wrap_text: true} - row = ['Booth ID', + row = ["#{(t 'booth').capitalize} ID", 'Title', 'Description', 'Reasoning', diff --git a/app/views/admin/booths/_change_state_dropdown.html.haml b/app/views/admin/booths/_change_state_dropdown.html.haml index 338e43f7..e55fdc35 100644 --- a/app/views/admin/booths/_change_state_dropdown.html.haml +++ b/app/views/admin/booths/_change_state_dropdown.html.haml @@ -2,12 +2,12 @@ - if booth.transition_possible? :accept - if can? :accept, booth - if @conference.booth_limit > 0 - - confirm_message = ' You are able to accept '+ pluralize(@conference.booth_limit - (@conference.booths.accepted.count + @conference.booths.confirmed.count), 'more booth') + " (booth limit set to #{@conference.booth_limit}). Are you sure you want to accept this one?" + - confirm_message = ' You are able to accept '+ pluralize(@conference.booth_limit - (@conference.booths.accepted.count + @conference.booths.confirmed.count), "more #{t'booth'}") + " (#{t'booth'} limit set to #{@conference.booth_limit}). Are you sure you want to accept this one?" - if @conference.email_settings.send_on_booths_acceptance - link = 'Accept with email' - - confirm_message = "By accepting this booth, an email will be sent informing the submitter for the acceptance. You may change the state to \'To accept\' until you are completely sure." + confirm_message + - confirm_message = "By accepting this #{t'booth'}, an email will be sent informing the submitter for the acceptance. You may change the state to \'To accept\' until you are completely sure." + confirm_message - else - - link = 'Accept booth' + - link = "Accept #{t'booth'}" %li= link_to link, accept_admin_conference_booth_path(@conference.short_title, booth), method: :patch ,id: "accept_booth_#{booth.id}", @@ -24,7 +24,7 @@ data: (@conference.email_settings.send_on_booths_rejection ? { confirm: 'By rejecting this booth, an email will be sent informing the submitter about the rejection. You may change the state to \'To reject\' until you are completely sure.'} : nil) - if booth.transition_possible? :to_reject - %li= link_to 'To reject booth', + %li= link_to "To reject #{t'booth'}", to_reject_admin_conference_booth_path(@conference.short_title, booth), method: :patch, id: "to_reject_booth_#{booth.id}" @@ -34,16 +34,16 @@ method: :patch, id: "restart_booth_#{booth.id}" - if booth.transition_possible? :to_accept - %li= link_to 'To accept booth', + %li= link_to "To accept #{t'booth'}", to_accept_admin_conference_booth_path(@conference.short_title, booth), method: :patch, id: "to_accept_booth_#{booth.id}" - if booth.transition_possible? :cancel - %li= link_to 'Cancel booth', + %li= link_to "Cancel #{t'booth'}", cancel_admin_conference_booth_path(@conference.short_title, booth), method: :patch, id: "cancel_booth_#{booth.id}" - if booth.transition_possible? :confirm - %li= link_to 'Confirm booth', + %li= link_to "Confirm #{t'booth'}", confirm_admin_conference_booth_path(@conference.short_title, booth), method: :patch, id: "confirm_booth_#{booth.id}" diff --git a/app/views/admin/booths/_confirmed_booths.csv.haml b/app/views/admin/booths/_confirmed_booths.csv.haml index b5d17eb4..acf7dcc0 100644 --- a/app/views/admin/booths/_confirmed_booths.csv.haml +++ b/app/views/admin/booths/_confirmed_booths.csv.haml @@ -1,4 +1,4 @@ -- headers = ['Booth ID', +- headers = ["#{(t'booth').capitalize } ID", 'Title', 'Description', 'Reasoning', @@ -6,7 +6,7 @@ 'Submitter Relationship', 'Website Url', 'State'] -= CSV.generate_line ['All booths'] += CSV.generate_line ["All #{(t'booth').pluralize}"] = CSV.generate_line headers - @booths.confirmed.each do |booth| = CSV.generate_line([booth.id, diff --git a/app/views/admin/booths/_confirmed_booths.pdf.prawn b/app/views/admin/booths/_confirmed_booths.pdf.prawn index a9750ab9..b3902ff7 100644 --- a/app/views/admin/booths/_confirmed_booths.pdf.prawn +++ b/app/views/admin/booths/_confirmed_booths.pdf.prawn @@ -1,6 +1,6 @@ prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf| booths_array = [] - header_array = ['Booth ID', + header_array = ["#{(t'booth').capitalize } ID", 'Title', 'Description', 'Reasoning', diff --git a/app/views/admin/booths/_confirmed_booths.xlsx.axlsx b/app/views/admin/booths/_confirmed_booths.xlsx.axlsx index 4d119fae..a6016703 100644 --- a/app/views/admin/booths/_confirmed_booths.xlsx.axlsx +++ b/app/views/admin/booths/_confirmed_booths.xlsx.axlsx @@ -1,9 +1,9 @@ # frozen_string_literal: true -wb.add_worksheet(name: 'all booths') do |sheet| +wb.add_worksheet(name: "all #{(t 'booth').pluralize}") do |sheet| bold_style = wb.styles.add_style(b: true) wrap_text = wb.styles.add_style alignment: {wrap_text: true} - row = ['Booth ID', + row = ["#{(t 'booth').capitalize} ID", 'Title', 'Description', 'Reasoning', diff --git a/app/views/admin/booths/index.html.haml b/app/views/admin/booths/index.html.haml index e135be56..d5c02bdc 100644 --- a/app/views/admin/booths/index.html.haml +++ b/app/views/admin/booths/index.html.haml @@ -2,7 +2,7 @@ .col-md-12 .page-header %h1 - Booths + #{(t'booth').pluralize.capitalize } .pull-right - if can? :read, Booth .btn-group @@ -11,8 +11,8 @@ Export PDF %span.caret %ul.dropdown-menu{ role: 'menu' } - %li= link_to 'All Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'all') - %li= link_to 'Confirmed Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'confirmed') + %li= link_to "All #{(t'booth').pluralize.capitalize }", admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'all') + %li= link_to "Confirmed #{(t'booth').pluralize.capitalize }", admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'confirmed') .btn-group %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } Export CSV @@ -29,7 +29,7 @@ %li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'confirmed') = "(#{@booths.length})" if @booths.any? %p.text-muted - All the booth requests + All the #{t'booth'} requests .row .col-md-12 @@ -37,21 +37,21 @@ - if @conference.booth_limit == 0 %p Set the - = link_to 'Booth limit', edit_admin_conference_path(@conference.short_title) - to make sure you are not accepting more booths than you can accommodate. + = link_to "#{(t'booth').capitalize } limit", edit_admin_conference_path(@conference.short_title) + to make sure you are not accepting more #{(t'booth').pluralize} than you can accommodate. - elsif !@conference.maximum_accepted_booths? %p You cannot accept more than %b - = pluralize(@conference.booth_limit, 'booth') + = pluralize(@conference.booth_limit, "#{t'booth'}") ( - = pluralize(@conference.booths.accepted.count + @conference.booths.confirmed.count, 'accepted booth') + = pluralize(@conference.booths.accepted.count + @conference.booths.confirmed.count, "accepted #{t'booth'}") so far) - else %p - You have reached the maximum number of accepted booths. + You have reached the maximum number of accepted #{(t'booth').pluralize}. ( - = link_to "#{@conference.booth_limit} booths", edit_admin_conference_path(@conference.short_title) + = link_to "#{@conference.booth_limit} #{(t'booth').pluralize}", edit_admin_conference_path(@conference.short_title) ) - if @booths.any? %table.datatable diff --git a/app/views/admin/booths/new.html.haml b/app/views/admin/booths/new.html.haml index 99ec9b20..0cf6adb5 100644 --- a/app/views/admin/booths/new.html.haml +++ b/app/views/admin/booths/new.html.haml @@ -1,3 +1,3 @@ -%h1 New booth +%h1 New #{t'booth'} = render 'booths/form' diff --git a/app/views/admin/conferences/edit.html.haml b/app/views/admin/conferences/edit.html.haml index ac90610d..edb8f12b 100644 --- a/app/views/admin/conferences/edit.html.haml +++ b/app/views/admin/conferences/edit.html.haml @@ -28,5 +28,5 @@ = f.input :registration_limit, as: :number, in: 0..9999, hint: 'Limit the number of registrations to the conference (0 no limit). Please note that the registration limit doesn\'t apply to speakers of confirmed events (they will still be able to register even if it has been reached). You currently have ' + pluralize(@conference.registrations.count, 'registration') = f.inputs name: 'Booths' do = f.input :booth_limit, as: :number, in: 0..9999, - hint: 'Booth limit is the maximum number of booths that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not going to accept more booths than the conference can accommodate. You currently have ' + pluralize(@conference.booths.accepted.count, 'accepted booth') +'.' + hint: "#{(t'booth').capitalize } limit is the maximum number of #{(t'booth').pluralize} that you can accept for this conference. By setting this number (0 no limit) you can be sure that you are not going to accept more #{(t'booth').pluralize} than the conference can accommodate. You currently have " + pluralize(@conference.booths.accepted.count, "accepted #{t'booth'}") +'.' = f.action :submit, as: :button, button_html: { class: 'btn btn-primary', data: { confirm: 'Are you sure you want to proceed?' } } diff --git a/app/views/admin/emails/index.html.haml b/app/views/admin/emails/index.html.haml index 7e3b195d..97946a75 100644 --- a/app/views/admin/emails/index.html.haml +++ b/app/views/admin/emails/index.html.haml @@ -114,18 +114,18 @@ = f.input :booths_acceptance_subject = f.input :booths_acceptance_body, input_html: { rows:10, cols: 20 } %a.btn.btn-link.control_label.load_template{ 'data-subject-input-id' => 'email_settings_booths_acceptance_subject', - 'data-subject-text' => 'Your booth has been accepted!', + 'data-subject-text' => "Your #{t'booth'} has been accepted!", 'data-body-input-id' => 'email_settings_booths_acceptance_body', - 'data-body-text' => "Dear {name},\n\nWe are pleased to inform you that your booth request {booth_title} has been accepted for the conference {conference}.\nPlease click the confirm button to let us know you can make it as soon as possible!\n\nFeel free to contact us with any questions or concerns.\n\nWe are looking forward to seeing you there.\n\nBest wishes\n\n{conference} Team"} Load Template + 'data-body-text' => "Dear {name},\n\nWe are pleased to inform you that your #{t'booth'} request {booth_title} has been accepted for the conference {conference}.\nPlease click the confirm button to let us know you can make it as soon as possible!\n\nFeel free to contact us with any questions or concerns.\n\nWe are looking forward to seeing you there.\n\nBest wishes\n\n{conference} Team"} Load Template %a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'booth_acceptance_help' } Show help = render partial: 'help', locals: {id: 'booth_acceptance_help', show_event_variables: false} = f.input :send_on_booths_rejection = f.input :booths_rejection_subject = f.input :booths_rejection_body, input_html: { rows:10, cols:20 } %a.btn.btn-link.control_label.load_template{ 'data-subject-input-id' => 'email_settings_booths_rejection_subject', - 'data-subject-text' => 'Your booth request has been rejected', + 'data-subject-text' => "Your #{t'booth'} request has been rejected", 'data-body-input-id' => 'email_settings_booths_rejection_body', - 'data-body-text' => "Dear {name},\n\nThank you for your booth request {booth_title} for the conference {conference}.\n\nUnfortunately, we are sorry to inform you that your request has been rejected.\n\n\nBest wishes\n\n{conference} Team" } Load Template + 'data-body-text' => "Dear {name},\n\nThank you for your #{t'booth'} request {booth_title} for the conference {conference}.\n\nUnfortunately, we are sorry to inform you that your request has been rejected.\n\n\nBest wishes\n\n{conference} Team" } Load Template %a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'booth_rejection_help' } Show help = render partial: 'help', locals: {id: 'booth_rejection_help', show_event_variables: false} diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index 874d9b37..3db1e9ea 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -24,7 +24,7 @@ %li = f.input :include_tracks, label: 'Include confirmed tracks', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tracks) } %li - = f.input :include_booths, label: 'Include confirmed booths', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_booths) } + = f.input :include_booths, label: "Include confirmed #{(t'booth').pluralize}", input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_booths) } %li = f.input :include_registrations, label: 'Display the registration period', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_registrations) } diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index aedd4aff..a9046fdc 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -26,7 +26,7 @@ Include confirmed tracks %li %i{ class: "fa-li #{icon_for_todo @splashpage.include_booths?}" } - Include confirmed booths + Include confirmed #{(t'booth').pluralize} %li %i{ class: "fa-li #{icon_for_todo @splashpage.include_registrations?}" } Display the registration period diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 5f81f29e..1728b999 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -102,7 +102,7 @@ conference - when 'Booth' - = 'booth' + = t 'booth' = link_if_alive version, object.title, admin_conference_booth_path(conference_id: Conference.find(version.conference_id).short_title, id: version.item_id ), conference diff --git a/app/views/booths/_form.html.haml b/app/views/booths/_form.html.haml index ab9080d3..b9a0e511 100644 --- a/app/views/booths/_form.html.haml +++ b/app/views/booths/_form.html.haml @@ -13,15 +13,15 @@ = f.input :website_url = responsibles_selector_input f = f.input :invite_responsible, - hint: 'This field is to invite unregistered users using their email to become booth responsibles.' + hint: "This field is to invite unregistered users using their email to become #{(t'booth_responsible').pluralize}." = image_tag f.object.picture.thumb.url if f.object.picture? = f.input :picture %p.text-right - if @booth.new_record? - = f.submit 'Create Booth Request', class: 'btn btn-success' + = f.submit "Create #{(t'booth').capitalize } Request", class: 'btn btn-success' - else - = f.submit 'Update Booth Request', class: 'btn btn-success' + = f.submit "Update #{(t'booth').capitalize } Request", class: 'btn btn-success' :javascript $(document).ready(function() { diff --git a/app/views/booths/index.html.haml b/app/views/booths/index.html.haml index 3ec4c222..a1b37cc1 100644 --- a/app/views/booths/index.html.haml +++ b/app/views/booths/index.html.haml @@ -2,7 +2,7 @@ .row .col-md-12.page-header %h1 - Your booth requests for + Your #{t'booth'} requests for = @conference.title .row .col-md-12 @@ -48,4 +48,4 @@ restart_conference_booth_path(@conference.short_title, booth), method: :patch, class: 'btn btn-mini btn-success', id: "restart_booth_#{booth.id}" .pull-right - = link_to 'Add Booth', new_conference_booth_path(@conference.short_title), class: 'button btn btn-primary' + = link_to "Add #{(t'booth').capitalize }", new_conference_booth_path(@conference.short_title), class: 'button btn btn-primary' diff --git a/app/views/booths/new.html.haml b/app/views/booths/new.html.haml index 169efd17..6713d312 100644 --- a/app/views/booths/new.html.haml +++ b/app/views/booths/new.html.haml @@ -1,4 +1,4 @@ .container - %h1 Request a booth + %h1 Request a #{t'booth'} = render 'form' diff --git a/app/views/conferences/_booths.haml b/app/views/conferences/_booths.haml index da14526e..026af2fc 100644 --- a/app/views/conferences/_booths.haml +++ b/app/views/conferences/_booths.haml @@ -1,6 +1,6 @@ .row .col-md-12 - %h3.text-center Booths + %h3.text-center "#{(t'booth').pluralize.capitalize }" .row.row-centered - booths.each do |booth| .col-md-2.col-sm-2.col-centered.col-top.booth diff --git a/app/views/conferences/_call_for_booths.haml b/app/views/conferences/_call_for_booths.haml index 7738fad7..5e81e7e8 100644 --- a/app/views/conferences/_call_for_booths.haml +++ b/app/views/conferences/_call_for_booths.haml @@ -1,12 +1,12 @@ - cache [conference_id, call, '#splash#callforbooths'] do .col-md-4.col-sm-4.text-center %h2 - Call for Booths + Call for #{(t'booth').pluralize.capitalize } %p.lead - We are now accepting custom booth requests! + We are now accepting custom #{t'booth'} requests! %p - Would you like to request a new booth? - The submission period for booth requests is open + Would you like to request a new #{t'booth'}? + The submission period for #{t'booth'} requests is open %em = date_string(call.start_date, call.end_date) + '.' %b @@ -14,6 +14,6 @@ = pluralize(call.remaining_days, 'day') left! %p.cta-button - = link_to("Submit your request for booth", + = link_to("Submit your request for #{t'booth'}", new_conference_booth_path(conference_id), class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/_conference_details.html.haml b/app/views/conferences/_conference_details.html.haml index 1504e847..08b73023 100644 --- a/app/views/conferences/_conference_details.html.haml +++ b/app/views/conferences/_conference_details.html.haml @@ -44,9 +44,9 @@ - if conference.program.cfp_open? = link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), class: 'btn btn-default' - if current_user && current_user.booths.where(conference_id: conference.id).count > 0 - = link_to 'My Booth Requests', conference_booths_path(conference.short_title), class: 'btn btn-default' + = link_to "My #{(t'booth').capitalize } Requests", conference_booths_path(conference.short_title), class: 'btn btn-default' - elsif can? :new, conference.booths.new - = link_to 'Request Booth', new_conference_booth_path(conference.short_title), class: 'btn btn-default' + = link_to "Request #{(t'booth').capitalize }", new_conference_booth_path(conference.short_title), class: 'btn btn-default' - if current_user.nil? || !current_user.subscribed?(conference) = link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default' - else diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index c6da29b0..78523bc7 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -120,7 +120,7 @@ %li = link_to admin_conference_booths_path(@conference.short_title) do %span.fa.fa-shopping-bag - Booths + = (t'booth').pluralize.capitalize - if can? :update, @conference.email_settings %li{class: active_nav_li(admin_conference_emails_path(@conference.short_title))} = link_to(admin_conference_emails_path(@conference.short_title)) do diff --git a/app/views/layouts/_user_menu.html.haml b/app/views/layouts/_user_menu.html.haml index 30e1d27f..5465a66a 100644 --- a/app/views/layouts/_user_menu.html.haml +++ b/app/views/layouts/_user_menu.html.haml @@ -38,7 +38,7 @@ %li = link_to (conference_booths_path(@conference.short_title)) do %span.fa.fa-shopping-bag - My Booth Requests + My #{(t'booth').capitalize } Requests %li - if ENV['OSEM_ICHAIN_ENABLED'] == 'true' = link_to(destroy_user_ichain_session_path, method: 'delete') do diff --git a/config/locales/alias.en.yml b/config/locales/alias.en.yml new file mode 100644 index 00000000..0452d7a9 --- /dev/null +++ b/config/locales/alias.en.yml @@ -0,0 +1,3 @@ +en: + booth: 'stand' + booth_responsible: 'stand organizer' diff --git a/spec/controllers/admin/booths_controller_spec.rb b/spec/controllers/admin/booths_controller_spec.rb index 853fed4c..72d8f234 100644 --- a/spec/controllers/admin/booths_controller_spec.rb +++ b/spec/controllers/admin/booths_controller_spec.rb @@ -75,7 +75,7 @@ describe Admin::BoothsController do end it 'shows success message' do - expect(flash[:notice]).to match('Booth successfully created.') + expect(flash[:notice]).to match("#{(t 'booth').capitalize} successfully created.") end it 'creates a new user on inviting booth responsible' do @@ -106,7 +106,7 @@ describe Admin::BoothsController do end it 'shows flash message' do - expect(flash[:error]).to eq("Creating booth failed. Title can't be blank.") + expect(flash[:error]).to eq("Creating #{t 'booth'} failed. Title can't be blank.") end end end @@ -131,7 +131,7 @@ describe Admin::BoothsController do end it 'shows success message' do - expect(flash[:notice]).to match 'Successfully updated booth.' + expect(flash[:notice]).to match "Successfully updated #{t 'booth'}." end it 'updates booth' do diff --git a/spec/controllers/booths_controller_spec.rb b/spec/controllers/booths_controller_spec.rb index f49d2fd9..c7f1414e 100644 --- a/spec/controllers/booths_controller_spec.rb +++ b/spec/controllers/booths_controller_spec.rb @@ -55,7 +55,7 @@ describe BoothsController do end it 'shows success message' do - expect(flash[:notice]).to match('Booth successfully created.') + expect(flash[:notice]).to match("#{(t 'booth').capitalize} successfully created.") end it 'creates a new user on inviting booth responsible' do @@ -86,7 +86,7 @@ describe BoothsController do end it 'shows flash message' do - expect(flash[:error]).to eq("Creating booth failed. Title can't be blank.") + expect(flash[:error]).to eq("Creating #{t 'booth'} failed. Title can't be blank.") end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 82d0a75a..fe6bab9b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -121,6 +121,10 @@ RSpec.configure do |config| # save_and_open_page # end # end + + # use the config to use + # t('some.locale.key') instead of always having to type I18n.t + config.include AbstractController::Translation end OmniAuth.config.test_mode = true