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/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..45ee345a 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) @@ -288,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) @@ -585,6 +586,7 @@ DEPENDENCIES country_select coveralls daemons + dalli database_cleaner delayed_job_active_record devise 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 +} 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..4407056a 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 @@ -191,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/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/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/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/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/_booths.haml b/app/views/conferences/_booths.haml new file mode 100644 index 00000000..246f9cc1 --- /dev/null +++ b/app/views/conferences/_booths.haml @@ -0,0 +1,19 @@ +- 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| + .col-md-2.col-sm-2.col-centered.col-top + %a.thumbnail{ href: '#', + data: { toggle: 'modal', target: "#modal-booth-#{booth.id}" } } + - if booth.picture? + = 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/_booths.html.haml b/app/views/conferences/_booths.html.haml deleted file mode 100644 index b40af9b8..00000000 --- a/app/views/conferences/_booths.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#booths' } Booths - -.container - .row - .col-md-12.text-center - %h2 Booths - - @conference.booths.confirmed.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_descrition_#{index_for_row}_#{index_for_column}", "data-toggle"=>"collapse" do - learn more - .collapse{ id: "show_descrition_#{index_for_row}_#{index_for_column}" } - = markdown(booth.description) diff --git a/app/views/conferences/_call_for_content.haml b/app/views/conferences/_call_for_content.haml new file mode 100644 index 00000000..4ad6c855 --- /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 one_call_open(conference) + .col-md-3.col-sm-3.hidden-xs   + - 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', 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 289c3d9e..00000000 --- a/app/views/conferences/_call_for_paper.html.haml +++ /dev/null @@ -1,43 +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 - %span.notranslate - = "#{event_types(@conference)}." - - if @conference.program.tracks.any? - Proposals should fit in one of the - %span.notranslate - = "#{pluralize(@conference.program.tracks.count, '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! - Remember - %span.notranslate - = @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_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.haml b/app/views/conferences/_call_for_tracks.haml new file mode 100644 index 00000000..59681f71 --- /dev/null +++ b/app/views/conferences/_call_for_tracks.haml @@ -0,0 +1,20 @@ +- cache [conference, conference.call_for_tracks, '#splash#callfortracks'] do + .col-md-5.col-sm-5.text-center + %h2 + Call for Tracks + %p.lead + 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 + = 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/_call_for_tracks.html.haml b/app/views/conferences/_call_for_tracks.html.haml deleted file mode 100644 index 1abeb956..00000000 --- a/app/views/conferences/_call_for_tracks.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= content_for :splash_nav do - %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 has begun - %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') - 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' 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 new file mode 100644 index 00000000..03cee2ec --- /dev/null +++ b/app/views/conferences/_header.haml @@ -0,0 +1,37 @@ +- cache [conference, conference.venue, '#splash#header'] do + #banner + .container + .row + .col-md-8.col-md-offset-2#header + .row + .col-md-4 + - if conference.picture? + = image_tag(conference.picture_url, + class: 'img-responsive img-center', + id: 'splash-logo') + .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/_highlights.haml b/app/views/conferences/_highlights.haml new file mode 100644 index 00000000..6e610370 --- /dev/null +++ b/app/views/conferences/_highlights.haml @@ -0,0 +1,19 @@ +.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/_lodging.haml b/app/views/conferences/_lodging.haml new file mode 100644 index 00000000..301dd142 --- /dev/null +++ b/app/views/conferences/_lodging.haml @@ -0,0 +1,41 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#lodging' } Lodging + +- cache [conference.venue, conference.lodgings, '#splash#lodging'] do + %section#lodging + .container + .row + .col-md-12.text-center + %h2 + Where to stay + - if conference.venue + in + = conference.venue.city + %p.lead + We recommend the following 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 + - 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/_lodging.html.haml b/app/views/conferences/_lodging.html.haml deleted file mode 100644 index 561e2421..00000000 --- a/app/views/conferences/_lodging.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -= content_for :splash_nav do - %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. - - .row.row-centered{ style:"display: flex; flex-wrap: wrap" } - - @conference.lodgings.each do |lodging| - .col-md-4.col-sm-4.col-centered.col-top{ style:"display:flex;" } - .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 - - 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/_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/_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/_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.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 5614bdba..00000000 --- a/app/views/conferences/_registration.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#registration' } 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 diff --git a/app/views/conferences/_schedule_splashpage.html.haml b/app/views/conferences/_schedule_splashpage.html.haml deleted file mode 100644 index 790582cb..00000000 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ /dev/null @@ -1,57 +0,0 @@ -.container - .row - .col-md-12 - %h2.text-center - Program - %p.lead.text-center - %span.notranslate - = @conference.short_title - has the most awesome program ever! - - if @conference.splashpage and @conference.program.tracks.any? and @conference.splashpage.include_tracks - 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} - - - if @conference.program and @conference.program.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? - .row - .col-md-12 - - @conference.program.events.highlights.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) - - = content_for :splash_nav do - %li - =link_to('#program', class: 'smoothscroll') do - Program 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 b072423f..00000000 --- a/app/views/conferences/_social_media.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -.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.haml b/app/views/conferences/_sponsors.haml new file mode 100644 index 00000000..9c466125 --- /dev/null +++ b/app/views/conferences/_sponsors.haml @@ -0,0 +1,33 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#sponsors' } Sponsors + +- 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? + .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 + + - 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(sponsorship_mailto(conference)) do + Please contact us! diff --git a/app/views/conferences/_sponsors.html.haml b/app/views/conferences/_sponsors.html.haml deleted file mode 100644 index aa7921b5..00000000 --- a/app/views/conferences/_sponsors.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -= content_for :splash_nav do - %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}" - - .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.contact and !@conference.contact.sponsor_email.blank? - .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.haml b/app/views/conferences/_tickets.haml new file mode 100644 index 00000000..ce4ca802 --- /dev/null +++ b/app/views/conferences/_tickets.haml @@ -0,0 +1,24 @@ += 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.title + .row.row-centered + - conference.tickets.each do |ticket| + .col-md-3.col-sm-3.col-centered.col-top + = 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/_tickets.html.haml b/app/views/conferences/_tickets.html.haml deleted file mode 100644 index 8a202295..00000000 --- a/app/views/conferences/_tickets.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -.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/_tracks.haml b/app/views/conferences/_tracks.haml new file mode 100644 index 00000000..06d721fc --- /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: ' ') 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 4436b0fe..00000000 --- a/app/views/conferences/_venue.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -= 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 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 9f34117f..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([#{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', + 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 dd6b2d62..ac0fc854 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,88 +11,56 @@ = @conference.title #splash - - if @conference.splashpage - #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) + // header/description + = render 'header', conference: @conference - - unless @conference.description.blank? - %section#about - .container - .row - .col-md-8.col-md-offset-2 - %h3.text-center - = markdown(@conference.description) + // attendance/registration + - 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 - - if @conference.registration_open? and @conference.splashpage.include_registrations - %section#registration - = render 'registration' + // calls for content, or program + - if @conference.splashpage.include_cfp + = render 'call_for_content', conference: @conference + - if @conference.splashpage.include_program + = render 'program', conference: @conference - - if @conference.splashpage.include_program - %section#program - = render 'schedule_splashpage' + // geo + - if @conference.splashpage.include_venue && @conference.venue + = render 'venue', conference: @conference + - if @conference.splashpage.include_lodgings && @conference.lodgings.any? + = render 'lodging', conference: @conference - - if @conference.program.cfp_open? and @conference.splashpage.include_cfp - %section#callforpapers - = render 'call_for_paper' + // sponsorship + - if @conference.splashpage.include_sponsors + = render 'sponsors', conference: @conference - - if @conference.program.cfps.for_tracks.try(:open?) && @conference.splashpage.include_cfp - %section#callfortracks - = render 'call_for_tracks' + // footer + - if @conference.splashpage.include_social_media + - if @conference.contact.has_social_media? + = render 'social_media', conference: @conference + = render 'footer' - - if @conference.venue and @conference.splashpage.include_venue - %section#venue - = render 'venue' + = yield :modals - - if @conference.lodgings.any? and @conference.splashpage.include_lodgings - %section#lodging - = render 'lodging' - - - if @conference.tickets.any? and @conference.splashpage.include_tickets and @conference.pending? - %section#tickets - = render 'tickets' - - - if @conference.booths.confirmed.any? and @conference.splashpage.include_booths - %section#booths - = render 'booths' - - - if @conference.sponsors.any? and @conference.splashpage.include_sponsors - %section#sponsors - = render 'sponsors' - - - if @conference.contact.has_social_media? and @conference.splashpage.include_social_media - %section#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() + '")'); + }); }); - }); 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 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" 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') 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/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 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