From fd729c4a49b9d5a49ca15ea678e593a70db22391 Mon Sep 17 00:00:00 2001 From: Godwin Date: Mon, 5 Jun 2017 13:57:05 -0700 Subject: [PATCH] Registration fixes and improvements --- Rakefile | 67 ++++++- app/assets/javascripts/main.js | 11 ++ app/assets/stylesheets/_application.scss | 175 ++++++++++++++---- app/assets/stylesheets/_settings.scss | 2 + .../conference_administration_controller.rb | 12 ++ app/controllers/conferences_controller.rb | 3 +- app/helpers/admin_helper.rb | 2 +- .../registration_steps/_group_ride.html.haml | 2 +- .../_org_create_address.html.haml | 4 +- .../registration_steps/_policy.html.haml | 4 +- .../registration_steps/_review.html.haml | 19 +- config/locales/en.yml | 10 +- 12 files changed, 251 insertions(+), 60 deletions(-) diff --git a/Rakefile b/Rakefile index ffec68e..7425d6e 100644 --- a/Rakefile +++ b/Rakefile @@ -67,28 +67,83 @@ end task :i18n do LinguaFranca.test LinguaFranca::TestModes::RECORD do - Rake::Task[:cucumber].execute + Rake::Task['cucumber:run'].execute end end task :css do ENV['CSS_TEST'] = '1' - Rake::Task[:cucumber].execute + Rake::Task['cucumber:run'].execute ENV['CSS_TEST'] = nil end task :a11y do ENV['TEST_A11Y'] = '1' - Rake::Task[:cucumber].execute + Rake::Task['cucumber:run'].execute ENV['TEST_A11Y'] = nil end task "cucumber:debug" do ENV['TEST_DEBUG'] = '1' - Rake::Task[:cucumber].execute + Rake::Task['cucumber:run'].execute ENV['TEST_DEBUG'] = nil end -Cucumber::Rake::Task.new(:cucumber) do |t| - t.cucumber_opts = "features --format pretty" +# Cucumber::Rake::Task.new(:cucumber) do |t| +# t.cucumber_opts = "features --format pretty" +# end + +namespace :cucumber do + directory 'tmp' + @rerun_file = 'tmp/rerun.txt' + + Cucumber::Rake::Task.new(:all) do |task| + task.cucumber_opts = "features --format pretty --format rerun --out tmp/rerun.txt" + end + + desc 'Run cucumber features' + task run: :tmp do + retry_on_failure do + run_features + end + clean_up + exit @exit_status + end + + def retry_on_failure + rm_rf @rerun_file + @retries = 0 + begin + @exit_status = 0 + yield + rescue SystemExit => e + @exit_status = e.status + if retry?(exception: e) + @retries += 1 + retry + end + end + end + + def run_features + if File.exists? @rerun_file + Cucumber::Rake::Task::ForkedCucumberRunner.new(['lib'], Cucumber::BINARY, [ + 'features', + '--format', 'pretty', + '@tmp/rerun.txt', + '--format', 'rerun', + '--out', 'tmp/rerun.txt' + ], true, []).run + else + Rake::Task['cucumber:all'].invoke + end + end + + def retry?(exception: nil) + @retries < 2 && !exception.success? + end + + def clean_up + rm_rf @rerun_file.pathmap("%d") + end end diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 74d971d..38b943e 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -228,6 +228,17 @@ scrollTo.scrollIntoView(); } } + if (response[i].focus) { + var focusOn = document.querySelector(response[i].focus); + if (focusOn) { + if (typeof focusOn.select === "function" && focusOn.value.length) { + if (focusOn.type == "text" || focusOn.type == "email" || focusOn.type == "phone" || focusOn.tagName == "TEXTAREA") { + focusOn.select(); + } + } + focusOn.focus(); + } + } } } } diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index a71c729..5519b88 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -66,6 +66,7 @@ p { u { @include _(text-decoration-color, rgba($black, 0.5)); + text-decoration-skip: ink; } a { @@ -197,16 +198,20 @@ table, .table { width: 0.1rem; } - &#review tbody th { - width: auto; - vertical-align: top; - } + &#review { + margin: 0 auto; - &#review .scroller { - font-size: 0.75em; - max-width: 50em; - max-height: 25em; - overflow: auto; + .table-th { + width: auto; + vertical-align: top; + } + + .scroller { + font-size: 0.75em; + max-width: 50em; + max-height: 25em; + overflow: auto; + } } &.admin-edit { @@ -491,6 +496,23 @@ body.expanded-element { display: table-cell; } +.responsive-table { + display: block; + + .table-td { + padding: 1em; + } + + .table-tr, .table-th, .table-td { + display: block; + overflow: auto; + } + + .table-tr { + margin-bottom: 1em; + } +} + button, .button { @include button; @@ -572,6 +594,7 @@ button, button { width: 100%; + height: 10vw; background-color: $white; &.during-conference { @@ -579,7 +602,7 @@ button, } &.selected { - border: 0.25em solid rgba($colour-2, 0.5); + border: 0.25em solid $selected-colour; } } @@ -596,21 +619,26 @@ button, #main .actions { margin-top: 4em; - + &.center { text-align: center; } .buttons { display: inline-block; + display: flex; + text-align: right; + justify-content: center; + flex-wrap: wrap; - button { - margin: 0 0.333em; + button, .button { + margin: 0.333em; } } button[value="back"] { float: left; + order: -1; background-color: $mid-gray; } @@ -631,41 +659,29 @@ button, button { display: block; + width: 100%; padding: 0 2em; border: 0.05em solid $black; background-color: $white; &.selected { - box-shadow: 0 0 0 0.25em rgba($colour-2, 0.5); + box-shadow: 0 0 0 0.25em $selected-colour; } } } .registration-step-options { - display: table; - table-layout: fixed; margin: 0 auto; .options { - display: table-row; - + fieldset { margin: 2em 0; } } button { - display: table-cell; - margin: 0 0.5em; + margin: 0.5em auto; height: 3em; - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } } .check-box-field { @@ -680,8 +696,7 @@ button, background-color: $white; input { - display: table-cell; - width: 10em; + width: 100%; height: 3em; margin: 0; font-family: inherit; @@ -692,10 +707,10 @@ button, } button { - width: 50%; + width: 100%; margin: 0; border: 0; - border-left: inherit; + border-top: inherit; background-color: lighten($colour-1, 25%); } } @@ -744,6 +759,12 @@ ul.menu { @include font-family(secondary); } +#step-content { + form { + margin-top: 1em; + } +} + #action-message { display: none; text-align: center; @@ -1268,8 +1289,8 @@ input { content: '+'; border: 0; font-size: 2.5em; - top: -0.025em; - left: 0.175em; + top: -0.125em; + left: 0.075em; line-height: 1em; color: #FFF; height: 1em; @@ -1645,7 +1666,7 @@ fieldset { text-align: center; + button, + .button { - margin-left: 0.75em; + margin-top: 0.75em; } } @@ -3408,6 +3429,11 @@ body.policy .policy-agreement ul { button, .button { margin-left: 1em; height: 2.6em; + + + button, + .button { + margin-top: 0; + margin-left: 0.75em; + } } } } @@ -3768,6 +3794,13 @@ body.policy .policy-agreement ul { border: 0.1em solid; } + input[type="radio"] + label { + @include after { + top: -0.025em; + left: 0.175em; + } + } + &.inline { label { float: left; @@ -3812,7 +3845,71 @@ body.policy .policy-agreement ul { @include _(transform, none); } } -} + + #main table.calendar { + button { + height: 4em; + } + } + + #main .registration-step-options { + display: table; + table-layout: fixed; + + .options { + display: table-row; + } + + button { + display: table-cell; + margin: 0 0.5em; + width: auto; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + fieldset { + margin-bottom: 3em; + } + + .custom-option { + margin-top: 1em; + + input { + display: table-cell; + width: 10em; + } + + button { + width: 50%; + border-top: 0; + border-left: inherit; + } + } + } + + .responsive-table { + display: table; + + .table-tr { + display: table-row; + } + + .table-td { + padding: 0.25em 0.5em; + } + + .table-th, .table-td { + display: table-cell; + } + } +} // medium @include breakpoint(large) { #main { @@ -3866,6 +3963,12 @@ body.policy .policy-agreement ul { margin: 0 auto; } } + + #main table.calendar { + button { + height: 5em; + } + } } @include breakpoint(small, medium) { diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 996b1b3..86945e6 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -24,6 +24,8 @@ $green: $colour-5; $link-colour: darken($colour-1, 13%); +$selected-colour: rgba($blue, 0.5); + @mixin default-box-shadow($direction: top, $distance: 1, $inset: false, $additional-shadow: false) { @if capable_of(box-shadow) { $offset: 0.2em; diff --git a/app/controllers/conference_administration_controller.rb b/app/controllers/conference_administration_controller.rb index 236c0c8..4c3e5a6 100644 --- a/app/controllers/conference_administration_controller.rb +++ b/app/controllers/conference_administration_controller.rb @@ -99,6 +99,9 @@ class ConferenceAdministrationController < ApplicationController def administrate_description end + def administrate_group_ride + end + def administrate_poster end @@ -798,6 +801,15 @@ class ConferenceAdministrationController < ApplicationController return false end + def admin_update_group_ride + params[:group_ride_info].each do |locale, value| + @this_conference.set_column_for_locale(:group_ride_info, locale, html_value(value)) + end + @this_conference.save + set_success_message @admin_step + return false + end + def admin_update_poster begin @this_conference.poster = params[:poster] diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 841654b..5e2dfd1 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -98,7 +98,8 @@ class ConferencesController < ApplicationController render json: [{ globalSelector: '#step-content', html: view_context.step_message + render_to_string(partial: "registration_steps/#{@step}"), - scrollTo: '#action-message .message, #step-content' + scrollTo: '#action-message .message, #step-content', + focus: 'input:not([type="hidden"]), textarea, button.selected' }] end end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index a9b1979..c791c2f 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -2,7 +2,7 @@ module AdminHelper def administration_steps { - info: [:administrators, :dates, :description, :poster], + info: [:administrators, :dates, :description, :poster, :group_ride], payment: [:payment_message, :suggested_amounts, :paypal], registration: [:registration_status, :stats, :registrations, :broadcast], housing: [:providers, :housing], diff --git a/app/views/registration_steps/_group_ride.html.haml b/app/views/registration_steps/_group_ride.html.haml index dcc53e9..c234b25 100644 --- a/app/views/registration_steps/_group_ride.html.haml +++ b/app/views/registration_steps/_group_ride.html.haml @@ -2,7 +2,7 @@ = columns(medium: 12) do = registration_step_header_title - if @info.present? - = @info + = @info.html_safe - else = registration_step_header_description = row do diff --git a/app/views/registration_steps/_org_create_address.html.haml b/app/views/registration_steps/_org_create_address.html.haml index d8a490e..1480fa7 100644 --- a/app/views/registration_steps/_org_create_address.html.haml +++ b/app/views/registration_steps/_org_create_address.html.haml @@ -5,5 +5,5 @@ = textfield :address, @address, required: true, big: true .multi-field = textfield :city, @city.city, readonly: true - = textfield :territory, @city.translate_territory, readonly: true - = textfield :country, @city.translate_country, readonly: true + = textfield :territory, @city.translate_territory.html_safe, readonly: true + = textfield :country, @city.translate_country.html_safe, readonly: true diff --git a/app/views/registration_steps/_policy.html.haml b/app/views/registration_steps/_policy.html.haml index 34a1397..14f646e 100644 --- a/app/views/registration_steps/_policy.html.haml +++ b/app/views/registration_steps/_policy.html.haml @@ -7,8 +7,8 @@ %ul - policies.each do |term| %li - - id = "policies[#{term}]" - = check_box_tag(id, 1, (@accepted_policies || {}).include?(term)) + - id = "policies_#{term}" + = check_box_tag("policies[#{term}]", 1, (@accepted_policies || {}).include?(term), id: id) %label.term{for: id}=_"articles.policy.term.#{term.to_s}", :s, 2 = columns(medium: 12) do %p=_'articles.conference_registration.paragraphs.Confirm_Agreement', :p diff --git a/app/views/registration_steps/_review.html.haml b/app/views/registration_steps/_review.html.haml index c232ee2..ba63d20 100644 --- a/app/views/registration_steps/_review.html.haml +++ b/app/views/registration_steps/_review.html.haml @@ -3,24 +3,24 @@ = columns(medium: 12) do = save_registration_step do - if @is_attending - %table#review + .table.responsive-table#review - @step_data.each do |step, data| - unless data[:type] == :none - %tr - %th + .table-tr + .table-th =_"articles.conference_registration.step_names.#{step}" = button :edit, name: :edit_step, value: step, class: [:unstyled, :edit] - %td + .table-td - case data[:type] - when :bool =_"forms.actions.generic.#{data[:value] ? 'yes' : 'no'}" - when :list - = data[:value].map { |item| _"#{data[:key]}.#{item}" }.join(_!(", ")) + = data[:value].map { |item| _"#{data[:key]}.#{item}" }.join(_!(", ")).html_safe - when :currency = (number_to_currency data[:value].to_f, unit: '$') =_!(data[:currency].to_s).html_safe - when :date - = date(data[:value].to_date, :long) + = date(data[:value].to_date, :long).html_safe - when :enum =_("#{data[:key] || ('forms.labels.generic.' + step.to_s + '.')}#{data[:value]}") - when :html @@ -29,7 +29,7 @@ - if data[:key].present? =_"#{data[:key]}.#{data[:value]}" - else - = data[:value] + = data[:value].to_s.html_safe - else %p.centered=_'articles.conference_registration.paragraphs.registration_cancelled', :p - if @allow_cancel_attendance @@ -43,5 +43,6 @@ %h3=_'articles.workshops.headings.Workshops', :t %p=_'articles.conference_registration.paragraphs.workshops', :p .actions.centered - = link_to (_'articles.conference_registration.actions.View_Workshops'), workshops_path(@this_conference), class: :button - = link_to (_'actions.workshops.create'), create_workshop_path(@this_conference), class: [:button, :modify] \ No newline at end of file + .buttons + = link_to (_'articles.conference_registration.actions.View_Workshops'), workshops_path(@this_conference), class: :button + = link_to (_'actions.workshops.create'), create_workshop_path(@this_conference), class: [:button, :modify] \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 4bb5277..2682cec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1234,6 +1234,7 @@ en: administrators: Error updating organizations dates: Error updating dates description: Error saving your conference description + group_ride: Error saving your group ride info poster: An error occurred uploading your conference poster payment_message: An error occurred saving your the payment message suggested_amounts: An error occurred saving your payment amounts @@ -1278,6 +1279,7 @@ en: dates: Conference dates updated successfully description: Conference description updated successfully poster: Conference poster uploaded + group_ride: Group ride info saved payment_message: Your payment message has been updated suggested_amounts: Your suggested payment amounts have been updated paypal: Your paypal information has been updated @@ -1467,6 +1469,7 @@ en: administrators: Administrators and Organizations description: Description poster: Poster + group_ride: Group Ride Host_Organizations: Host Organizations External_Administrators: External Administrators description: These are the basic details about your conference that you will @@ -1476,6 +1479,7 @@ en: dates: Set your conference start and end dates description: Modify the text that is displayed on the front page poster: Upload your conference poster + group_ride: Will you be having a group ride before or after the conference? Describe it here. administrators: Set the conference host organizations and other members who have access to these administration tools Host_Organizations: Select all organizations from known organizations in @@ -1736,6 +1740,7 @@ en: admin: edit: info: Info + group_ride: Group ride description companion: Companion paragraphs: group_ride: There will be a group ride before the conference, do you plan to attend? @@ -1876,6 +1881,7 @@ en: admin: edit: info: This is the copy that is displayed on the front page of the site. + group_ride: Describe your group ride. This info may be used on the conference description, emails, or on the registration form. schedule: published: Your scheulde is currently published and viewable on the front-page. Un-publishing the schedule will remove it from the front-page and show @@ -2072,7 +2078,7 @@ en: one: You and one other are interested in this workshop other: You and %{count} others are interested in this workshop zero: You are interested in this workshop - read_more: More info + read_more: Details user_settings: headings: Your_Account: Account Settings @@ -2182,7 +2188,7 @@ en: 'yes': 'Yes' 'no': 'No' maybe: Maybe - review: Complete + review: Review back: Back upload: Upload select_file: Select a file