From 4f5b530850abb15d36948259370f926a8defa574 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 24 Oct 2017 19:58:03 -0700 Subject: [PATCH 01/15] Remove overlap in breakpoints --- app/assets/stylesheets/breakpoints.css.scss | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/breakpoints.css.scss b/app/assets/stylesheets/breakpoints.css.scss index b2025e39..d3dbc799 100644 --- a/app/assets/stylesheets/breakpoints.css.scss +++ b/app/assets/stylesheets/breakpoints.css.scss @@ -2,20 +2,20 @@ @if $class == xs { @media (max-width: 767px) { @content; } } - + @else if $class == sm { - @media (min-width: 750px) { @content; } + @media (min-width: 768px) and (max-width: 991px) { @content; } } - + @else if $class == md { - @media (min-width: 992px) { @content; } + @media (min-width: 992px) and (max-width: 1199px) { @content; } } - + @else if $class == lg { @media (min-width: 1200px) { @content; } } - + @else { @warn "Breakpoint mixin supports: xs, sm, md, lg"; } -} \ No newline at end of file +} From a31f8f4db032e35f8a8356e476a2cca7e98e6e41 Mon Sep 17 00:00:00 2001 From: James Mason Date: Fri, 17 Nov 2017 19:34:26 -0800 Subject: [PATCH 02/15] Fewer queries for for Conference#show Reduces SQL wait times by >90% on splash pages. --- app/controllers/conferences_controller.rb | 41 +++++++++++--- app/helpers/application_helper.rb | 14 +---- app/models/conference.rb | 12 ++++- app/views/conferences/_booths.html.haml | 6 +-- .../conferences/_call_for_paper.html.haml | 34 ++++++------ .../conferences/_call_for_tracks.html.haml | 20 ++++--- app/views/conferences/_lodging.html.haml | 14 ++--- .../_schedule_splashpage.html.haml | 54 +++++++++---------- app/views/conferences/_sponsors.html.haml | 2 +- app/views/conferences/show.html.haml | 18 +++---- app/views/layouts/_user_menu.html.haml | 6 +-- 11 files changed, 122 insertions(+), 99 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index f141529d..e5626aa1 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -9,19 +9,44 @@ class ConferencesController < ApplicationController end def show - @conference = if params[:id] - Conference.find_by_short_title(params[:id]) - else - load_conference_by_domain - end + @conference = Conference.unscoped.eager_load( + :organization, + :splashpage, + :venue, + :registration_period, + :tickets, + :confirmed_tracks, + :call_for_events, + :event_types, + :program, + :call_for_tracks, + :lodgings, + :call_for_booths, + :confirmed_booths, + :sponsors, + :call_for_sponsors, + :contact, + highlighted_events: [:speakers], + sponsorship_levels: [:sponsors] + ).order( + 'sponsorship_levels.position ASC', + 'sponsors.name', + 'tracks.name', + 'booths.title', + 'lodgings.name', + 'tickets.price_cents' + ).find_by(conference_finder_conditions) authorize! :show, @conference - @program = @conference.program end private - def load_conference_by_domain - Conference.find_by(custom_domain: request.domain) + def conference_finder_conditions + if params[:id] + { short_title: params[:id] } + else + { custom_domain: request.domain } + end end def respond_to_options diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b5e2892e..048e07c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -56,17 +56,7 @@ module ApplicationHelper end def tracks(conference) - all = conference.program.tracks.confirmed.cfp_active.pluck(:name) - first = all[0...-1] - last = all[-1] - ts = '' - if all.length > 1 - ts << first.join(', ') - ts << " and #{last}" - else - ts = all.join - end - return ts + conference.confirmed_tracks.collect(&:name).to_sentence end def difficulty_levels(conference) @@ -152,7 +142,7 @@ module ApplicationHelper end def event_types(conference) - conference.program.event_types.map { |et| et.title.pluralize }.to_sentence + conference.event_types.map { |et| et.title.pluralize }.to_sentence end def sign_in_path diff --git a/app/models/conference.rb b/app/models/conference.rb index c56161f2..8e5bd1d6 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -33,6 +33,7 @@ class Conference < ActiveRecord::Base end has_many :resources, dependent: :destroy has_many :booths, dependent: :destroy + has_many :confirmed_booths, -> { where(state: 'confirmed') }, class_name: 'Booth' has_many :lodgings, dependent: :destroy has_many :registrations, dependent: :destroy @@ -45,7 +46,16 @@ class Conference < ActiveRecord::Base has_many :campaigns, dependent: :destroy has_many :commercials, as: :commercialable, dependent: :destroy has_many :subscriptions, dependent: :destroy - + has_one :call_for_sponsors, -> { where(cfp_type: 'sponsors') }, through: :program, source: :cfps + has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps + has_one :call_for_booths, -> { where(cfp_type: 'booths') }, through: :program, source: :cfps + has_one :call_for_tracks, -> { where(cfp_type: 'tracks') }, through: :program, source: :cfps + has_many :confirmed_tracks, -> { where(state: 'confirmed') }, through: :program, source: :tracks + has_many :highlighted_events, + -> { where(state: :confirmed, is_highlight: true) }, + through: :program, + source: :events + has_many :event_types, through: :program accepts_nested_attributes_for :venue accepts_nested_attributes_for :tickets, allow_destroy: true accepts_nested_attributes_for :sponsorship_levels, allow_destroy: true diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index b40af9b8..39dc9253 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -6,7 +6,7 @@ .row .col-md-12.text-center %h2 Booths - - @conference.booths.confirmed.each_slice(3).with_index do |slice, index_for_row| + - @conference.confirmed_booths.each_slice(3).with_index do |slice, index_for_row| .row.row-centered - slice.each.with_index do |booth, index_for_column| .col-md-4.col-sm-4.col-xs-10.col-centered.col-top @@ -18,7 +18,7 @@ %h3.text-center = booth.title %p.text-center.text-muted - = link_to "#show_descrition_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do + = link_to "#show_description_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do learn more - .collapse{ id: "show_descrition_#{index_for_row}_#{index_for_column}" } + .collapse{ id: "show_description_#{index_for_row}_#{index_for_column}" } = markdown(booth.description) diff --git a/app/views/conferences/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml index 289c3d9e..2dbd2ecd 100644 --- a/app/views/conferences/_call_for_paper.html.haml +++ b/app/views/conferences/_call_for_paper.html.haml @@ -12,32 +12,34 @@ .row .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 %p - - if @conference.program.event_types.any? + - if @conference.event_types.any? You can submit proposals for %span.notranslate = "#{event_types(@conference)}." - - if @conference.program.tracks.any? + - if @conference.confirmed_tracks.any? Proposals should fit in one of the %span.notranslate - = "#{pluralize(@conference.program.tracks.count, 'track')}:" + = "#{pluralize(@conference.confirmed_tracks.length, 'track')}:" = "#{tracks(@conference)}." - The submission period has begun - %em.notranslate - = @conference.program.cfp.start_date.strftime('%A, %B %-d. %Y') - and closes - %em.notranslate - = @conference.program.cfp.end_date.strftime('%A, %B %-d. %Y.') - - if @conference.program.cfp_open? - That means you have only - %b.notranslate= pluralize(@conference.program.cfp.remaining_days, 'day') - left! + - if @conference.call_for_events.try(:open?) + The submission period is open + %em.notranslate + = "#{date_string(@conference.call_for_events.start_date, + @conference.call_for_events.end_date)}." + %b + You have + = pluralize(@conference.call_for_events.remaining_days, 'day') + left! Remember %span.notranslate - = @conference.short_title - will only be as good as the sessions you present. Submit early, submit often! + = @conference.title + will only be as good as the sessions you present. + Submit early, submit often! - else The submission period is closed. .row .col-md-12.text-center %p.cta-button - = link_to "Submit your paper now", conference_program_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' + = link_to "Submit your paper now", + conference_program_proposals_path(@conference.short_title), + class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.html.haml index 1abeb956..c457880d 100644 --- a/app/views/conferences/_call_for_tracks.html.haml +++ b/app/views/conferences/_call_for_tracks.html.haml @@ -12,19 +12,17 @@ .row .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 %p - The submission period for track requests has begun + The submission period for track requests is open %em.notranslate - = @conference.program.cfps.for_tracks.start_date.strftime('%A, %B %-d. %Y') - and closes - %em.notranslate - = @conference.program.cfps.for_tracks.end_date.strftime('%A, %B %-d. %Y.') - - if @conference.program.cfps.for_tracks.try(:open?) - That means you have only - %b.notranslate= pluralize(@conference.program.cfps.for_tracks.remaining_days, 'day') + = "#{date_string(@conference.call_for_tracks.start_date, + @conference.call_for_tracks.end_date)}." + %b + You have + = pluralize(@conference.call_for_tracks.remaining_days, 'day') left! - - else - The submission period for track requests is closed. .row .col-md-12.text-center %p.cta-button - = link_to "Submit your request for track", conference_program_tracks_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' + = link_to("Submit your request for track", + conference_program_tracks_path(@conference.short_title), + class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/_lodging.html.haml b/app/views/conferences/_lodging.html.haml index 561e2421..a9754190 100644 --- a/app/views/conferences/_lodging.html.haml +++ b/app/views/conferences/_lodging.html.haml @@ -13,9 +13,9 @@ %p.lead We recommend these affordable lodging accommodations for your visit. - .row.row-centered{ style:"display: flex; flex-wrap: wrap" } + .row.row-centered - @conference.lodgings.each do |lodging| - .col-md-4.col-sm-4.col-centered.col-top{ style:"display:flex;" } + .col-md-4.col-sm-4.col-centered.col-top .thumbnail - if lodging.picture? -if lodging.website_link.present? @@ -30,8 +30,8 @@ %i.fa.fa-home.fa-5x - else %i.fa.fa-home.fa-5x - .caption - %h3.text-center - = lodging.name - -if lodging.description.present? - = markdown(lodging.description) + .caption + %h3.text-center + = lodging.name + -if lodging.description.present? + = markdown(lodging.description) diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml index 790582cb..10584bcb 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -1,3 +1,8 @@ += content_for :splash_nav do + %li + =link_to('#program', class: 'smoothscroll') do + Program + .container .row .col-md-12 @@ -5,43 +10,41 @@ Program %p.lead.text-center %span.notranslate - = @conference.short_title + = @conference.title has the most awesome program ever! - - if @conference.splashpage and @conference.program.tracks.any? and @conference.splashpage.include_tracks + - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? See rock-star speakers cover the topics of - - if @conference.splashpage and @conference.splashpage.include_tracks - - @conference.program.tracks.confirmed.each_slice(3) do |slice| - .row.row-centered - - slice.each do |track| - .col-md-4.col-sm-4.col-centered.col-top.track - %h4.text-center - = track.name - = markdown(track.description) - - if track.start_date - %br - From: #{track.start_date.strftime('%A, %B %-d. %Y')} - - if track.end_date - %br - To: #{track.end_date.strftime('%A, %B %-d. %Y')} - - if track.room - %br - In: #{track.room.name} + - @conference.confirmed_tracks.each_slice(3) do |slice| + .row.row-centered + - slice.each do |track| + .col-md-4.col-sm-4.col-centered.col-top.track + %h4.text-center + = track.name + = markdown(track.description) + - if track.start_date + %br + From: #{track.start_date.strftime('%A, %B %-d. %Y')} + - if track.end_date + %br + To: #{track.end_date.strftime('%A, %B %-d. %Y')} + - if track.room + %br + In: #{track.room.name} - - if @conference.program and @conference.program.schedule_public + - if @conference.program.try(:schedule_public?) .row .col-md-12 %p.cta-button.text-center = link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do Full Schedule - %h3.text-center Don't miss out! %br - - if @conference.program.events.highlights.any? + - if @conference.highlighted_events.any? .row .col-md-12 - - @conference.program.events.highlights.each_slice(2) do |slice| + - @conference.highlighted_events.each_slice(2) do |slice| .row.row-centered - slice.each do |event| .col-md-6.col-centered.col-top.highlights @@ -50,8 +53,3 @@ %h5.text-center = markdown truncate(event.abstract, length: 500, separator: ' ') = link_to "Read More", conference_program_proposal_path(@conference.short_title, event) - - = content_for :splash_nav do - %li - =link_to('#program', class: 'smoothscroll') do - Program diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml index aa7921b5..94da9940 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -31,7 +31,7 @@ = sponsor.description .modal-footer = link_to nil, "#{sponsor.website_url}", target: '_blank' - -if @conference.contact and !@conference.contact.sponsor_email.blank? + - if @conference.call_for_sponsors.try(:open?) .row .col-md-12 %p.text-muted.text-center diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index dd6b2d62..8fa4bf5f 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -37,7 +37,7 @@ %h3.text-center = markdown(@conference.description) - - if @conference.registration_open? and @conference.splashpage.include_registrations + - if @conference.splashpage.include_registrations && @conference.registration_open? %section#registration = render 'registration' @@ -45,35 +45,35 @@ %section#program = render 'schedule_splashpage' - - if @conference.program.cfp_open? and @conference.splashpage.include_cfp + - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) %section#callforpapers = render 'call_for_paper' - - if @conference.program.cfps.for_tracks.try(:open?) && @conference.splashpage.include_cfp + - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) %section#callfortracks = render 'call_for_tracks' - - if @conference.venue and @conference.splashpage.include_venue + - if @conference.splashpage.include_venue && @conference.venue %section#venue = render 'venue' - - if @conference.lodgings.any? and @conference.splashpage.include_lodgings + - if @conference.splashpage.include_lodgings && @conference.lodgings.any? %section#lodging = render 'lodging' - - if @conference.tickets.any? and @conference.splashpage.include_tickets and @conference.pending? + - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? %section#tickets = render 'tickets' - - if @conference.booths.confirmed.any? and @conference.splashpage.include_booths + - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? %section#booths = render 'booths' - - if @conference.sponsors.any? and @conference.splashpage.include_sponsors + - if @conference.splashpage.include_sponsors && @conference.sponsors.any? %section#sponsors = render 'sponsors' - - if @conference.contact.has_social_media? and @conference.splashpage.include_social_media + - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? %section#social-media = render 'social_media' diff --git a/app/views/layouts/_user_menu.html.haml b/app/views/layouts/_user_menu.html.haml index 10d4c386..dc645a11 100644 --- a/app/views/layouts/_user_menu.html.haml +++ b/app/views/layouts/_user_menu.html.haml @@ -7,7 +7,7 @@ = link_to(edit_user_path(current_user.id)) do %span.fa.fa-user Edit Profile --if @conference and @conference.program +-if @conference && @conference.program %li = link_to(conference_program_proposals_path(@conference.short_title)) do %span.fa.fa-comment @@ -16,7 +16,7 @@ = link_to(conference_program_tracks_path(@conference.short_title)) do %span.fa.fa-road My Tracks --if @conference && @conference.program && (@conference.program.cfps.for_booths.try(:open?) || current_user.booths.where(conference_id: @conference.id).count > 0) +-if @conference && (@conference.call_for_booths.try(:open?) || current_user.booths.where(conference_id: @conference.id).count > 0) %li = link_to (conference_booths_path(@conference.short_title)) do %span.fa.fa-shopping-bag @@ -41,7 +41,7 @@ =link_to(new_admin_conference_path) do %span.fa.fa-plus New Conference - -if @conference and @conference.id and can? :show, @conference + -if @conference && @conference.id && can?(:show, @conference) %li = link_to(admin_conference_path(@conference.short_title)) do %span.fa.fa-cog From fd64be878c61d5cc0b6f6a80f9525fad85acf43f Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 20 Nov 2017 19:46:12 -0800 Subject: [PATCH 03/15] Logic for showing splashpage is not the views' concern That's the responsibility of ConferenceController & cancancan, and they handle it fine. --- app/views/conferences/show.html.haml | 109 +++++++++++++-------------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 8fa4bf5f..c6a7fd54 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,74 +11,73 @@ = @conference.title #splash - - if @conference.splashpage - #banner + #banner + .container + .row + .col-md-8.col-md-offset-2#header + .row + .col-md-4 + = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? + .col-md-8 + %h1 + = @conference.title + %p.lead + - if @conference.venue + = "#{@conference.venue.city} / #{@conference.venue.country_name}" + - if @conference.start_date && @conference.end_date + %br + = date_string(@conference.start_date, @conference.end_date) + + - unless @conference.description.blank? + %section#about .container .row - .col-md-8.col-md-offset-2#header - .row - .col-md-4 - = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? - .col-md-8 - %h1 - = @conference.title - %p.lead - - if @conference.venue - = "#{@conference.venue.city} / #{@conference.venue.country_name}" - - if @conference.start_date && @conference.end_date - %br - = date_string(@conference.start_date, @conference.end_date) + .col-md-8.col-md-offset-2 + %h3.text-center + = markdown(@conference.description) - - unless @conference.description.blank? - %section#about - .container - .row - .col-md-8.col-md-offset-2 - %h3.text-center - = markdown(@conference.description) + - if @conference.splashpage.include_registrations && @conference.registration_open? + %section#registration + = render 'registration' - - if @conference.splashpage.include_registrations && @conference.registration_open? - %section#registration - = render 'registration' + - if @conference.splashpage.include_program + %section#program + = render 'schedule_splashpage' - - if @conference.splashpage.include_program - %section#program - = render 'schedule_splashpage' + - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) + %section#callforpapers + = render 'call_for_paper' - - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) - %section#callforpapers - = render 'call_for_paper' + - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) + %section#callfortracks + = render 'call_for_tracks' - - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) - %section#callfortracks - = render 'call_for_tracks' + - if @conference.splashpage.include_venue && @conference.venue + %section#venue + = render 'venue' - - if @conference.splashpage.include_venue && @conference.venue - %section#venue - = render 'venue' + - if @conference.splashpage.include_lodgings && @conference.lodgings.any? + %section#lodging + = render 'lodging' - - if @conference.splashpage.include_lodgings && @conference.lodgings.any? - %section#lodging - = render 'lodging' + - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? + %section#tickets + = render 'tickets' - - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? - %section#tickets - = render 'tickets' + - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? + %section#booths + = render 'booths' - - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? - %section#booths - = render 'booths' + - if @conference.splashpage.include_sponsors && @conference.sponsors.any? + %section#sponsors + = render 'sponsors' - - if @conference.splashpage.include_sponsors && @conference.sponsors.any? - %section#sponsors - = render 'sponsors' + - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? + %section#social-media + = render 'social_media' - - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? - %section#social-media - = render 'social_media' - - // grmbl - = render 'footer' + // grmbl + = render 'footer' - content_for :script_head do :javascript From b074cbfc954a2b4fd3351fa1418d8e0400f6dc12 Mon Sep 17 00:00:00 2001 From: James Mason Date: Fri, 17 Nov 2017 18:32:08 -0800 Subject: [PATCH 04/15] Configure cache stores rely on RAM caching for devel, and optionally a memcached server in production --- Gemfile | 3 +++ Gemfile.lock | 2 ++ config/environments/development.rb | 2 ++ config/environments/production.rb | 8 ++++++++ 4 files changed, 15 insertions(+) diff --git a/Gemfile b/Gemfile index 3ec566ea..24b639e0 100644 --- a/Gemfile +++ b/Gemfile @@ -212,6 +212,9 @@ gem 'selectize-rails' # CVE-2017-9049, CVE-2017-9050 gem 'nokogiri', '>= 1.8.1' +# memcached binary connector +gem 'dalli' + # Use guard and spring for testing in development group :development do # to launch specs when files are modified diff --git a/Gemfile.lock b/Gemfile.lock index cdc4e0cb..ed17fd91 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,6 +142,7 @@ GEM safe_yaml (~> 1.0.0) currencies (0.4.2) daemons (1.1.9) + dalli (2.7.6) dante (0.2.0) database_cleaner (1.3.0) debug_inspector (0.0.2) @@ -585,6 +586,7 @@ DEPENDENCIES country_select coveralls daemons + dalli database_cleaner delayed_job_active_record devise diff --git a/config/environments/development.rb b/config/environments/development.rb index 2557e892..4bff137e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -12,6 +12,8 @@ Osem::Application.configure do # since you don't have to restart the web server when you make code changes. config.cache_classes = false + config.cache_store = :memory_store, { size: 64.megabytes } + # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false diff --git a/config/environments/production.rb b/config/environments/production.rb index a70ef729..b4aa56b0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -46,6 +46,14 @@ Osem::Application.configure do # Use a different cache store in production # config.cache_store = :mem_cache_store + if ENV["MEMCACHEDCLOUD_SERVERS"] + config.cache_store = :dalli_store, ENV["MEMCACHEDCLOUD_SERVERS"].split(','), { + username: ENV["MEMCACHEDCLOUD_USERNAME"], + password: ENV["MEMCACHEDCLOUD_PASSWORD"] + } + else + config.cache_store = :memory_store, { size: 64.megabytes } + end # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" From 82a89b73195410249b5f1af80536b78001e78920 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 09:54:27 -0800 Subject: [PATCH 05/15] Use fragment caching on the splashpage --- app/views/conferences/_booths.html.haml | 42 +++---- .../conferences/_call_for_paper.html.haml | 5 +- .../conferences/_call_for_tracks.html.haml | 50 +++++---- app/views/conferences/_lodging.html.haml | 64 ++++++----- app/views/conferences/_registration.html.haml | 52 ++++----- .../_schedule_splashpage.html.haml | 100 +++++++++-------- app/views/conferences/_social_media.html.haml | 38 ++++--- app/views/conferences/_sponsors.html.haml | 74 ++++++------ app/views/conferences/_tickets.html.haml | 53 +++++---- app/views/conferences/_venue.html.haml | 67 +++++------ app/views/conferences/show.html.haml | 106 ++++++++---------- 11 files changed, 334 insertions(+), 317 deletions(-) diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index 39dc9253..fd9db04f 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -2,23 +2,25 @@ %li %a.smoothscroll{ href: '#booths' } Booths -.container - .row - .col-md-12.text-center - %h2 Booths - - @conference.confirmed_booths.each_slice(3).with_index do |slice, index_for_row| - .row.row-centered - - slice.each.with_index do |booth, index_for_column| - .col-md-4.col-sm-4.col-xs-10.col-centered.col-top - .thumbnail - - if booth.logo_link - = link_to booth.website_url, class: 'thumbnail' do - = image_tag booth.picture.large.url - .caption - %h3.text-center - = booth.title - %p.text-center.text-muted - = link_to "#show_description_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do - learn more - .collapse{ id: "show_description_#{index_for_row}_#{index_for_column}" } - = markdown(booth.description) +- cache [@conference.confirmed_booths, '#splash#booths'] do + %section#booths + .container + .row + .col-md-12.text-center + %h2 Booths + - @conference.confirmed_booths.each_slice(3).with_index do |slice, index_for_row| + .row.row-centered + - slice.each.with_index do |booth, index_for_column| + .col-md-4.col-sm-4.col-xs-10.col-centered.col-top + .thumbnail + - if booth.logo_link + = link_to booth.website_url, class: 'thumbnail' do + = image_tag booth.picture.large.url + .caption + %h3.text-center + = booth.title + %p.text-center.text-muted + = link_to "#show_description_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do + learn more + .collapse{ id: "show_description_#{index_for_row}_#{index_for_column}" } + = markdown(booth.description) diff --git a/app/views/conferences/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml index 2dbd2ecd..9d8188fa 100644 --- a/app/views/conferences/_call_for_paper.html.haml +++ b/app/views/conferences/_call_for_paper.html.haml @@ -2,7 +2,10 @@ %li %a.smoothscroll{ href: '#callforpapers' } Call For Papers -.container +- cache [@conference, @conference.call_for_events, @conference.confirmed_tracks, + '#splash#callforpapers'] do + %section#callforpapers + .container .row .col-md-12.text-center %h2 diff --git a/app/views/conferences/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.html.haml index c457880d..e627fca8 100644 --- a/app/views/conferences/_call_for_tracks.html.haml +++ b/app/views/conferences/_call_for_tracks.html.haml @@ -2,27 +2,29 @@ %li %a.smoothscroll{ href: '#callfortracks' } Call For Tracks -.container - .row - .col-md-12.text-center - %h2 - Call for Tracks - %p.lead - We are ready to accept requests for tracks! - .row - .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 - %p - The submission period for track requests is open - %em.notranslate - = "#{date_string(@conference.call_for_tracks.start_date, - @conference.call_for_tracks.end_date)}." - %b - You have - = pluralize(@conference.call_for_tracks.remaining_days, 'day') - left! - .row - .col-md-12.text-center - %p.cta-button - = link_to("Submit your request for track", - conference_program_tracks_path(@conference.short_title), - class: 'btn btn-success btn-lg text-center') +- cache [@conference, @conference.call_for_tracks, '#splash#callfortracks'] do + %section#callfortracks + .container + .row + .col-md-12.text-center + %h2 + Call for Tracks + %p.lead + We are ready to accept requests for tracks! + .row + .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 + %p + The submission period for track requests is open + %em.notranslate + = "#{date_string(@conference.call_for_tracks.start_date, + @conference.call_for_tracks.end_date)}." + %b + You have + = pluralize(@conference.call_for_tracks.remaining_days, 'day') + left! + .row + .col-md-12.text-center + %p.cta-button + = link_to("Submit your request for track", + conference_program_tracks_path(@conference.short_title), + class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/_lodging.html.haml b/app/views/conferences/_lodging.html.haml index a9754190..006978d3 100644 --- a/app/views/conferences/_lodging.html.haml +++ b/app/views/conferences/_lodging.html.haml @@ -2,36 +2,38 @@ %li %a.smoothscroll{ href: '#lodging' } Lodging -.container - .row - .col-md-12.text-center - %h2 - Where to stay - - if @conference.venue - in - = @conference.venue.city - %p.lead - We recommend these affordable lodging accommodations for your visit. +- cache [@conference.venue, @conference.lodgings, '#splash#lodging'] do + %section#lodging + .container + .row + .col-md-12.text-centers + %h2 + Where to stay + - if @conference.venue + in + = @conference.venue.city + %p.lead + We recommend these affordable lodging accommodations for your visit. - .row.row-centered - - @conference.lodgings.each do |lodging| - .col-md-4.col-sm-4.col-centered.col-top - .thumbnail - - if lodging.picture? - -if lodging.website_link.present? - = link_to(lodging.website_link, class: 'thumbnail') do - = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' - - else - = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' - - else - %p.text-center - -if lodging.website_link.present? - = link_to(lodging.website_link, class: 'thumbnail') do - %i.fa.fa-home.fa-5x + .row.row-centered + - @conference.lodgings.each do |lodging| + .col-md-4.col-sm-4.col-centered.col-top + .thumbnail + - if lodging.picture? + -if lodging.website_link.present? + = link_to(lodging.website_link, class: 'thumbnail') do + = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' + - else + = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' - else - %i.fa.fa-home.fa-5x - .caption - %h3.text-center - = lodging.name - -if lodging.description.present? - = markdown(lodging.description) + %p.text-center + -if lodging.website_link.present? + = link_to(lodging.website_link, class: 'thumbnail') do + %i.fa.fa-home.fa-5x + - else + %i.fa.fa-home.fa-5x + .caption + %h3.text-center + = lodging.name + -if lodging.description.present? + = markdown(lodging.description) diff --git a/app/views/conferences/_registration.html.haml b/app/views/conferences/_registration.html.haml index 5614bdba..9db1f280 100644 --- a/app/views/conferences/_registration.html.haml +++ b/app/views/conferences/_registration.html.haml @@ -2,29 +2,31 @@ %li %a.smoothscroll{ href: '#registration' } Registration -.container - .row - .col-md-12.text-center - %h1 Registration +- cache [@conference.registration_period, @conference.tickets, '#splash#registration'] do + %section#registration + .container + .row + .col-md-12.text-center + %h1 Registration - - if @conference.registration_limit_exceeded? - %p - Sorry, the conference registration limit has exceeded - - else - - if @conference.tickets.empty? - %p.lead - Going to - = @conference.short_title - is free of charge. - %p - We only ask you to register yourself until - = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') - so we can plan for the right amount of people. - %p.cta-button - - else - %p - The registration period ends on - = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') - %p.cta-button - = link_to(new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-lg btn-success') do - Register Now + - if @conference.registration_limit_exceeded? + %p + Sorry, the conference registration limit has exceeded + - else + - if @conference.tickets.empty? + %p.lead + Going to + = @conference.short_title + is free of charge. + %p + We only ask you to register yourself until + = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') + so we can plan for the right amount of people. + %p.cta-button + - else + %p + The registration period ends on + = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') + %p.cta-button + = link_to(new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-lg btn-success') do + Register Now diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml index 10584bcb..cccbe929 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -3,53 +3,55 @@ =link_to('#program', class: 'smoothscroll') do Program -.container - .row - .col-md-12 - %h2.text-center - Program - %p.lead.text-center - %span.notranslate - = @conference.title - has the most awesome program ever! - - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? - See rock-star speakers cover the topics of - - @conference.confirmed_tracks.each_slice(3) do |slice| +- cache [@confererence, @conference.confirmed_tracks, '#splash#program'] do + %section#program + .container + .row + .col-md-12 + %h2.text-center + Program + %p.lead.text-center + %span.notranslate + = @conference.title + has the most awesome program ever! + - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? + See rock-star speakers cover the topics of + - @conference.confirmed_tracks.each_slice(3) do |slice| + .row.row-centered + - slice.each do |track| + .col-md-4.col-sm-4.col-centered.col-top.track + %h4.text-center + = track.name + = markdown(track.description) + - if track.start_date + %br + From: #{track.start_date.strftime('%A, %B %-d. %Y')} + - if track.end_date + %br + To: #{track.end_date.strftime('%A, %B %-d. %Y')} + - if track.room + %br + In: #{track.room.name} + + - if @conference.program.try(:schedule_public?) + .row + .col-md-12 + %p.cta-button.text-center + = link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do + Full Schedule + + %h3.text-center + Don't miss out! + %br + - if @conference.highlighted_events.any? + .row + .col-md-12 + - @conference.highlighted_events.each_slice(2) do |slice| .row.row-centered - - slice.each do |track| - .col-md-4.col-sm-4.col-centered.col-top.track - %h4.text-center - = track.name - = markdown(track.description) - - if track.start_date - %br - From: #{track.start_date.strftime('%A, %B %-d. %Y')} - - if track.end_date - %br - To: #{track.end_date.strftime('%A, %B %-d. %Y')} - - if track.room - %br - In: #{track.room.name} - - - if @conference.program.try(:schedule_public?) - .row - .col-md-12 - %p.cta-button.text-center - = link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do - Full Schedule - - %h3.text-center - Don't miss out! - %br - - if @conference.highlighted_events.any? - .row - .col-md-12 - - @conference.highlighted_events.each_slice(2) do |slice| - .row.row-centered - - slice.each do |event| - .col-md-6.col-centered.col-top.highlights - %p.text-center - %b= event.title - %h5.text-center - = markdown truncate(event.abstract, length: 500, separator: ' ') - = link_to "Read More", conference_program_proposal_path(@conference.short_title, event) + - slice.each do |event| + .col-md-6.col-centered.col-top.highlights + %p.text-center + %b= event.title + %h5.text-center + = markdown truncate(event.abstract, length: 500, separator: ' ') + = link_to "Read More", conference_program_proposal_path(@conference.short_title, event) diff --git a/app/views/conferences/_social_media.html.haml b/app/views/conferences/_social_media.html.haml index b072423f..4d3a5c4f 100644 --- a/app/views/conferences/_social_media.html.haml +++ b/app/views/conferences/_social_media.html.haml @@ -1,18 +1,20 @@ -.container - .row - .col-md-12.text-center - - unless @conference.contact.facebook.blank? - = link_to "#{ @conference.contact.facebook }" do - %i.fa.fa-facebook-square.fa-4x - - unless @conference.contact.twitter.blank? - = link_to "#{ @conference.contact.twitter }" do - %i.fa.fa-twitter.fa-4x - - unless @conference.contact.instagram.blank? - = link_to "#{ @conference.contact.instagram }" do - %i.fa.fa-instagram.fa-4x - - unless @conference.contact.googleplus.blank? - = link_to "#{ @conference.contact.googleplus }" do - %i.fa.fa-google-plus-square.fa-4x - - unless @conference.contact.email.blank? - = mail_to "#{ @conference.contact.email }" do - %i.fa.fa-envelope-o.fa-4x +- cache [@conference.contact, '#splash#social'] do + %section#social-media + .container + .row + .col-md-12.text-center + - unless @conference.contact.facebook.blank? + = link_to "#{ @conference.contact.facebook }" do + %i.fa.fa-facebook-square.fa-4x + - unless @conference.contact.twitter.blank? + = link_to "#{ @conference.contact.twitter }" do + %i.fa.fa-twitter.fa-4x + - unless @conference.contact.instagram.blank? + = link_to "#{ @conference.contact.instagram }" do + %i.fa.fa-instagram.fa-4x + - unless @conference.contact.googleplus.blank? + = link_to "#{ @conference.contact.googleplus }" do + %i.fa.fa-google-plus-square.fa-4x + - unless @conference.contact.email.blank? + = mail_to "#{ @conference.contact.email }" do + %i.fa.fa-envelope-o.fa-4x diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml index 94da9940..046b2845 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -2,40 +2,42 @@ %li %a.smoothscroll{ href: '#sponsors' } Sponsors -.container - .row - .col-md-12.text-center - %h2 Sponsors - - @conference.sponsorship_levels.each do |sponsorship_level| - -if sponsorship_level.sponsors.any? - - sponsorship_level.sponsors.each_slice(3) do |slice| - .row.row-centered - - slice.each do |sponsor| - .col-md-4.col-sm-4.col-centered.col-top - %a{ href: '#', data: { toggle: 'modal', target: "#modal_#{sponsor.id}" } } - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" +- cache [@conference, @conference.sponsors, @conference.try(:call_for_sponsors), '#splash#sponsors'] do + %section#sponsors + .container + .row + .col-md-12.text-center + %h2 Sponsors + - @conference.sponsorship_levels.each do |sponsorship_level| + -if sponsorship_level.sponsors.any? + - sponsorship_level.sponsors.each_slice(3) do |slice| + .row.row-centered + - slice.each do |sponsor| + .col-md-4.col-sm-4.col-centered.col-top + %a{ href: '#', data: { toggle: 'modal', target: "#modal_#{sponsor.id}" } } + = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" - .modal.fade{ id: "modal_#{sponsor.id}" } - .modal-dialog - .modal-content - .modal-header - %button.close{ data: { dismiss: 'modal' } } - x - .modal-title - = sponsor.name - .modal-body.text-center - .logo - = link_to sponsor.website_url, target: '_blank' do - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" - .description - = sponsor.description - .modal-footer - = link_to nil, "#{sponsor.website_url}", target: '_blank' - - if @conference.call_for_sponsors.try(:open?) - .row - .col-md-12 - %p.text-muted.text-center - %small - Want to sponsor #{@conference.short_title}? - = link_to("mailto: #{@conference.contact.sponsor_email}?subject=#{@conference.short_title}%20Sponsorship") do - Please contact us! + .modal.fade{ id: "modal_#{sponsor.id}" } + .modal-dialog + .modal-content + .modal-header + %button.close{ data: { dismiss: 'modal' } } + x + .modal-title + = sponsor.name + .modal-body.text-center + .logo + = link_to sponsor.website_url, target: '_blank' do + = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" + .description + = sponsor.description + .modal-footer + = link_to nil, "#{sponsor.website_url}", target: '_blank' + - if @conference.call_for_sponsors.try(:open?) + .row + .col-md-12 + %p.text-muted.text-center + %small + Want to sponsor #{@conference.short_title}? + = link_to("mailto: #{@conference.contact.sponsor_email}?subject=#{@conference.short_title}%20Sponsorship") do + Please contact us! diff --git a/app/views/conferences/_tickets.html.haml b/app/views/conferences/_tickets.html.haml index 8a202295..d06218ce 100644 --- a/app/views/conferences/_tickets.html.haml +++ b/app/views/conferences/_tickets.html.haml @@ -1,25 +1,30 @@ -.container - .row - .col-md-12.text-center - %h2 - Support - =@conference.short_title - %p.lead - To support our event you can get these tickets - - @conference.tickets.each_slice(4) do |slice| - .row.row-centered - - slice.each do |ticket| - .col-md-3.col-centered.col-top.col-sm-3 - .thumbnail - %p.text-center - %i.fa.fa-ticket.fa-5x - .caption - %h3.text-center - = ticket.title - -if ticket.description.present? - = markdown(ticket.description) - %p.text-center - = link_to(conference_tickets_path(@conference.short_title), class: 'btn btn-success') do - Get Ticket - = humanized_money_with_symbol ticket.price += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#tickets' } Tickets +- cache [@conference, @conference.tickets, '#splash#tickets'] do + %section#tickets + .container + .row + .col-md-12.text-center + %h2 + Support + =@conference.short_title + %p.lead + To support our event you can get these tickets + - @conference.tickets.each_slice(4) do |slice| + .row.row-centered + - slice.each do |ticket| + .col-md-3.col-centered.col-top.col-sm-3 + .thumbnail + %p.text-center + %i.fa.fa-ticket.fa-5x + .caption + %h3.text-center + = ticket.title + -if ticket.description.present? + = markdown(ticket.description) + %p.text-center + = link_to(conference_tickets_path(@conference.short_title), class: 'btn btn-success') do + Get Ticket + = humanized_money_with_symbol ticket.price diff --git a/app/views/conferences/_venue.html.haml b/app/views/conferences/_venue.html.haml index 4436b0fe..0c7ef254 100644 --- a/app/views/conferences/_venue.html.haml +++ b/app/views/conferences/_venue.html.haml @@ -1,35 +1,38 @@ = content_for :splash_nav do %li %a.smoothscroll{ href: '#venue' } Venue --if @conference.venue.location? - = render '/conferences/venue_map' --else - .container - .row - .col-md-6 - .thumbnail#venue-pic - - if @conference.venue.commercial.present? and @conference.venue.commercial.persisted? - .flexvideo{ id: "resource-content-#{@conference.venue.commercial.id}"} - = render partial: 'shared/media_item', locals: { commercial: @conference.venue.commercial } - - elsif @conference.venue.picture? - = image_tag @conference.venue.picture.url, alt: @conference.venue.name, class:"img-responsive" - - else - %p.text-center - %span.fa.fa-university.fa-5x - .caption - %h3.text-center - = @conference.venue.name - - unless @conference.venue.description.blank? - = markdown(@conference.venue.description) - .col-md-6 - %h2 - = "#{@conference.venue.city} / #{@conference.venue.country_name}" - %address - = @conference.venue.street - %br - = "#{@conference.venue.postalcode}, #{@conference.venue.city}" - %br - = @conference.venue.country_name - - if @conference.venue.website - %br - =link_to(h(@conference.venue.website), h(@conference.venue.website)).html_safe + +- cache [@conference.venue, @conference.venue.commercial, '#splash#venue'] do + %section#venue + -if @conference.venue.location? + = render '/conferences/venue_map' + -else + .container + .row + .col-md-6 + .thumbnail#venue-pic + - if @conference.venue.commercial.present? and @conference.venue.commercial.persisted? + .flexvideo{ id: "resource-content-#{@conference.venue.commercial.id}"} + = render partial: 'shared/media_item', locals: { commercial: @conference.venue.commercial } + - elsif @conference.venue.picture? + = image_tag @conference.venue.picture.url, alt: @conference.venue.name, class:"img-responsive" + - else + %p.text-center + %span.fa.fa-university.fa-5x + .caption + %h3.text-center + = @conference.venue.name + - unless @conference.venue.description.blank? + = markdown(@conference.venue.description) + .col-md-6 + %h2 + = "#{@conference.venue.city} / #{@conference.venue.country_name}" + %address + = @conference.venue.street + %br + = "#{@conference.venue.postalcode}, #{@conference.venue.city}" + %br + = @conference.venue.country_name + - if @conference.venue.website + %br + =link_to(h(@conference.venue.website), h(@conference.venue.website)).html_safe diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index c6a7fd54..65a3b629 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,87 +11,79 @@ = @conference.title #splash - #banner - .container - .row - .col-md-8.col-md-offset-2#header - .row - .col-md-4 - = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? - .col-md-8 - %h1 - = @conference.title - %p.lead - - if @conference.venue - = "#{@conference.venue.city} / #{@conference.venue.country_name}" - - if @conference.start_date && @conference.end_date - %br - = date_string(@conference.start_date, @conference.end_date) - - - unless @conference.description.blank? - %section#about + - cache [@conference, @conference.venue, '#splash#header'] do + #banner .container .row - .col-md-8.col-md-offset-2 - %h3.text-center - = markdown(@conference.description) + .col-md-8.col-md-offset-2#header + .row + .col-md-4 + = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? + .col-md-8 + %h1 + = @conference.title + %p.lead + - if @conference.venue + = "#{@conference.venue.city} / #{@conference.venue.country_name}" + - if @conference.start_date && @conference.end_date + %br + = date_string(@conference.start_date, @conference.end_date) + + - unless @conference.description.blank? + %section#about + .container + .row + .col-md-8.col-md-offset-2 + %h3.text-center + = markdown(@conference.description) - if @conference.splashpage.include_registrations && @conference.registration_open? - %section#registration - = render 'registration' + = render 'registration' - if @conference.splashpage.include_program - %section#program - = render 'schedule_splashpage' + = render 'schedule_splashpage' - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) - %section#callforpapers - = render 'call_for_paper' + = render 'call_for_paper' - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) - %section#callfortracks - = render 'call_for_tracks' + = render 'call_for_tracks' - if @conference.splashpage.include_venue && @conference.venue - %section#venue - = render 'venue' + = render 'venue' - if @conference.splashpage.include_lodgings && @conference.lodgings.any? - %section#lodging - = render 'lodging' + = render 'lodging' - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? - %section#tickets - = render 'tickets' + = render 'tickets' - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? - %section#booths - = render 'booths' + = render 'booths' - if @conference.splashpage.include_sponsors && @conference.sponsors.any? - %section#sponsors - = render 'sponsors' + = render 'sponsors' - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? - %section#social-media - = render 'social_media' + = render 'social_media' // grmbl = render 'footer' -- content_for :script_head do - :javascript - var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); - var triangle_colors = triangle_tcs.map(function(t) { return t.toHexString(); }); - $(function () { - $(document).ready(function() { - var triangle_width = document.body.clientWidth; - var triangle_height = ($( "#banner" ).height() + 200 ); - var pattern = Trianglify({ width: triangle_width, - height: triangle_height, - cell_size: 100, - x_colors: triangle_colors - }); - $('#banner').css('background-image', 'url("' + pattern.png() + '")'); +- cache [@conference.color, '#splash#inlinejs'] do + - content_for :script_head do + :javascript + var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); + var triangle_colors = triangle_tcs.map(function(t) { return t.toHexString(); }); + $(function () { + $(document).ready(function() { + var triangle_width = document.body.clientWidth; + var triangle_height = ($( "#banner" ).height() + 200 ); + var pattern = Trianglify({ width: triangle_width, + height: triangle_height, + cell_size: 100, + x_colors: triangle_colors + }); + $('#banner').css('background-image', 'url("' + pattern.png() + '")'); + }); }); - }); From 166b94a3b2016e13d05b03e300dcdb68d5512362 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:06:58 -0800 Subject: [PATCH 06/15] Redesign & move splashpage header into a partial ... this allows conferences/show to consistently just show layout. --- app/views/conferences/_header.haml | 33 ++++++++++++++++++++++++++++ app/views/conferences/show.html.haml | 26 +--------------------- 2 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 app/views/conferences/_header.haml diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml new file mode 100644 index 00000000..9aeacc26 --- /dev/null +++ b/app/views/conferences/_header.haml @@ -0,0 +1,33 @@ +- cache [@conference, @conference.venue, '#splash#header'] do + #banner + .container + .row + .col-md-8.col-md-offset-2#header + .row + .col-md-4 + = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? + .col-md-8 + %h1 + = @conference.title + %h3 + - if @conference.start_date && @conference.end_date + %span.date.text-nowrap + = date_string(@conference.start_date, @conference.end_date) + • + - if @conference.venue + %span.venue.text-nowrap + - if @conference.venue.website + = sanitize link_to(@conference.venue.name, @conference.venue.website) + - else + = @conference.venue.city + - if @conference.venue.country_name != 'US' + • + = @conference.venue.country_name + + - unless @conference.description.blank? + %section#about + .container + .row + .col-md-8.col-md-offset-2 + %h3.text-center + = markdown(@conference.description) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 65a3b629..f82235ce 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,31 +11,7 @@ = @conference.title #splash - - cache [@conference, @conference.venue, '#splash#header'] do - #banner - .container - .row - .col-md-8.col-md-offset-2#header - .row - .col-md-4 - = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? - .col-md-8 - %h1 - = @conference.title - %p.lead - - if @conference.venue - = "#{@conference.venue.city} / #{@conference.venue.country_name}" - - if @conference.start_date && @conference.end_date - %br - = date_string(@conference.start_date, @conference.end_date) - - - unless @conference.description.blank? - %section#about - .container - .row - .col-md-8.col-md-offset-2 - %h3.text-center - = markdown(@conference.description) + = render 'header' - if @conference.splashpage.include_registrations && @conference.registration_open? = render 'registration' From 9b462d4d347c5a799c63f5e0f7176de675c6dc10 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:14:54 -0800 Subject: [PATCH 07/15] Reorder splashpage sections Grouping common things, trying to keep things making sense. I'd like to see this become customizable at some point. --- app/views/conferences/show.html.haml | 37 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index f82235ce..e6e2fe00 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,39 +11,38 @@ = @conference.title #splash + // header/description = render 'header' + // attendance/registration - if @conference.splashpage.include_registrations && @conference.registration_open? = render 'registration' - - - if @conference.splashpage.include_program - = render 'schedule_splashpage' - - - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) - = render 'call_for_paper' - - - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) - = render 'call_for_tracks' - - - if @conference.splashpage.include_venue && @conference.venue - = render 'venue' - - - if @conference.splashpage.include_lodgings && @conference.lodgings.any? - = render 'lodging' - - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? = render 'tickets' + // calls for content - or - program + - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) + = render 'call_for_paper' + - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) + = render 'call_for_tracks' + - if @conference.splashpage.include_program + = render 'schedule_splashpage' - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? = render 'booths' - - if @conference.splashpage.include_sponsors && @conference.sponsors.any? + // geo + - if @conference.splashpage.include_venue && @conference.venue + = render 'venue' + - if @conference.splashpage.include_lodgings && @conference.lodgings.any? + = render 'lodging' + + // sponsorship + - if @conference.splashpage.include_sponsors = render 'sponsors' + // footer - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? = render 'social_media' - - // grmbl = render 'footer' - cache [@conference.color, '#splash#inlinejs'] do From 1ad6ad7e79bfef03f64b0beadbf100fd00732ca7 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:26:19 -0800 Subject: [PATCH 08/15] Fold booths into the schedule section of splashpage --- app/views/conferences/_booths.html.haml | 4 ---- app/views/conferences/_schedule_splashpage.html.haml | 10 ++++++---- app/views/conferences/show.html.haml | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index fd9db04f..5bff5a70 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -1,7 +1,3 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#booths' } Booths - - cache [@conference.confirmed_booths, '#splash#booths'] do %section#booths .container diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml index cccbe929..4f47c31e 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -1,10 +1,9 @@ = content_for :splash_nav do %li - =link_to('#program', class: 'smoothscroll') do - Program + %a.smoothscroll{ href: '#schedule' } Schedule -- cache [@confererence, @conference.confirmed_tracks, '#splash#program'] do - %section#program +- cache [@confererence, @conference.confirmed_tracks, '#splash#schedule'] do + %section#schedule .container .row .col-md-12 @@ -55,3 +54,6 @@ %h5.text-center = markdown truncate(event.abstract, length: 500, separator: ' ') = link_to "Read More", conference_program_proposal_path(@conference.short_title, event) + +- if @conference.splashpage.include_booths && @conference.confirmed_booths.any? + = render 'booths' diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index e6e2fe00..95d82ca0 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -20,15 +20,13 @@ - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? = render 'tickets' - // calls for content - or - program + // calls for content, or program - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) = render 'call_for_paper' - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) = render 'call_for_tracks' - if @conference.splashpage.include_program = render 'schedule_splashpage' - - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? - = render 'booths' // geo - if @conference.splashpage.include_venue && @conference.venue From 5d13499feeac6d43e5a463c2ad23e3536d4cb7e5 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:56:46 -0800 Subject: [PATCH 09/15] Fold call for papers & call for tracks into one splashpage section --- Gemfile.lock | 2 +- app/views/admin/splashpages/_form.html.haml | 2 +- app/views/admin/splashpages/show.html.haml | 2 +- app/views/conferences/_call_for_content.haml | 14 ++++ .../conferences/_call_for_paper.html.haml | 81 ++++++++----------- .../conferences/_call_for_tracks.html.haml | 47 +++++------ app/views/conferences/show.html.haml | 6 +- spec/features/versions_spec.rb | 2 +- 8 files changed, 73 insertions(+), 83 deletions(-) create mode 100644 app/views/conferences/_call_for_content.haml diff --git a/Gemfile.lock b/Gemfile.lock index ed17fd91..45ee345a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,7 +289,7 @@ GEM multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) - mysql2 (0.4.9) + mysql2 (0.4.10) nenv (0.3.0) netrc (0.11.0) nokogiri (1.8.1) diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index c1897745..96a1a300 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -8,7 +8,7 @@ = f.inputs name: 'Components' do = f.input :include_tracks, label: 'Display tracks', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tracks) } = f.input :include_program, label: 'Display program', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_program) } - = f.input :include_cfp, label: 'Display call for papers information on splashpage, while cfp is open', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_cfp) } + = f.input :include_cfp, label: 'Display call for papers and call for tracks information on splashpage, while open', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_cfp) } = f.input :include_venue, label: 'Display venue', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_venue) } = f.input :include_registrations, label: 'Display the registration period', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_registrations) } = f.input :include_tickets, label: 'Display tickets', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tickets) } diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index c185b119..8d799eda 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -25,7 +25,7 @@ - else No %dt - Include CFP: + Include Calls for Content: %dd - if @splashpage.include_cfp Yes diff --git a/app/views/conferences/_call_for_content.haml b/app/views/conferences/_call_for_content.haml new file mode 100644 index 00000000..7f8703c4 --- /dev/null +++ b/app/views/conferences/_call_for_content.haml @@ -0,0 +1,14 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#call' } Call For Content + +%section#call + .container + .row + - if @conference.call_for_events.try(:open?) ^ @conference.call_for_tracks.try(:open?) + .col-md-3.col-sm-3.hidden-xs   + - if @conference.call_for_events.try(:open?) + = render 'call_for_paper' + .col-md-2.col-sm-2   + - if @conference.call_for_tracks.try(:open?) + = render 'call_for_tracks' diff --git a/app/views/conferences/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml index 9d8188fa..d173356c 100644 --- a/app/views/conferences/_call_for_paper.html.haml +++ b/app/views/conferences/_call_for_paper.html.haml @@ -1,48 +1,37 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#callforpapers' } Call For Papers - - cache [@conference, @conference.call_for_events, @conference.confirmed_tracks, '#splash#callforpapers'] do - %section#callforpapers - .container - .row - .col-md-12.text-center - %h2 - Call for Papers - %p.lead - We are ready to accept your proposals for sessions! - .row - .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 - %p - - if @conference.event_types.any? - You can submit proposals for - %span.notranslate - = "#{event_types(@conference)}." - - if @conference.confirmed_tracks.any? - Proposals should fit in one of the - %span.notranslate - = "#{pluralize(@conference.confirmed_tracks.length, 'track')}:" - = "#{tracks(@conference)}." - - if @conference.call_for_events.try(:open?) - The submission period is open - %em.notranslate - = "#{date_string(@conference.call_for_events.start_date, - @conference.call_for_events.end_date)}." - %b - You have - = pluralize(@conference.call_for_events.remaining_days, 'day') - left! - Remember - %span.notranslate - = @conference.title - will only be as good as the sessions you present. - Submit early, submit often! - - else - The submission period is closed. - .row - .col-md-12.text-center - %p.cta-button - = link_to "Submit your paper now", - conference_program_proposals_path(@conference.short_title), - class: 'btn btn-success btn-lg text-center' + .col-md-5.col-sm-5.text-center + %h2 + Call for Papers + %p.lead + We are ready to accept your proposals for sessions! + %p + - if @conference.event_types.any? + You can submit proposals for + %span.notranslate + = "#{event_types(@conference)}." + - if @conference.confirmed_tracks.any? + Proposals should fit in one of the + %span.notranslate + = "#{pluralize(@conference.confirmed_tracks.length, 'track')}:" + = "#{tracks(@conference)}." + - if @conference.call_for_events.try(:open?) + The submission period is open + %em.notranslate + = "#{date_string(@conference.call_for_events.start_date, + @conference.call_for_events.end_date)}." + %b + You have + = pluralize(@conference.call_for_events.remaining_days, 'day') + left! + Remember + %span.notranslate + = @conference.title + will only be as good as the sessions you present. + Submit early, submit often! + - else + The submission period is closed. + %p.cta-button + = link_to "Submit your paper now", + conference_program_proposals_path(@conference.short_title), + class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.html.haml index e627fca8..d1851a12 100644 --- a/app/views/conferences/_call_for_tracks.html.haml +++ b/app/views/conferences/_call_for_tracks.html.haml @@ -1,30 +1,19 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#callfortracks' } Call For Tracks - - cache [@conference, @conference.call_for_tracks, '#splash#callfortracks'] do - %section#callfortracks - .container - .row - .col-md-12.text-center - %h2 - Call for Tracks - %p.lead - We are ready to accept requests for tracks! - .row - .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 - %p - The submission period for track requests is open - %em.notranslate - = "#{date_string(@conference.call_for_tracks.start_date, - @conference.call_for_tracks.end_date)}." - %b - You have - = pluralize(@conference.call_for_tracks.remaining_days, 'day') - left! - .row - .col-md-12.text-center - %p.cta-button - = link_to("Submit your request for track", - conference_program_tracks_path(@conference.short_title), - class: 'btn btn-success btn-lg text-center') + .col-md-5.col-sm-5.text-center + %h2 + Call for Tracks + %p.lead + We are ready to accept requests for tracks! + %p + The submission period for track requests is open + %em.notranslate + = "#{date_string(@conference.call_for_tracks.start_date, + @conference.call_for_tracks.end_date)}." + %b + You have + = pluralize(@conference.call_for_tracks.remaining_days, 'day') + left! + %p.cta-button + = link_to("Submit your request for track", + conference_program_tracks_path(@conference.short_title), + class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 95d82ca0..86254efd 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -21,10 +21,8 @@ = render 'tickets' // calls for content, or program - - if @conference.splashpage.include_cfp && @conference.call_for_events.try(:open?) - = render 'call_for_paper' - - if @conference.splashpage.include_cfp && @conference.call_for_tracks.try(:open?) - = render 'call_for_tracks' + - if @conference.splashpage.include_cfp + = render 'call_for_content' - if @conference.splashpage.include_program = render 'schedule_splashpage' diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 1bf114a0..bdea1658 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -237,7 +237,7 @@ feature 'Version' do click_link 'Edit' uncheck('Display program') - uncheck('Display call for papers information on splashpage, while cfp is open') + uncheck('Display call for papers and call for tracks information on splashpage, while open') uncheck('Display venue') uncheck('Display tickets') uncheck('Display the lodgings') From 947689b3ff3e5d2c397ac323fbd33cb29fea2130 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 18:31:14 -0800 Subject: [PATCH 10/15] Consistent design and code cleanup of splashpage elements. * get rid of unnecessary slice() * center up small groups of elements * consistent text use FIXME: extract out strings * consistent date strings * simplified views for easier theming --- app/views/conferences/_booths.html.haml | 34 +++++++++------- .../conferences/_call_for_paper.html.haml | 11 +---- .../conferences/_call_for_tracks.html.haml | 3 +- app/views/conferences/_lodging.html.haml | 10 +++-- app/views/conferences/_program.html.haml | 40 ------------------- app/views/conferences/_registration.html.haml | 9 +++-- app/views/conferences/_tickets.html.haml | 33 +++++++-------- 7 files changed, 48 insertions(+), 92 deletions(-) delete mode 100644 app/views/conferences/_program.html.haml diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index 5bff5a70..cc48fead 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -4,19 +4,23 @@ .row .col-md-12.text-center %h2 Booths - - @conference.confirmed_booths.each_slice(3).with_index do |slice, index_for_row| - .row.row-centered - - slice.each.with_index do |booth, index_for_column| - .col-md-4.col-sm-4.col-xs-10.col-centered.col-top - .thumbnail - - if booth.logo_link - = link_to booth.website_url, class: 'thumbnail' do - = image_tag booth.picture.large.url - .caption - %h3.text-center + .row.row-centered + - @conference.confirmed_booths.each do |booth| + .col-md-4.col-sm-4.col-centered.col-top + .thumbnail.text-center + - if booth.picture? + = link_to booth.website_url, + class: 'thumbnail', target: '_blank' do + = image_tag booth.picture.large.url, alt: booth.title, + class: 'img-rounded' + .caption + %h3.text-center + - if booth.logo_link + = link_to booth.title, booth.website_url, target: '_blank' + -else = booth.title - %p.text-center.text-muted - = link_to "#show_description_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do - learn more - .collapse{ id: "show_description_#{index_for_row}_#{index_for_column}" } - = markdown(booth.description) + = link_to '', "#booth-detail-#{booth.id}", + data: {toggle: 'collapse'}, class: 'caret', + title: 'more info' + .collapse{ id: "booth-detail-#{booth.id}" } + = markdown(booth.description) diff --git a/app/views/conferences/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml index d173356c..09203e75 100644 --- a/app/views/conferences/_call_for_paper.html.haml +++ b/app/views/conferences/_call_for_paper.html.haml @@ -4,7 +4,7 @@ %h2 Call for Papers %p.lead - We are ready to accept your proposals for sessions! + We are now accepting proposals for sessions! %p - if @conference.event_types.any? You can submit proposals for @@ -24,14 +24,7 @@ You have = pluralize(@conference.call_for_events.remaining_days, 'day') left! - Remember - %span.notranslate - = @conference.title - will only be as good as the sessions you present. - Submit early, submit often! - - else - The submission period is closed. %p.cta-button - = link_to "Submit your paper now", + = link_to "Submit your proposal now", conference_program_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.html.haml index d1851a12..092c2740 100644 --- a/app/views/conferences/_call_for_tracks.html.haml +++ b/app/views/conferences/_call_for_tracks.html.haml @@ -3,8 +3,9 @@ %h2 Call for Tracks %p.lead - We are ready to accept requests for tracks! + We are now accepting custom track requests! %p + Would you like to host a mini-summit, sub-conference, or hack space? The submission period for track requests is open %em.notranslate = "#{date_string(@conference.call_for_tracks.start_date, diff --git a/app/views/conferences/_lodging.html.haml b/app/views/conferences/_lodging.html.haml index 006978d3..4859b8f5 100644 --- a/app/views/conferences/_lodging.html.haml +++ b/app/views/conferences/_lodging.html.haml @@ -6,14 +6,14 @@ %section#lodging .container .row - .col-md-12.text-centers + .col-md-12.text-center %h2 Where to stay - if @conference.venue in = @conference.venue.city %p.lead - We recommend these affordable lodging accommodations for your visit. + We recommend the following accommodations for your visit. .row.row-centered - @conference.lodgings.each do |lodging| @@ -22,9 +22,11 @@ - if lodging.picture? -if lodging.website_link.present? = link_to(lodging.website_link, class: 'thumbnail') do - = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' + = image_tag lodging.picture.large.url, + class: 'img-responsive img-lodging' - else - = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' + = image_tag lodging.picture.large.url, + class: 'img-responsive img-lodging' - else %p.text-center -if lodging.website_link.present? diff --git a/app/views/conferences/_program.html.haml b/app/views/conferences/_program.html.haml deleted file mode 100644 index f07816a4..00000000 --- a/app/views/conferences/_program.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#callforpapers' } Call For Papers - -.container - .row - .col-md-12.text-center - %h2 - Call for Papers - %p.lead - We are ready to accept your proposals for sessions! - .row - .col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1 - %p - - if @conference.program.event_types.any? - You can submit proposals for - = "#{event_types(@conference)}." - - if @conference.tracks.any? - Proposals should fit in one of the - = "#{pluralize(@conference.tracks.count, 'track')}:" - = "#{tracks(@conference)}." - The submission period has begun - %em - = @program.cfp.start_date.strftime('%A, %B %-d. %Y') - and closes - %em - = @program.cfp.end_date.strftime('%A, %B %-d. %Y.') - - if @conference.cfp_open? - That means you have only - %b= pluralize(@program.cfp.remaining_days, 'day') - left! - Remember - = @conference.short_title - will only be as good as the sessions you present. Submit early, submit often! - - else - The submission period is closed. - .row - .col-md-12.text-center - %p.cta-button - = link_to "Submit your paper now", conference_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_registration.html.haml b/app/views/conferences/_registration.html.haml index 9db1f280..b9b27f08 100644 --- a/app/views/conferences/_registration.html.haml +++ b/app/views/conferences/_registration.html.haml @@ -19,14 +19,15 @@ = @conference.short_title is free of charge. %p - We only ask you to register yourself until - = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') + We only ask you to register yourself before + = date_string(@conference.registration_period.end_date) so we can plan for the right amount of people. %p.cta-button - else %p The registration period ends on - = @conference.registration_period.end_date.strftime('%A, %B %-d. %Y') + = date_string(@conference.registration_period.end_date) %p.cta-button - = link_to(new_conference_conference_registration_path(@conference.short_title), class: 'btn btn-lg btn-success') do + = link_to(new_conference_conference_registration_path(@conference.short_title), + class: 'btn btn-lg btn-success') do Register Now diff --git a/app/views/conferences/_tickets.html.haml b/app/views/conferences/_tickets.html.haml index d06218ce..6f612a6a 100644 --- a/app/views/conferences/_tickets.html.haml +++ b/app/views/conferences/_tickets.html.haml @@ -9,22 +9,17 @@ .col-md-12.text-center %h2 Support - =@conference.short_title - %p.lead - To support our event you can get these tickets - - @conference.tickets.each_slice(4) do |slice| - .row.row-centered - - slice.each do |ticket| - .col-md-3.col-centered.col-top.col-sm-3 - .thumbnail - %p.text-center - %i.fa.fa-ticket.fa-5x - .caption - %h3.text-center - = ticket.title - -if ticket.description.present? - = markdown(ticket.description) - %p.text-center - = link_to(conference_tickets_path(@conference.short_title), class: 'btn btn-success') do - Get Ticket - = humanized_money_with_symbol ticket.price + =@conference.title + .row.row-centered + - @conference.tickets.each do |ticket| + .col-md-3.col-sm-3.col-centered.col-top + %h3.text-center + = ticket.title + %h3.text-center + %i.fa.fa-ticket.fa-3x + = markdown(ticket.description) + %p.text-center + = link_to conference_tickets_path(@conference.short_title), + class: 'btn btn-success' do + Get Ticket + = humanized_money_with_symbol ticket.price From d900b88747a556565c22f2afbb3e40560628395b Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:34:27 -0800 Subject: [PATCH 11/15] Generalize get_logo helper for all classes --- app/helpers/application_helper.rb | 15 +++++++++ app/helpers/sponsors_helper.rb | 12 ------- spec/helpers/application_helper_spec.rb | 44 ++++++++++++++++++++++++- spec/helpers/sponsor_helper_spec.rb | 40 ---------------------- 4 files changed, 58 insertions(+), 53 deletions(-) delete mode 100644 app/helpers/sponsors_helper.rb delete mode 100644 spec/helpers/sponsor_helper_spec.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 048e07c0..4407056a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -181,4 +181,19 @@ module ApplicationHelper title: 'Open Source Event Manager' ) end + + # returns the url to be used for logo on basis of sponsorship level position + def get_logo(object) + if object.try(:sponsorship_level) + if object.sponsorship_level.position == 1 + object.picture.first.url + elsif object.sponsorship_level.position == 2 + object.picture.second.url + else + object.picture.others.url + end + else + object.picture.large.url + end + end end diff --git a/app/helpers/sponsors_helper.rb b/app/helpers/sponsors_helper.rb deleted file mode 100644 index 4a21c9cd..00000000 --- a/app/helpers/sponsors_helper.rb +++ /dev/null @@ -1,12 +0,0 @@ -module SponsorsHelper - # returns the url to be used for logo on basis of sponsorship level position - def get_logo(sponsor) - if sponsor.sponsorship_level.position == 1 - sponsor.picture.first.url - elsif sponsor.sponsorship_level.position == 2 - sponsor.picture.second.url - else - sponsor.picture.others.url - end - end -end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 6626ed87..ff0fbfa2 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -1,8 +1,9 @@ require 'spec_helper' describe ApplicationHelper, type: :helper do - let(:conference) { create(:conference) } + let(:conference) { create(:full_conference) } let(:event) { create(:event, program: conference.program) } + let(:sponsor) { create(:sponsor) } describe '#date_string' do it 'when conference lasts 1 day' do @@ -75,4 +76,45 @@ describe ApplicationHelper, type: :helper do end end end + + describe '#get_logo' do + context 'first sponsorship_level' do + before do + first_sponsorship_level = create(:sponsorship_level, position: 1) + sponsor.update_attributes(sponsorship_level: first_sponsorship_level) + end + + it 'returns correct url' do + expect(get_logo(sponsor)).to match %r{.*(\bfirst/#{sponsor.logo_file_name}\b)} + end + end + + context 'second sponsorship_level' do + before do + second_sponsorship_level = create(:sponsorship_level, position: 2) + sponsor.update_attributes(sponsorship_level: second_sponsorship_level) + end + + it 'returns correct url' do + expect(get_logo(sponsor)).to match %r{.*(\bsecond/#{sponsor.logo_file_name}\b)} + end + end + + context 'other sponsorship_level' do + before do + other_sponsorship_level = create(:sponsorship_level, position: 3) + sponsor.update_attributes(sponsorship_level: other_sponsorship_level) + end + + it 'returns correct url' do + expect(get_logo(sponsor)).to match %r{.*(\bothers/#{sponsor.logo_file_name}\b)} + end + end + + context 'non-sponsor' do + it 'returns correct url' do + expect(get_logo(conference)).to match %r{.*(\blarge/#{conference.logo_file_name}\b)} + end + end + end end diff --git a/spec/helpers/sponsor_helper_spec.rb b/spec/helpers/sponsor_helper_spec.rb deleted file mode 100644 index c6ce08ce..00000000 --- a/spec/helpers/sponsor_helper_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper' - -describe SponsorsHelper, type: :helper do - let(:sponsor) { create(:sponsor) } - - describe '#get_logo' do - context 'first sponsorship_level' do - before do - first_sponsorship_level = create(:sponsorship_level, position: 1) - sponsor.update_attributes(sponsorship_level: first_sponsorship_level) - end - - it 'returns correct url' do - expect(get_logo(sponsor)).to match %r{.*(\bfirst/#{sponsor.logo_file_name}\b)} - end - end - - context 'second sponsorship_level' do - before do - second_sponsorship_level = create(:sponsorship_level, position: 2) - sponsor.update_attributes(sponsorship_level: second_sponsorship_level) - end - - it 'returns correct url' do - expect(get_logo(sponsor)).to match %r{.*(\bsecond/#{sponsor.logo_file_name}\b)} - end - end - - context 'other sponsorship_level' do - before do - other_sponsorship_level = create(:sponsorship_level, position: 3) - sponsor.update_attributes(sponsorship_level: other_sponsorship_level) - end - - it 'returns correct url' do - expect(get_logo(sponsor)).to match %r{.*(\bothers/#{sponsor.logo_file_name}\b)} - end - end - end -end From 9bd8019448cdb9b9cd944eb9020bd05897e96a16 Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:37:02 -0800 Subject: [PATCH 12/15] Move sponsor modal to a generic partial & redesign. ... use for booths also. --- app/views/conferences/_booths.html.haml | 27 +++++-------- app/views/conferences/_modal_description.haml | 21 ++++++++++ app/views/conferences/_sponsors.html.haml | 39 +++++++------------ app/views/conferences/_tickets.html.haml | 19 +++++---- app/views/conferences/show.html.haml | 2 + 5 files changed, 56 insertions(+), 52 deletions(-) create mode 100644 app/views/conferences/_modal_description.haml diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index cc48fead..e701b56e 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -6,21 +6,14 @@ %h2 Booths .row.row-centered - @conference.confirmed_booths.each do |booth| - .col-md-4.col-sm-4.col-centered.col-top - .thumbnail.text-center + .col-md-2.col-sm-2.col-centered.col-top + %a.thumbnail{ href: '#', + data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } } - if booth.picture? - = link_to booth.website_url, - class: 'thumbnail', target: '_blank' do - = image_tag booth.picture.large.url, alt: booth.title, - class: 'img-rounded' - .caption - %h3.text-center - - if booth.logo_link - = link_to booth.title, booth.website_url, target: '_blank' - -else - = booth.title - = link_to '', "#booth-detail-#{booth.id}", - data: {toggle: 'collapse'}, class: 'caret', - title: 'more info' - .collapse{ id: "booth-detail-#{booth.id}" } - = markdown(booth.description) + = image_tag get_logo(booth), + class: ['img-responsive', 'img-rounded'], + title: booth.title + - else + .caption + %h3.text-center= booth.title + = render 'modal_description', object: booth diff --git a/app/views/conferences/_modal_description.haml b/app/views/conferences/_modal_description.haml new file mode 100644 index 00000000..a8d1b1d2 --- /dev/null +++ b/app/views/conferences/_modal_description.haml @@ -0,0 +1,21 @@ +- content_for :modals do + .modal.fade{ id: "modal-#{object.class.name.downcase}-#{object.id}" } + .modal-dialog + .modal-content + .modal-header + %button.close{ data: { dismiss: 'modal' } } + %i.fa.fa-close + %h3.modal-title + = object.try(:title) || object.try(:name) + .modal-body + %p.logo + = link_to object.website_url || '#', target: '_blank' do + - img_classes = ['img-responsive center-block'] + - if object.is_a? Sponsor + - img_classes << ['img-sponsor', + "img-sponsor-#{object.sponsorship_level.position}"] + = image_tag get_logo(object), class: img_classes + %p.description + = object.description + .modal-footer + = link_to nil, object.website_url, target: '_blank' diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml index 046b2845..571069ae 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -5,34 +5,23 @@ - cache [@conference, @conference.sponsors, @conference.try(:call_for_sponsors), '#splash#sponsors'] do %section#sponsors .container - .row - .col-md-12.text-center - %h2 Sponsors - @conference.sponsorship_levels.each do |sponsorship_level| -if sponsorship_level.sponsors.any? - - sponsorship_level.sponsors.each_slice(3) do |slice| - .row.row-centered - - slice.each do |sponsor| - .col-md-4.col-sm-4.col-centered.col-top - %a{ href: '#', data: { toggle: 'modal', target: "#modal_#{sponsor.id}" } } - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" + .row.text-center + %h3 + = sponsorship_level.title + = 'Sponsor'.pluralize(sponsorship_level.sponsors.length) + .row.row-centered + - sponsorship_level.sponsors.each do |sponsor| + .col-md-4.col-sm-4.col-centered.col-top + %a{ href: '#', + data: { toggle: 'modal', target: "#modal-sponsor-#{sponsor.id}" } } + = image_tag get_logo(sponsor), + class: ['img-responsive', 'img-sponsor', + "img-sponsor-#{sponsorship_level.position}"], + title: sponsor.name + = render 'modal_description', object: sponsor - .modal.fade{ id: "modal_#{sponsor.id}" } - .modal-dialog - .modal-content - .modal-header - %button.close{ data: { dismiss: 'modal' } } - x - .modal-title - = sponsor.name - .modal-body.text-center - .logo - = link_to sponsor.website_url, target: '_blank' do - = image_tag get_logo(sponsor), class: "img-responsive img-sponsor img-sponsor-#{sponsorship_level.position}" - .description - = sponsor.description - .modal-footer - = link_to nil, "#{sponsor.website_url}", target: '_blank' - if @conference.call_for_sponsors.try(:open?) .row .col-md-12 diff --git a/app/views/conferences/_tickets.html.haml b/app/views/conferences/_tickets.html.haml index 6f612a6a..a01ad676 100644 --- a/app/views/conferences/_tickets.html.haml +++ b/app/views/conferences/_tickets.html.haml @@ -13,13 +13,12 @@ .row.row-centered - @conference.tickets.each do |ticket| .col-md-3.col-sm-3.col-centered.col-top - %h3.text-center - = ticket.title - %h3.text-center - %i.fa.fa-ticket.fa-3x - = markdown(ticket.description) - %p.text-center - = link_to conference_tickets_path(@conference.short_title), - class: 'btn btn-success' do - Get Ticket - = humanized_money_with_symbol ticket.price + = link_to(conference_tickets_path(@conference.short_title), + class: 'thumbnail') do + .caption + %h3.text-center + = ticket.title + = markdown(ticket.description) + %button.btn-block.btn.btn-lg.btn-success + %i.fa.fa-ticket.fa-fw + = humanized_money_with_symbol(ticket.price) diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 86254efd..3905b3a4 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -41,6 +41,8 @@ = render 'social_media' = render 'footer' + = yield :modals + - cache [@conference.color, '#splash#inlinejs'] do - content_for :script_head do :javascript From eb6980c31b1f5283edf0bc856f7d3b49660d1727 Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:53:03 -0800 Subject: [PATCH 13/15] Offset venue map to center up marker --- app/views/conferences/_venue_map.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conferences/_venue_map.html.haml b/app/views/conferences/_venue_map.html.haml index 9f34117f..708d5e46 100644 --- a/app/views/conferences/_venue_map.html.haml +++ b/app/views/conferences/_venue_map.html.haml @@ -2,7 +2,7 @@ - content_for(:script_body) do :javascript // create a map in the "map" div, set the view to a given place and zoom - var map = L.map('map', { scrollWheelZoom: false }).setView([#{h(@conference.venue.latitude)}, #{h(@conference.venue.longitude)}], 11); + var map = L.map('map', { scrollWheelZoom: false }).setView([#{@conference.venue.latitude.to_f + 0.05}, #{h(@conference.venue.longitude)}], 11); // add an OpenStreetMap tile layer L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', From c31e2ac5832c3ec5eabb2ea305d3a4eec765aa2b Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 27 Nov 2017 18:26:34 -0800 Subject: [PATCH 14/15] Redesign splashpage program section & split out partials --- app/views/conferences/_highlights.haml | 18 +++++ .../_schedule_splashpage.html.haml | 65 +++++-------------- app/views/conferences/_tracks.haml | 17 +++++ 3 files changed, 53 insertions(+), 47 deletions(-) create mode 100644 app/views/conferences/_highlights.haml create mode 100644 app/views/conferences/_tracks.haml diff --git a/app/views/conferences/_highlights.haml b/app/views/conferences/_highlights.haml new file mode 100644 index 00000000..0ea1eb99 --- /dev/null +++ b/app/views/conferences/_highlights.haml @@ -0,0 +1,18 @@ +.row + .col-md-12 + %h3.text-center + Program Highlights +.row + .col-md-12 + .row.row-centered + - @conference.highlighted_events.each do |event| + - speaker = event.speakers_ordered.first + .col-md-3.col-sm-3.col-centered.col-top.highlights + = link_to conference_program_proposal_path(@conference.short_title, event), + class: 'thumbnail' do + = image_tag speaker.gravatar_url(size: 300), + class: ['img-responsive', 'img-circle'], + title: speaker.name + .caption + %h3.text-center= speaker.name + %h4.text-center= event.title diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml index 4f47c31e..075fff32 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -4,56 +4,27 @@ - cache [@confererence, @conference.confirmed_tracks, '#splash#schedule'] do %section#schedule - .container - .row - .col-md-12 - %h2.text-center - Program - %p.lead.text-center - %span.notranslate - = @conference.title - has the most awesome program ever! - - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? - See rock-star speakers cover the topics of - - @conference.confirmed_tracks.each_slice(3) do |slice| - .row.row-centered - - slice.each do |track| - .col-md-4.col-sm-4.col-centered.col-top.track - %h4.text-center - = track.name - = markdown(track.description) - - if track.start_date - %br - From: #{track.start_date.strftime('%A, %B %-d. %Y')} - - if track.end_date - %br - To: #{track.end_date.strftime('%A, %B %-d. %Y')} - - if track.room - %br - In: #{track.room.name} - - - if @conference.program.try(:schedule_public?) + .container .row .col-md-12 - %p.cta-button.text-center - = link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do - Full Schedule + %p.lead.text-center + %span.notranslate + = @conference.title + has the most awesome program ever! - %h3.text-center - Don't miss out! - %br - - if @conference.highlighted_events.any? - .row - .col-md-12 - - @conference.highlighted_events.each_slice(2) do |slice| - .row.row-centered - - slice.each do |event| - .col-md-6.col-centered.col-top.highlights - %p.text-center - %b= event.title - %h5.text-center - = markdown truncate(event.abstract, length: 500, separator: ' ') - = link_to "Read More", conference_program_proposal_path(@conference.short_title, event) + - if @conference.highlighted_events.any? + = render 'highlights' + + - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? + = render 'tracks' + + - if @conference.program.try(:schedule_public?) + .row + .col-md-12 + %p.cta-button.text-center + = link_to(conference_schedule_path(@conference.short_title), + class: 'btn btn-success btn-lg') do + Full Schedule - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? = render 'booths' diff --git a/app/views/conferences/_tracks.haml b/app/views/conferences/_tracks.haml new file mode 100644 index 00000000..1938ab0f --- /dev/null +++ b/app/views/conferences/_tracks.haml @@ -0,0 +1,17 @@ +.row + .col-md-12 + %h3.text-center + Tracks +.row.row-centered + - @conference.confirmed_tracks.to_a.sort_by!(&:name).each do |track| + .col-md-3.col-sm-3.col-centered.col-top.track + .thumbnail + .caption + %h3.text-center + = track.name + %p.text-center + - if track.start_date && track.end_date + = date_string(track.start_date, track.end_date) + - if track.room + In #{track.room.name} + = markdown truncate(track.description, length: 200, separator: ' ') From 7ea100d2ec5daa291914f8ef3a917a493e272409 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 27 Nov 2017 20:04:54 -0800 Subject: [PATCH 15/15] Let's get serious about linting, folks. --- .haml-lint_todo.yml | 11 --- app/helpers/conference_helper.rb | 18 +++++ .../{_booths.html.haml => _booths.haml} | 4 +- app/views/conferences/_call_for_content.haml | 10 +-- .../conferences/_call_for_paper.html.haml | 30 -------- app/views/conferences/_call_for_papers.haml | 30 ++++++++ ...tracks.html.haml => _call_for_tracks.haml} | 12 ++-- .../{_footer.html.haml => _footer.haml} | 0 app/views/conferences/_header.haml | 30 ++++---- app/views/conferences/_highlights.haml | 7 +- .../{_lodging.html.haml => _lodging.haml} | 14 ++-- app/views/conferences/_program.haml | 31 +++++++++ app/views/conferences/_registration.haml | 32 +++++++++ app/views/conferences/_registration.html.haml | 33 --------- .../_schedule_splashpage.html.haml | 30 -------- app/views/conferences/_social_media.haml | 20 ++++++ app/views/conferences/_social_media.html.haml | 20 ------ .../{_sponsors.html.haml => _sponsors.haml} | 17 ++--- .../{_tickets.html.haml => _tickets.haml} | 8 +-- app/views/conferences/_tracks.haml | 2 +- app/views/conferences/_venue.haml | 44 ++++++++++++ app/views/conferences/_venue.html.haml | 38 ---------- .../{_venue_map.html.haml => _venue_map.haml} | 25 +++++-- ...arker.html.haml => _venue_map_marker.haml} | 0 app/views/conferences/show.html.haml | 30 ++++---- spec/helpers/conference_helper_spec.rb | 69 +++++++++++++++++++ 26 files changed, 335 insertions(+), 230 deletions(-) create mode 100644 app/helpers/conference_helper.rb rename app/views/conferences/{_booths.html.haml => _booths.haml} (84%) delete mode 100644 app/views/conferences/_call_for_paper.html.haml create mode 100644 app/views/conferences/_call_for_papers.haml rename app/views/conferences/{_call_for_tracks.html.haml => _call_for_tracks.haml} (54%) rename app/views/conferences/{_footer.html.haml => _footer.haml} (100%) rename app/views/conferences/{_lodging.html.haml => _lodging.haml} (76%) create mode 100644 app/views/conferences/_program.haml create mode 100644 app/views/conferences/_registration.haml delete mode 100644 app/views/conferences/_registration.html.haml delete mode 100644 app/views/conferences/_schedule_splashpage.html.haml create mode 100644 app/views/conferences/_social_media.haml delete mode 100644 app/views/conferences/_social_media.html.haml rename app/views/conferences/{_sponsors.html.haml => _sponsors.haml} (59%) rename app/views/conferences/{_tickets.html.haml => _tickets.haml} (73%) create mode 100644 app/views/conferences/_venue.haml delete mode 100644 app/views/conferences/_venue.html.haml rename app/views/conferences/{_venue_map.html.haml => _venue_map.haml} (53%) rename app/views/conferences/{_venue_map_marker.html.haml => _venue_map_marker.haml} (100%) create mode 100644 spec/helpers/conference_helper_spec.rb diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index b79ddc17..54b6d85d 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -121,20 +121,9 @@ linters: - "app/views/conference_registrations/_registration_info.html.haml" - "app/views/conference_registrations/_volunteer.html.haml" - "app/views/conference_registrations/show.html.haml" - - "app/views/conferences/_booths.html.haml" - - "app/views/conferences/_call_for_paper.html.haml" - "app/views/conferences/_conference_details.html.haml" - "app/views/conferences/_gallery.html.haml" - - "app/views/conferences/_lodging.html.haml" - - "app/views/conferences/_program.html.haml" - - "app/views/conferences/_registration.html.haml" - - "app/views/conferences/_schedule_splashpage.html.haml" - - "app/views/conferences/_sponsors.html.haml" - - "app/views/conferences/_tickets.html.haml" - - "app/views/conferences/_venue.html.haml" - - "app/views/conferences/_venue_map.html.haml" - "app/views/conferences/index.html.haml" - - "app/views/conferences/show.html.haml" - "app/views/devise/confirmations/new.html.haml" - "app/views/devise/ichain_sessions/new.html.haml" - "app/views/devise/ichain_sessions/new_test.html.haml" diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb new file mode 100644 index 00000000..3909ce92 --- /dev/null +++ b/app/helpers/conference_helper.rb @@ -0,0 +1,18 @@ +module ConferenceHelper + # Return true if only call_for_papers or call_for_tracks is open + def one_call_open(conference) + conference.call_for_events.try(:open?) ^ + conference.call_for_tracks.try(:open?) + end + + # URL for sponsorship emails + def sponsorship_mailto(conference) + [ + 'mailto:', + conference.contact.sponsor_email, + '?subject=', + url_encode(conference.short_title), + '%20Sponsorship' + ].join + end +end diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.haml similarity index 84% rename from app/views/conferences/_booths.html.haml rename to app/views/conferences/_booths.haml index e701b56e..246f9cc1 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.haml @@ -1,11 +1,11 @@ -- cache [@conference.confirmed_booths, '#splash#booths'] do +- cache [conference.confirmed_booths, '#splash#booths'] do %section#booths .container .row .col-md-12.text-center %h2 Booths .row.row-centered - - @conference.confirmed_booths.each do |booth| + - conference.confirmed_booths.each do |booth| .col-md-2.col-sm-2.col-centered.col-top %a.thumbnail{ href: '#', data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } } diff --git a/app/views/conferences/_call_for_content.haml b/app/views/conferences/_call_for_content.haml index 7f8703c4..4ad6c855 100644 --- a/app/views/conferences/_call_for_content.haml +++ b/app/views/conferences/_call_for_content.haml @@ -5,10 +5,10 @@ %section#call .container .row - - if @conference.call_for_events.try(:open?) ^ @conference.call_for_tracks.try(:open?) + - if one_call_open(conference) .col-md-3.col-sm-3.hidden-xs   - - if @conference.call_for_events.try(:open?) - = render 'call_for_paper' + - if conference.call_for_events.try(:open?) + = render 'call_for_papers', conference: conference .col-md-2.col-sm-2   - - if @conference.call_for_tracks.try(:open?) - = render 'call_for_tracks' + - if conference.call_for_tracks.try(:open?) + = render 'call_for_tracks', conference: conference diff --git a/app/views/conferences/_call_for_paper.html.haml b/app/views/conferences/_call_for_paper.html.haml deleted file mode 100644 index 09203e75..00000000 --- a/app/views/conferences/_call_for_paper.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- cache [@conference, @conference.call_for_events, @conference.confirmed_tracks, - '#splash#callforpapers'] do - .col-md-5.col-sm-5.text-center - %h2 - Call for Papers - %p.lead - We are now accepting proposals for sessions! - %p - - if @conference.event_types.any? - You can submit proposals for - %span.notranslate - = "#{event_types(@conference)}." - - if @conference.confirmed_tracks.any? - Proposals should fit in one of the - %span.notranslate - = "#{pluralize(@conference.confirmed_tracks.length, 'track')}:" - = "#{tracks(@conference)}." - - if @conference.call_for_events.try(:open?) - The submission period is open - %em.notranslate - = "#{date_string(@conference.call_for_events.start_date, - @conference.call_for_events.end_date)}." - %b - You have - = pluralize(@conference.call_for_events.remaining_days, 'day') - left! - %p.cta-button - = link_to "Submit your proposal now", - conference_program_proposals_path(@conference.short_title), - class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_call_for_papers.haml b/app/views/conferences/_call_for_papers.haml new file mode 100644 index 00000000..b4cdfdf6 --- /dev/null +++ b/app/views/conferences/_call_for_papers.haml @@ -0,0 +1,30 @@ +- cache [conference, conference.call_for_events, conference.confirmed_tracks, + '#splash#callforpapers'] do + .col-md-5.col-sm-5.text-center + %h2 + Call for Papers + %p.lead + We are now accepting proposals for sessions! + %p + - if conference.event_types.any? + You can submit proposals for + %span.notranslate + = event_types(conference) + '.' + - if conference.confirmed_tracks.any? + Proposals should fit in one of the + %span.notranslate + = pluralize(conference.confirmed_tracks.length, 'track') + ':' + = tracks(conference)} + '.' + - if conference.call_for_events.try(:open?) + The submission period is open + %em.notranslate + = date_string(conference.call_for_events.start_date, + conference.call_for_events.end_date) + '.' + %b + You have + = pluralize(conference.call_for_events.remaining_days, 'day') + left! + %p.cta-button + = link_to "Submit your proposal now", + conference_program_proposals_path(conference.short_title), + class: 'btn btn-success btn-lg text-center' diff --git a/app/views/conferences/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.haml similarity index 54% rename from app/views/conferences/_call_for_tracks.html.haml rename to app/views/conferences/_call_for_tracks.haml index 092c2740..59681f71 100644 --- a/app/views/conferences/_call_for_tracks.html.haml +++ b/app/views/conferences/_call_for_tracks.haml @@ -1,4 +1,4 @@ -- cache [@conference, @conference.call_for_tracks, '#splash#callfortracks'] do +- cache [conference, conference.call_for_tracks, '#splash#callfortracks'] do .col-md-5.col-sm-5.text-center %h2 Call for Tracks @@ -7,14 +7,14 @@ %p Would you like to host a mini-summit, sub-conference, or hack space? The submission period for track requests is open - %em.notranslate - = "#{date_string(@conference.call_for_tracks.start_date, - @conference.call_for_tracks.end_date)}." + %em + = date_string(conference.call_for_tracks.start_date, + conference.call_for_tracks.end_date) + '.' %b You have - = pluralize(@conference.call_for_tracks.remaining_days, 'day') + = pluralize(conference.call_for_tracks.remaining_days, 'day') left! %p.cta-button = link_to("Submit your request for track", - conference_program_tracks_path(@conference.short_title), + conference_program_tracks_path(conference.short_title), class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/_footer.html.haml b/app/views/conferences/_footer.haml similarity index 100% rename from app/views/conferences/_footer.html.haml rename to app/views/conferences/_footer.haml diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 9aeacc26..03cee2ec 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,33 +1,37 @@ -- cache [@conference, @conference.venue, '#splash#header'] do +- cache [conference, conference.venue, '#splash#header'] do #banner .container .row .col-md-8.col-md-offset-2#header .row .col-md-4 - = image_tag(@conference.picture_url, class: 'img-responsive img-center', id: 'splash-logo') if @conference.picture? + - if conference.picture? + = image_tag(conference.picture_url, + class: 'img-responsive img-center', + id: 'splash-logo') .col-md-8 %h1 - = @conference.title + = conference.title %h3 - - if @conference.start_date && @conference.end_date + - if conference.start_date && conference.end_date %span.date.text-nowrap - = date_string(@conference.start_date, @conference.end_date) + = date_string(conference.start_date, conference.end_date) • - - if @conference.venue + - if conference.venue %span.venue.text-nowrap - - if @conference.venue.website - = sanitize link_to(@conference.venue.name, @conference.venue.website) + - if conference.venue.website + = sanitize link_to(conference.venue.name, + conference.venue.website) - else - = @conference.venue.city - - if @conference.venue.country_name != 'US' + = conference.venue.city + - if conference.venue.country_name != 'US' • - = @conference.venue.country_name + = conference.venue.country_name - - unless @conference.description.blank? + - unless conference.description.blank? %section#about .container .row .col-md-8.col-md-offset-2 %h3.text-center - = markdown(@conference.description) + = markdown(conference.description) diff --git a/app/views/conferences/_highlights.haml b/app/views/conferences/_highlights.haml index 0ea1eb99..6e610370 100644 --- a/app/views/conferences/_highlights.haml +++ b/app/views/conferences/_highlights.haml @@ -5,11 +5,12 @@ .row .col-md-12 .row.row-centered - - @conference.highlighted_events.each do |event| + - conference.highlighted_events.each do |event| - speaker = event.speakers_ordered.first .col-md-3.col-sm-3.col-centered.col-top.highlights - = link_to conference_program_proposal_path(@conference.short_title, event), - class: 'thumbnail' do + = link_to(conference_program_proposal_path(conference.short_title, + event), + class: 'thumbnail') do = image_tag speaker.gravatar_url(size: 300), class: ['img-responsive', 'img-circle'], title: speaker.name diff --git a/app/views/conferences/_lodging.html.haml b/app/views/conferences/_lodging.haml similarity index 76% rename from app/views/conferences/_lodging.html.haml rename to app/views/conferences/_lodging.haml index 4859b8f5..301dd142 100644 --- a/app/views/conferences/_lodging.html.haml +++ b/app/views/conferences/_lodging.haml @@ -2,25 +2,25 @@ %li %a.smoothscroll{ href: '#lodging' } Lodging -- cache [@conference.venue, @conference.lodgings, '#splash#lodging'] do +- cache [conference.venue, conference.lodgings, '#splash#lodging'] do %section#lodging .container .row .col-md-12.text-center %h2 Where to stay - - if @conference.venue + - if conference.venue in - = @conference.venue.city + = conference.venue.city %p.lead We recommend the following accommodations for your visit. .row.row-centered - - @conference.lodgings.each do |lodging| + - conference.lodgings.each do |lodging| .col-md-4.col-sm-4.col-centered.col-top .thumbnail - if lodging.picture? - -if lodging.website_link.present? + - if lodging.website_link.present? = link_to(lodging.website_link, class: 'thumbnail') do = image_tag lodging.picture.large.url, class: 'img-responsive img-lodging' @@ -29,7 +29,7 @@ class: 'img-responsive img-lodging' - else %p.text-center - -if lodging.website_link.present? + - if lodging.website_link.present? = link_to(lodging.website_link, class: 'thumbnail') do %i.fa.fa-home.fa-5x - else @@ -37,5 +37,5 @@ .caption %h3.text-center = lodging.name - -if lodging.description.present? + - if lodging.description.present? = markdown(lodging.description) diff --git a/app/views/conferences/_program.haml b/app/views/conferences/_program.haml new file mode 100644 index 00000000..69931eda --- /dev/null +++ b/app/views/conferences/_program.haml @@ -0,0 +1,31 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#schedule' } Schedule + +- cache [@confererence, conference.confirmed_tracks, '#splash#schedule'] do + %section#schedule + .container + .row + .col-md-12 + %p.lead.text-center + %span.notranslate + = conference.title + has the most awesome program ever! + + - if conference.highlighted_events.any? + = render 'highlights', conference: conference + + - if conference.splashpage.include_tracks + - if conference.confirmed_tracks.any? + = render 'tracks', conference: conference + + - if conference.program.try(:schedule_public?) + .row + .col-md-12 + %p.cta-button.text-center + = link_to(conference_schedule_path(conference.short_title), + class: 'btn btn-success btn-lg') do + Full Schedule + +- if conference.splashpage.include_booths && conference.confirmed_booths.any? + = render 'booths', conference: conference diff --git a/app/views/conferences/_registration.haml b/app/views/conferences/_registration.haml new file mode 100644 index 00000000..c9644f23 --- /dev/null +++ b/app/views/conferences/_registration.haml @@ -0,0 +1,32 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#registration' } Registration + +- cache [conference.registration_period, conference.tickets, + '#splash#registration'] do + %section#registration + .container + .row + .col-md-12.text-center + %h1 Registration + - if conference.registration_limit_exceeded? + %p + Sorry, the conference registration limit has exceeded + - elsif conference.tickets.empty? + %p.lead + Going to + = conference.short_title + is free of charge. + %p + We only ask you to register yourself before + = date_string(conference.registration_period.end_date) + so we can plan for the right amount of people. + %p.cta-button + - else + %p + The registration period ends on + = date_string(conference.registration_period.end_date) + %p.cta-button + = link_to('Register Now', + new_conference_conference_registration_path(conference.short_title), + class: 'btn btn-lg btn-success') do diff --git a/app/views/conferences/_registration.html.haml b/app/views/conferences/_registration.html.haml deleted file mode 100644 index b9b27f08..00000000 --- a/app/views/conferences/_registration.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#registration' } Registration - -- cache [@conference.registration_period, @conference.tickets, '#splash#registration'] do - %section#registration - .container - .row - .col-md-12.text-center - %h1 Registration - - - if @conference.registration_limit_exceeded? - %p - Sorry, the conference registration limit has exceeded - - else - - if @conference.tickets.empty? - %p.lead - Going to - = @conference.short_title - is free of charge. - %p - We only ask you to register yourself before - = date_string(@conference.registration_period.end_date) - so we can plan for the right amount of people. - %p.cta-button - - else - %p - The registration period ends on - = date_string(@conference.registration_period.end_date) - %p.cta-button - = link_to(new_conference_conference_registration_path(@conference.short_title), - class: 'btn btn-lg btn-success') do - Register Now diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml deleted file mode 100644 index 075fff32..00000000 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#schedule' } Schedule - -- cache [@confererence, @conference.confirmed_tracks, '#splash#schedule'] do - %section#schedule - .container - .row - .col-md-12 - %p.lead.text-center - %span.notranslate - = @conference.title - has the most awesome program ever! - - - if @conference.highlighted_events.any? - = render 'highlights' - - - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? - = render 'tracks' - - - if @conference.program.try(:schedule_public?) - .row - .col-md-12 - %p.cta-button.text-center - = link_to(conference_schedule_path(@conference.short_title), - class: 'btn btn-success btn-lg') do - Full Schedule - -- if @conference.splashpage.include_booths && @conference.confirmed_booths.any? - = render 'booths' diff --git a/app/views/conferences/_social_media.haml b/app/views/conferences/_social_media.haml new file mode 100644 index 00000000..d227c54a --- /dev/null +++ b/app/views/conferences/_social_media.haml @@ -0,0 +1,20 @@ +- cache [conference.contact, '#splash#social'] do + %section#social-media + .container + .row + .col-md-12.text-center + - unless conference.contact.facebook.blank? + = link_to "#{ conference.contact.facebook }" do + %i.fa.fa-facebook-square.fa-4x + - unless conference.contact.twitter.blank? + = link_to "#{ conference.contact.twitter }" do + %i.fa.fa-twitter.fa-4x + - unless conference.contact.instagram.blank? + = link_to "#{ conference.contact.instagram }" do + %i.fa.fa-instagram.fa-4x + - unless conference.contact.googleplus.blank? + = link_to "#{ conference.contact.googleplus }" do + %i.fa.fa-google-plus-square.fa-4x + - unless conference.contact.email.blank? + = mail_to "#{ conference.contact.email }" do + %i.fa.fa-envelope-o.fa-4x diff --git a/app/views/conferences/_social_media.html.haml b/app/views/conferences/_social_media.html.haml deleted file mode 100644 index 4d3a5c4f..00000000 --- a/app/views/conferences/_social_media.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -- cache [@conference.contact, '#splash#social'] do - %section#social-media - .container - .row - .col-md-12.text-center - - unless @conference.contact.facebook.blank? - = link_to "#{ @conference.contact.facebook }" do - %i.fa.fa-facebook-square.fa-4x - - unless @conference.contact.twitter.blank? - = link_to "#{ @conference.contact.twitter }" do - %i.fa.fa-twitter.fa-4x - - unless @conference.contact.instagram.blank? - = link_to "#{ @conference.contact.instagram }" do - %i.fa.fa-instagram.fa-4x - - unless @conference.contact.googleplus.blank? - = link_to "#{ @conference.contact.googleplus }" do - %i.fa.fa-google-plus-square.fa-4x - - unless @conference.contact.email.blank? - = mail_to "#{ @conference.contact.email }" do - %i.fa.fa-envelope-o.fa-4x diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.haml similarity index 59% rename from app/views/conferences/_sponsors.html.haml rename to app/views/conferences/_sponsors.haml index 571069ae..9c466125 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.haml @@ -2,11 +2,12 @@ %li %a.smoothscroll{ href: '#sponsors' } Sponsors -- cache [@conference, @conference.sponsors, @conference.try(:call_for_sponsors), '#splash#sponsors'] do +- cache [conference, conference.sponsors, conference.try(:call_for_sponsors), + '#splash#sponsors'] do %section#sponsors .container - - @conference.sponsorship_levels.each do |sponsorship_level| - -if sponsorship_level.sponsors.any? + - conference.sponsorship_levels.each do |sponsorship_level| + - if sponsorship_level.sponsors.any? .row.text-center %h3 = sponsorship_level.title @@ -14,19 +15,19 @@ .row.row-centered - sponsorship_level.sponsors.each do |sponsor| .col-md-4.col-sm-4.col-centered.col-top - %a{ href: '#', - data: { toggle: 'modal', target: "#modal-sponsor-#{sponsor.id}" } } + %a{ href: '#', data: { toggle: 'modal', + target: "#modal-sponsor-#{sponsor.id}" } } = image_tag get_logo(sponsor), class: ['img-responsive', 'img-sponsor', "img-sponsor-#{sponsorship_level.position}"], title: sponsor.name = render 'modal_description', object: sponsor - - if @conference.call_for_sponsors.try(:open?) + - if conference.call_for_sponsors.try(:open?) .row .col-md-12 %p.text-muted.text-center %small - Want to sponsor #{@conference.short_title}? - = link_to("mailto: #{@conference.contact.sponsor_email}?subject=#{@conference.short_title}%20Sponsorship") do + Want to sponsor #{conference.short_title}? + = link_to(sponsorship_mailto(conference)) do Please contact us! diff --git a/app/views/conferences/_tickets.html.haml b/app/views/conferences/_tickets.haml similarity index 73% rename from app/views/conferences/_tickets.html.haml rename to app/views/conferences/_tickets.haml index a01ad676..ce4ca802 100644 --- a/app/views/conferences/_tickets.html.haml +++ b/app/views/conferences/_tickets.haml @@ -2,18 +2,18 @@ %li %a.smoothscroll{ href: '#tickets' } Tickets -- cache [@conference, @conference.tickets, '#splash#tickets'] do +- cache [conference, conference.tickets, '#splash#tickets'] do %section#tickets .container .row .col-md-12.text-center %h2 Support - =@conference.title + = conference.title .row.row-centered - - @conference.tickets.each do |ticket| + - conference.tickets.each do |ticket| .col-md-3.col-sm-3.col-centered.col-top - = link_to(conference_tickets_path(@conference.short_title), + = link_to(conference_tickets_path(conference.short_title), class: 'thumbnail') do .caption %h3.text-center diff --git a/app/views/conferences/_tracks.haml b/app/views/conferences/_tracks.haml index 1938ab0f..06d721fc 100644 --- a/app/views/conferences/_tracks.haml +++ b/app/views/conferences/_tracks.haml @@ -3,7 +3,7 @@ %h3.text-center Tracks .row.row-centered - - @conference.confirmed_tracks.to_a.sort_by!(&:name).each do |track| + - conference.confirmed_tracks.to_a.sort_by!(&:name).each do |track| .col-md-3.col-sm-3.col-centered.col-top.track .thumbnail .caption diff --git a/app/views/conferences/_venue.haml b/app/views/conferences/_venue.haml new file mode 100644 index 00000000..c88695ac --- /dev/null +++ b/app/views/conferences/_venue.haml @@ -0,0 +1,44 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#venue' } Venue + +- cache [conference.venue, conference.venue.commercial, '#splash#venue'] do + %section#venue + - if conference.venue.location? + = render '/conferences/venue_map', conference: conference + - else + .container + .row + .col-md-6 + .thumbnail#venue-pic + - if commercial = conference.venue.commercial + .flexvideo{ id: "resource-content-#{commercial.id}" } + = render 'shared/media_item', + commercial: commercial + - elsif conference.venue.picture? + = image_tag conference.venue.picture.url, + title: conference.venue.name, class: "img-responsive" + - else + %p.text-center + %span.fa.fa-university.fa-5x + .caption + %h3.text-center + = conference.venue.name + - unless conference.venue.description.blank? + = markdown(conference.venue.description) + .col-md-6 + %h2 + = conference.venue.city + \/ + = conference.venue.country_name + %address + = conference.venue.street + %br + = conference.venue.postalcode + ',' + = conference.venue.city + %br + = conference.venue.country_name + - if conference.venue.website + %br + = sanitize link_to(h(conference.venue.website), + h(conference.venue.website)) diff --git a/app/views/conferences/_venue.html.haml b/app/views/conferences/_venue.html.haml deleted file mode 100644 index 0c7ef254..00000000 --- a/app/views/conferences/_venue.html.haml +++ /dev/null @@ -1,38 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#venue' } Venue - -- cache [@conference.venue, @conference.venue.commercial, '#splash#venue'] do - %section#venue - -if @conference.venue.location? - = render '/conferences/venue_map' - -else - .container - .row - .col-md-6 - .thumbnail#venue-pic - - if @conference.venue.commercial.present? and @conference.venue.commercial.persisted? - .flexvideo{ id: "resource-content-#{@conference.venue.commercial.id}"} - = render partial: 'shared/media_item', locals: { commercial: @conference.venue.commercial } - - elsif @conference.venue.picture? - = image_tag @conference.venue.picture.url, alt: @conference.venue.name, class:"img-responsive" - - else - %p.text-center - %span.fa.fa-university.fa-5x - .caption - %h3.text-center - = @conference.venue.name - - unless @conference.venue.description.blank? - = markdown(@conference.venue.description) - .col-md-6 - %h2 - = "#{@conference.venue.city} / #{@conference.venue.country_name}" - %address - = @conference.venue.street - %br - = "#{@conference.venue.postalcode}, #{@conference.venue.city}" - %br - = @conference.venue.country_name - - if @conference.venue.website - %br - =link_to(h(@conference.venue.website), h(@conference.venue.website)).html_safe diff --git a/app/views/conferences/_venue_map.html.haml b/app/views/conferences/_venue_map.haml similarity index 53% rename from app/views/conferences/_venue_map.html.haml rename to app/views/conferences/_venue_map.haml index 708d5e46..e4e56ea3 100644 --- a/app/views/conferences/_venue_map.html.haml +++ b/app/views/conferences/_venue_map.haml @@ -1,16 +1,29 @@ -#map{style: "height: 500px;" } +#map{ style: "height: 500px;" } - content_for(:script_body) do + - marker = escape_javascript(render '/conferences/venue_map_marker', + venue: conference.venue) :javascript // create a map in the "map" div, set the view to a given place and zoom - var map = L.map('map', { scrollWheelZoom: false }).setView([#{@conference.venue.latitude.to_f + 0.05}, #{h(@conference.venue.longitude)}], 11); + var map = L.map('map', { scrollWheelZoom: false }).setView( + [ + #{conference.venue.latitude.to_f + 0.05}, + #{h(conference.venue.longitude)} + ], 11); // add an OpenStreetMap tile layer L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', + attribution: 'Map data © \ + OpenStreetMap contributors, \ + CC-BY-SA, \ + Imagery © Mapbox', maxZoom: 18 }).addTo(map); - // add a marker in the given location, attach some popup content to it and open the popup - L.marker([#{h @conference.venue.latitude}, #{h @conference.venue.longitude}]).addTo(map) - .bindPopup("#{escape_javascript(render '/conferences/venue_map_marker', venue: @conference.venue)}") + // add a marker in the given location, attach some popup content to it + // and open the popup + L.marker([ + #{h conference.venue.latitude}, + #{h conference.venue.longitude} + ]).addTo(map) + .bindPopup("#{marker}") .openPopup(); // Turn scrollwheel on when user clicks map.on('focus', function(e) { diff --git a/app/views/conferences/_venue_map_marker.html.haml b/app/views/conferences/_venue_map_marker.haml similarity index 100% rename from app/views/conferences/_venue_map_marker.html.haml rename to app/views/conferences/_venue_map_marker.haml diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 3905b3a4..ac0fc854 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -12,33 +12,35 @@ #splash // header/description - = render 'header' + = render 'header', conference: @conference // attendance/registration - - if @conference.splashpage.include_registrations && @conference.registration_open? - = render 'registration' - - if @conference.splashpage.include_tickets && @conference.tickets.any? && @conference.pending? - = render 'tickets' + - if @conference.splashpage.include_registrations + - if @conference.registration_open? + = render 'registration', conference: @conference + - if @conference.splashpage.include_tickets && @conference.tickets.any? + = render 'tickets', conference: @conference // calls for content, or program - if @conference.splashpage.include_cfp - = render 'call_for_content' + = render 'call_for_content', conference: @conference - if @conference.splashpage.include_program - = render 'schedule_splashpage' + = render 'program', conference: @conference // geo - if @conference.splashpage.include_venue && @conference.venue - = render 'venue' + = render 'venue', conference: @conference - if @conference.splashpage.include_lodgings && @conference.lodgings.any? - = render 'lodging' + = render 'lodging', conference: @conference // sponsorship - if @conference.splashpage.include_sponsors - = render 'sponsors' + = render 'sponsors', conference: @conference // footer - - if @conference.splashpage.include_social_media && @conference.contact.has_social_media? - = render 'social_media' + - if @conference.splashpage.include_social_media + - if @conference.contact.has_social_media? + = render 'social_media', conference: @conference = render 'footer' = yield :modals @@ -47,7 +49,9 @@ - content_for :script_head do :javascript var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); - var triangle_colors = triangle_tcs.map(function(t) { return t.toHexString(); }); + var triangle_colors = triangle_tcs.map(function(t) { + return t.toHexString(); + }); $(function () { $(document).ready(function() { var triangle_width = document.body.clientWidth; diff --git a/spec/helpers/conference_helper_spec.rb b/spec/helpers/conference_helper_spec.rb new file mode 100644 index 00000000..2ed5517e --- /dev/null +++ b/spec/helpers/conference_helper_spec.rb @@ -0,0 +1,69 @@ +require 'spec_helper' + +describe ConferenceHelper, type: :helper do + let!(:conference) { create(:conference) } + let!(:contact) { create(:contact, conference: conference) } + + describe '#one_call_open' do + it 'is falsey if neither call is open' do + expect(one_call_open(conference)).to be_falsey + end + + it 'is truthy if call_for_papers is open' do + create( + :cfp, + program: conference.program, + cfp_type: 'events', + start_date: conference.start_date, + end_date: conference.end_date + ) + + expect(one_call_open(conference)).to be_truthy + end + + it 'is truthy if call_for_tracks is open' do + create( + :cfp, + program: conference.program, + cfp_type: 'tracks', + start_date: conference.start_date, + end_date: conference.end_date + ) + + expect(one_call_open(conference)).to be_truthy + end + + it 'is falsey if both calls are open' do + create( + :cfp, + program: conference.program, + cfp_type: 'events', + start_date: conference.start_date, + end_date: conference.end_date + ) + create( + :cfp, + program: conference.program, + cfp_type: 'tracks', + start_date: conference.start_date, + end_date: conference.end_date + ) + + expect(one_call_open(conference)).to be_falsey + end + end + + describe '#sponsorship_mailto' do + it 'constructs a mailto URL' do + expect(sponsorship_mailto(conference)).to match 'mailto:' + end + + it 'points to the conference sponsor address' do + expect(sponsorship_mailto(conference)).to match contact.sponsor_email + end + + it 'includes a conference identifier' do + expect(sponsorship_mailto(conference)).to match conference.short_title + end + end +end