From dfdb44b5ae63349064b2882aa6206355714a0a1b Mon Sep 17 00:00:00 2001 From: Godwin Date: Fri, 3 Jun 2016 17:23:32 -0700 Subject: [PATCH] Fixed broken workshop links and fixed awkward styles --- app/assets/stylesheets/_application.scss | 971 +++++++++--------- app/controllers/conferences_controller.rb | 3 + app/helpers/application_helper.rb | 54 +- app/models/workshop.rb | 4 +- app/views/application/about.html.haml | 2 +- app/views/conferences/_contact_info.html.haml | 12 +- app/views/workshops/new.html.haml | 14 +- 7 files changed, 561 insertions(+), 499 deletions(-) diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index ac8930c..6efbf97 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -892,7 +892,7 @@ ul.warnings li, padding-bottom: rems(2); article { - padding: rems(2.5) 7.5%; + padding: rems(2.5) 0; &.supplementary { margin: rems(1) 7.5%; @@ -903,17 +903,28 @@ ul.warnings li, @include default-box-shadow(top, 2); } + ul { + font-size: 1.125em; + line-height: 1.5em; + } + + li { + margin-bottom: 0.5em; + } + } + + .featured-image-container { + @include _-(display, flex); + @include _(flex-wrap, wrap); + figure { - float: left; + @include _(order, 1); + width: 100%; + height: 12em; + margin: 0; background-size: cover; background-position: center; background-repeat: no-repeat; - width: 33%; - height: 12em; - margin-left: -1em; - margin-top: 2em; - margin-right: 1.5em; - margin: 2em 1.5em 1.5em -1.5em; } } } @@ -1202,373 +1213,6 @@ $header-tilt: 8deg; } } -@include breakpoint(medium) { - body { - padding-bottom: 0; - } - - h2 { - font-size: 2.25em; - } - - p { - font-size: 1.333em; - } - - form { - &.flex-form { - display: flex; - align-items: flex-start; - - .input-field { - flex: 1; - } - - button, .button { - margin-left: 1em; - height: 2.6em; - } - } - } - - .number-field, - .email-field, - .text-field { - &.big input { - font-size: 2em; - } - } - - .flex-column { - display: flex; - align-items: flex-start; - margin-top: 1em; - - p:first-child { - margin-top: 0; - } - - .stretch-item { - flex: 1; - margin-right: 1em; - } - } - - .flex-form, .flex-column { - button, .button { - width: auto; - } - } - - #main-nav { - .logo { - margin-top: 0.25em; - font-size: 4.25em; - } - - .nav { - position: static; - font-size: 1.8em; - display: block; - text-align: right; - background-color: transparent; - @include _(box-shadow, none); - - form { - background-color: transparent; - } - } - - .nav a, .nav button { - width: auto; - min-width: 3.5em; - overflow: visible; - margin-left: 0.725em; - line-height: 3em; - padding: 0 0 1em; - color: $black; - @include _(box-shadow, none); - @include _(text-shadow, none); - - @include before-and-after { - content: ''; - display: block; - position: absolute; - background-color: rgba(0, 0, 0, 0.33); - z-index: -1; - margin: 0; - border: 0; - font-size: 1em; - left: -0.51em; - right: -0.51em; - top: 0; - height: 0; - width: auto; - @include _(opacity, 1); - @include _(transition, height 150ms ease-in-out); - @include _(transform, rotate(-20deg) scaleX(0.94) scaleY(1.5) translate(-0.5em, -0.5em)); - @include _(transform-origin, 0 0); - } - - @include after { - height: 3em; - @include _(opacity, 0.1); - } - @include before { - box-shadow: 0 0 2em -0.5em rgba(#000, 0.75); - @include _(opacity, 0.33); - } - - &.current { - z-index: 2; - - @include before { - height: 3em; - @include _(opacity, 0.67); - } - } - - &:hover { - @include before { - height: 3em; - } - } - } - - .nav a { - &[class] { - background-color: transparent; - } - - &.policy { - @include before-and-after { - background-color: $colour-5; - } - } - - &.about { - @include before-and-after { - background-color: $colour-3; - } - } - } - - .nav a.register, .nav button { - @include before-and-after { - background-color: $colour-2; - } - &:focus, &:active { - @include _(transform, none); - } - } - - .user-nav-bar { - top: 0; - left: 0; - right: auto; - width: auto; - float: none; - text-align: left; - background-color: #EEE; - @include _(border-radius, 0 0 0.5em 0); - font-size: 0.8em; - padding: 0 1em 0 0.5em; - @include default-box-shadow(top, 2); - - a { - display: inline-block; - padding: 0.25em 0; - - &:hover { - color: lighten($black, 25%); - } - } - - .my-account { - max-width: none; - overflow: visible; - - @include after { - content: '|'; - display: inline; - @include _(opacity, 0.25); - position: static; - margin: 0 0.5em; - } - } - } - } - - #banner { - margin: 3em auto; - - figure { - min-height: 40em; - margin: rems(-20) auto rems(2); - } - - .title { - font-size: 1.9em; - margin: 3em 0 1em; - } - - img { - @include _(box-shadow, 0 0 2em -0.5em rgba(0, 0, 0, 0.5)); - } - } - - #registration-steps { - ul { - display: inline-block; - text-align: left; - margin-top: -4em; - } - - li { - display: inline-block; - float: left; - - @include after { - content: ''; - top: 1.125em; - left: auto; - right: -0.25em; - @include _(transform, rotate(45deg)); - } - - &.enabled:hover, - &.enabled:hover ~ li { - @include after { - @include _(transform, rotate(-135deg)); - background-color: transparent; - } - } - } - } - - ul.warnings { - li { - margin: 1em 4em; - } - } - - .warning-info { - margin-left: 1em; - } - - #main { - clear: right; - - .columns { - form { - margin-top: 2em; - } - } - } - - #header-title { - min-height: rems(35); - font-size: 1em; - - &.short { - font-size: 2em; - min-height: rems(15); - - h1 { - position: absolute; - bottom: 0; - text-align: left; - font-size: 2em; - } - - @include before { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: $zindex-base + 2; - @include _(box-shadow, inset 0 -13rem 3em -4rem rgba(0, 0, 0, 0.8)); - @include _(transition, opacity 250ms ease-in-out); - } - } - - &.no-image { - min-height: 0; - font-size: 1em; - } - - svg { - display: block; - } - - svg rect { - @include _(animation, banner-load 1s ease-in-out); - } - - .title { - text-align: left; - width: 110%; - background-color: rgba($white, 0.5); - @include _(transform, rotate(-$header-tilt) translate3d(0, 0, 0)); - @include _(transform-origin, 0 100%); - } - - .details { - text-align: right; - color: #000; - } - - .background { - display: block; - } - - .primary { - padding: 12% 0 0 0.25em; - } - } - - #footer { - footer { - font-size: 1em; - } - - .github { - flex: none; - flex-basis: auto; - bottom: 0.5em; - float: left; - margin-right: 1em; - margin-left: 1em; - } - .facebook { - margin: 0; - } - ul.locales { - flex: none; - flex-basis: auto; - flex-grow: 1; - } - } - - .check-box-field, - .radio-button-field { - display: flex; - - label { - flex: 1; - border: 0.1em solid; - border-left: 0; - text-align: left; - } - - input:first-child + label { - border: 0.1em solid; - } - } -} - @include keyframes(fade-out) { to { @include _(opacity, 0.25); @@ -1590,82 +1234,6 @@ body { } } -@include breakpoint(large) { - #main-nav { - .nav { - font-size: 1.9em; - margin-top: 0; - } - - .user-nav-bar { - @include _(border-radius, 0 0 0.5em 0.5em); - padding: 0 1em; - font-size: 1em; - } - } - - #banner { - body.fixed-banner & { - position: fixed; - top: 0; - right: 0; - left: $sidebar-width; - z-index: $zindex-base + 2; - } - - figure { - width: 90%; - } - } - - #main { - padding-left: $sidebar-width; - min-height: 100vh; - } - - #header-title { - &.no-image { - min-height: 0; - } - &.short { - min-height: rems(25); - } - &.no-image, - &.short { - h1 { - text-align: left; - margin: 0.67em 0; - } - } - } - - #main-nav .logo { - font-size: 5em; - } - - a.logo { - display: block; - float: none; - padding: 0.2em; - } - - .actions { - margin: 4em 2em 0 0; - } - - #footer { - overflow: visible; - padding: 0; - width: 100%; - height: 3em; - - footer { - max-width: $row-width; - margin: 0 auto; - } - } -} - @mixin header-colour($page, $colour) { body.#{$page} { #header-title { @@ -1771,7 +1339,6 @@ body { } .info { - //display: block; left: 0; right: 0; top: 50%; @@ -1818,7 +1385,7 @@ body { p { padding: 1em; max-height: 50vh; - overflow-y: auto; + overflow-y: auto; } form { @@ -1863,7 +1430,7 @@ body { padding: 0.25em 1em; margin: 0 0 3em; border: 0.1em solid #DDD; - @include _(border-radius, 0.25em); + @include _(border-radius, 0.25em); @include default-box-shadow(top, 2); } @@ -2040,13 +1607,6 @@ body.policy .policy-agreement ul { } } -.froala-wrapper + div { - width: 0; - height: 0; - overflow: hidden; - opacity: 0; -} - .translated-content.block { display: inherit; } @@ -2179,7 +1739,7 @@ html[data-lingua-franca-example="html"] { .workshop-list { list-style: none; - padding: 0 2em; + padding: 0; .workshop-description { font-size: 0.8em; @@ -2277,14 +1837,30 @@ html[data-lingua-franca-example="html"] { .original-text { margin: 0 0 1em 1em; - h4 { + + .value { + border: 0.1em solid #DDD; + padding: 1em; + margin: 1em 0 3em 0; + background-color: #F8F8F8; + @include _(border-radius, 0.25em); + } + + h4, h5, h6 { margin: 0; } - .value { - margin-left: 1em; + + h5 { + font-size: 1em; } + + h6 { + font-size: 0.9em; + } + p { - font-size: 1.1em; + margin: 0.5em 0; + font-size: 0.9em; } } @@ -2560,5 +2136,466 @@ html[data-lingua-franca-example="html"] { font-size: 1.5em; padding: 0.25em; @include default-box-shadow(top, 1.5, false); - } + } +} + +@include breakpoint(medium) { + body { + padding-bottom: 0; + } + + h2 { + font-size: 2.25em; + } + + p { + font-size: 1.333em; + } + + form { + &.flex-form { + display: flex; + align-items: flex-start; + + .input-field { + flex: 1; + } + + button, .button { + margin-left: 1em; + height: 2.6em; + } + } + } + + .number-field, + .email-field, + .text-field { + &.big input { + font-size: 2em; + } + } + + .flex-column { + display: flex; + align-items: flex-start; + margin-top: 1em; + + p:first-child { + margin-top: 0; + } + + .stretch-item { + flex: 1; + margin-right: 1em; + } + } + + .flex-form, .flex-column { + button, .button { + width: auto; + } + } + + #main-nav { + .logo { + margin-top: 0.25em; + font-size: 4.25em; + } + + .nav { + position: static; + font-size: 1.8em; + display: block; + text-align: right; + background-color: transparent; + @include _(box-shadow, none); + + form { + background-color: transparent; + } + } + + .nav a, .nav button { + width: auto; + min-width: 3.5em; + overflow: visible; + margin-left: 0.725em; + line-height: 3em; + padding: 0 0 1em; + color: $black; + @include _(box-shadow, none); + @include _(text-shadow, none); + + @include before-and-after { + content: ''; + display: block; + position: absolute; + background-color: rgba(0, 0, 0, 0.33); + z-index: -1; + margin: 0; + border: 0; + font-size: 1em; + left: -0.51em; + right: -0.51em; + top: 0; + height: 0; + width: auto; + @include _(opacity, 1); + @include _(transition, height 150ms ease-in-out); + @include _(transform, rotate(-20deg) scaleX(0.94) scaleY(1.5) translate(-0.5em, -0.5em)); + @include _(transform-origin, 0 0); + } + + @include after { + height: 3em; + @include _(opacity, 0.1); + } + @include before { + box-shadow: 0 0 2em -0.5em rgba(#000, 0.75); + @include _(opacity, 0.33); + } + + &.current { + z-index: 2; + + @include before { + height: 3em; + @include _(opacity, 0.67); + } + } + + &:hover { + @include before { + height: 3em; + } + } + } + + .nav a { + &[class] { + background-color: transparent; + } + + &.policy { + @include before-and-after { + background-color: $colour-5; + } + } + + &.about { + @include before-and-after { + background-color: $colour-3; + } + } + } + + .nav a.register, .nav button { + @include before-and-after { + background-color: $colour-2; + } + &:focus, &:active { + @include _(transform, none); + } + } + + .user-nav-bar { + top: 0; + left: 0; + right: auto; + width: auto; + float: none; + text-align: left; + background-color: #EEE; + @include _(border-radius, 0 0 0.5em 0); + font-size: 0.8em; + padding: 0 1em 0 0.5em; + @include default-box-shadow(top, 2); + + a { + display: inline-block; + padding: 0.25em 0; + + &:hover { + color: lighten($black, 25%); + } + } + + .my-account { + max-width: none; + overflow: visible; + + @include after { + content: '|'; + display: inline; + @include _(opacity, 0.25); + position: static; + margin: 0 0.5em; + } + } + } + } + + #banner { + margin: 3em auto; + + figure { + min-height: 40em; + margin: rems(-20) auto rems(2); + } + + .title { + font-size: 1.9em; + margin: 3em 0 1em; + } + + img { + @include _(box-shadow, 0 0 2em -0.5em rgba(0, 0, 0, 0.5)); + } + } + + #registration-steps { + ul { + display: inline-block; + text-align: left; + margin-top: -4em; + } + + li { + display: inline-block; + float: left; + + @include after { + content: ''; + top: 1.125em; + left: auto; + right: -0.25em; + @include _(transform, rotate(45deg)); + } + + &.enabled:hover, + &.enabled:hover ~ li { + @include after { + @include _(transform, rotate(-135deg)); + background-color: transparent; + } + } + } + } + + ul.warnings { + li { + margin: 1em 4em; + } + } + + .warning-info { + margin-left: 1em; + } + + .workshop-list { + padding: 0 2em; + } + + #main { + clear: right; + + article { + padding: rems(2.5) 7.5%; + } + + .columns { + form { + margin-top: 2em; + } + } + + .featured-image-container { + display: block; + + figure { + float: left; + width: 33%; + margin: 0 1.5em 1.5em -1.5em; + } + } + } + + #header-title { + min-height: rems(35); + font-size: 1em; + + &.short { + font-size: 2em; + min-height: rems(15); + + h1 { + position: absolute; + bottom: 0; + text-align: left; + font-size: 2em; + } + + @include before { + content: ''; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: $zindex-base + 2; + @include _(box-shadow, inset 0 -13rem 3em -4rem rgba(0, 0, 0, 0.8)); + @include _(transition, opacity 250ms ease-in-out); + } + } + + &.no-image { + min-height: 0; + font-size: 1em; + } + + svg { + display: block; + } + + svg rect { + @include _(animation, banner-load 1s ease-in-out); + } + + .title { + text-align: left; + width: 110%; + background-color: rgba($white, 0.5); + @include _(transform, rotate(-$header-tilt) translate3d(0, 0, 0)); + @include _(transform-origin, 0 100%); + } + + .details { + text-align: right; + color: #000; + } + + .background { + display: block; + } + + .primary { + padding: 12% 0 0 0.25em; + } + } + + #footer { + footer { + font-size: 1em; + } + + .github { + flex: none; + flex-basis: auto; + bottom: 0.5em; + float: left; + margin-right: 1em; + margin-left: 1em; + } + .facebook { + margin: 0; + } + ul.locales { + flex: none; + flex-basis: auto; + flex-grow: 1; + } + } + + .check-box-field, + .radio-button-field { + display: flex; + + label { + flex: 1; + border: 0.1em solid; + border-left: 0; + text-align: left; + } + + input:first-child + label { + border: 0.1em solid; + } + } +} + +@include breakpoint(large) { + #main-nav { + .nav { + font-size: 1.9em; + margin-top: 0; + } + + .user-nav-bar { + @include _(border-radius, 0 0 0.5em 0.5em); + padding: 0 1em; + font-size: 1em; + } + } + + #banner { + body.fixed-banner & { + position: fixed; + top: 0; + right: 0; + left: $sidebar-width; + z-index: $zindex-base + 2; + } + + figure { + width: 90%; + } + } + + #main { + padding-left: $sidebar-width; + min-height: 100vh; + } + + #header-title { + &.no-image { + min-height: 0; + } + &.short { + min-height: rems(25); + } + &.no-image, + &.short { + h1 { + text-align: left; + margin: 0.67em 0; + } + } + } + + #main-nav .logo { + font-size: 5em; + } + + a.logo { + display: block; + float: none; + padding: 0.2em; + } + + .actions { + margin: 4em 2em 0 0; + } + + #footer { + overflow: visible; + padding: 0; + width: 100%; + height: 3em; + + footer { + max-width: $row-width; + margin: 0 auto; + } + } } diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 7a05555..a1f40e2 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -1037,6 +1037,9 @@ class ConferencesController < ApplicationController workshop.notes = params[:notes] workshop.needs_facilitators = params[:needs_facilitators].present? workshop.save + + # Rouge nil facilitators have been know to be created, just destroy them here now + WorkshopFacilitator.where(:user_id => nil).destroy_all else return do_403 end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 027ee51..dff73af 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -680,14 +680,14 @@ module ApplicationHelper description_id = nil html = label_tag(name, nil, id: label_id) - if options[:warning].present? - description_id = "#{name.to_s}-label" unless options[:help].present? - html += content_tag(:div, _(options[:warning], :s, 2), id: description_id, class: 'warning-info') + if options[:help].present? + description_id ||= "#{name.to_s}-desc" + html += content_tag(:div, _(options[:help], :s, 2), id: description_id, class: 'input-field-help') end - if options[:help].present? - description_id = "#{name.to_s}-label" - html += content_tag(:div, _(options[:help], :s, 2), id: description_id, class: 'input-field-help') + if options[:warning].present? + description_id ||= "#{name.to_s}-desc" + html += content_tag(:div, _(options[:warning], :s, 2), id: description_id, class: 'warning-info') end html += content_tag(:div, value.present? ? value.html_safe : '', @@ -698,10 +698,50 @@ module ApplicationHelper aria: { labeledby: label_id, describedby: description_id } ) - return content_tag(:div, html, class: ['text-area-field', 'input-field']).html_safe + html = content_tag(:div, html, class: ['text-area-field', 'input-field']).html_safe + html += _original_content(options[:original_value], options[:original_lang]) if options[:original_value].present? + + return html.html_safe + end + + def textfield(name, value, options = {}) + html = '' + description_id = nil + + if options[:heading].present? + description_id ||= "#{name.to_s}-desc" + html += content_tag(:h3, _(options[:heading]), id: description_id) + end + + html += show_errors name + html += label_tag name + html += text_field_tag(name, value, + required: options[:required], + lang: options[:lang], + aria: { describedby: description_id } + ) + + html = content_tag(:div, html.html_safe, + class: [ + 'text-field', + 'input-field', + options[:big] ? 'big' : nil, + (@errors || {})[name].present? ? 'has-error' : nil + ]) + + html += _original_content(options[:original_value], options[:original_lang]) if options[:original_value].present? + + return html.html_safe end private + def _original_content(value, lang) + content_tag(:div, ( + content_tag(:h4, _('translate.content.Translation_of')) + + content_tag(:div, value, class: 'value', lang: lang) + ).html_safe, class: 'original-text') + end + def _form_field(type, name, value, options) if type == 'check_box' self.send(type + '_tag', name, "1", value, options) diff --git a/app/models/workshop.rb b/app/models/workshop.rb index c8ef90c..375bdfd 100644 --- a/app/models/workshop.rb +++ b/app/models/workshop.rb @@ -31,7 +31,7 @@ class Workshop < ActiveRecord::Base def active_facilitators users = [] workshop_facilitators.each do |u| - users << User.find(u.user_id) unless u.role.to_sym == :requested + users << User.find(u.user_id) unless u.role.to_sym == :requested || u.user.nil? end return users end @@ -78,7 +78,7 @@ class Workshop < ActiveRecord::Base return 0 unless id collaborators = [] workshop_facilitators.each do |f| - collaborators << f.user_id unless f.role.to_sym == :requested + collaborators << f.user_id unless f.role.to_sym == :requested || f.user_id.nil? end return 10 unless collaborators.present? interested = WorkshopInterest.where("workshop_id=#{id} AND user_id NOT IN (#{collaborators.join ','})") || [] diff --git a/app/views/application/about.html.haml b/app/views/application/about.html.haml index 007dd77..ddb059a 100644 --- a/app/views/application/about.html.haml +++ b/app/views/application/about.html.haml @@ -14,7 +14,7 @@ = columns(medium: 12) do %h3=_'articles.about_bikebike.headings.Who_is_Invited', :t %p=_'articles.about_bikebike.paragraphs.Who_is_Invited', :p - = columns(medium: 12) do + = columns(medium: 12, class: 'featured-image-container') do %h3=_'articles.about_bikebike.headings.Types_of_Workshops', :t %figure{style: "background-image: url(#{image_path('columbus_people.jpg')})"} %p=_'articles.about_bikebike.paragraphs.Types_of_Workshops', :p diff --git a/app/views/conferences/_contact_info.html.haml b/app/views/conferences/_contact_info.html.haml index ff8e5c9..789d7fc 100644 --- a/app/views/conferences/_contact_info.html.haml +++ b/app/views/conferences/_contact_info.html.haml @@ -3,16 +3,8 @@ %p=_'articles.conference_registration.paragraphs.Contact_Info', :s, 2 = columns(medium: 12) do = form_tag register_path(@this_conference.slug) do - %h3=_'articles.conference_registration.headings.name','What is your name?' - .text-field.input-field{class: @errors[:name].present? ? 'has-error' : nil} - = show_errors :name - = label_tag :name - = text_field_tag :name, @name, required: true - %h3=_'articles.conference_registration.headings.location','Where are you coming from?' - .text-field.input-field{class: @errors[:location].present? ? 'has-error' : nil} - = show_errors :location - = label_tag :location - = text_field_tag :location, @registration.city || location(lookup_ip_location), required: true + = textfield :name, @name, required: true, heading: 'articles.conference_registration.headings.name' + = textfield :location, (@registration.city || location(lookup_ip_location)), required: true, heading: 'articles.conference_registration.headings.location' %h3=_'articles.conference_registration.headings.languages','Which languages do you speak?' - puts @errors.to_json.to_s .check-box-field.input-field{class: @errors[:languages].present? ? 'has-error' : nil} diff --git a/app/views/workshops/new.html.haml b/app/views/workshops/new.html.haml index f1b9bc7..7ed003b 100644 --- a/app/views/workshops/new.html.haml +++ b/app/views/workshops/new.html.haml @@ -19,18 +19,8 @@ %h2=_@page_title, :t - else %h2=_@page_title, :t - .text-field.input-field.big - = label_tag :title - = text_field_tag :title, @title, required: true, lang: @translation - - if @is_translating - .original-text - %h4=_'translate.content.Translation_of' - .value=@workshop.title! - = textarea :info, @info, help: 'articles.workshops.paragraphs.info', lang: @translation - - if @is_translating - .original-text - %h4=_'translate.content.Translation_of' - .value=(@workshop.info! || '').html_safe + = textfield :title, @title, required: true, lang: @translation, big: true, original_value: @is_translating ? @workshop.title! : nil, original_lang: @workshop.locale + = textarea :info, @info, help: 'articles.workshops.paragraphs.info', lang: @translation, original_value: @is_translating ? richtext(@workshop.info!, 4).html_safe : nil, original_lang: @workshop.locale - if !@is_translating && (@workshop.id.blank? || @can_edit) = columns(medium: 6) do %h3=_'articles.workshops.headings.languages','Workshop Language'