From cf3aeda1d2435067b5ca217cab28ab90932947c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Fri, 24 Nov 2017 21:41:08 +0100 Subject: [PATCH 01/46] Fixing admin user creation in docker Added db:seed in order to have the deleted user, and be able to have an admin user. --- docker/init.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/init.sh b/docker/init.sh index 3a2031f3..23188d98 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -42,6 +42,9 @@ fi echo ">>> Upgrading database..." bundle exec rake db:migrate +echo ">>> Seed database..." +bundle exec rake db:seed + rm .my.cnf echo ">>> Precompiling assets..." From e40cdeb94bdff796a59f0f275c844aa798237546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Tue, 28 Nov 2017 17:27:42 +0100 Subject: [PATCH 02/46] Update init.sh --- docker/init.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/init.sh b/docker/init.sh index 23188d98..6a29044f 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -37,14 +37,14 @@ dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s true if [ $(echo "show tables;" | mysql --host $DATABASE_HOST --port $DATABASE_PORT $MYSQL_DATABASE | wc -l) -le 1 ]; then echo ">>> Initializing database..." bundle exec rake db:schema:load + + echo ">>> Seed database..." + bundle exec rake db:seed fi echo ">>> Upgrading database..." bundle exec rake db:migrate -echo ">>> Seed database..." -bundle exec rake db:seed - rm .my.cnf echo ">>> Precompiling assets..." From 92f27561dff1d6a00768f5a0d81de39438838d8d Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Thu, 30 Nov 2017 15:55:36 -0200 Subject: [PATCH 03/46] Update current directory for centos box --- bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap.sh b/bootstrap.sh index 06a642dd..65303e37 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -54,6 +54,7 @@ elif [[ "$ID" == "centos" || "$VERSION" == "7" ]]; then tar jxvf /tmp/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /tmp/ phantomjs-2.1.1-linux-x86_64/bin/phantomjs mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin + pushd /vagrant fi echo -e "\ninstalling your bundle...\n" From fe8483b92e75a30baa947f157de5d27bc311716c Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Thu, 30 Nov 2017 17:23:51 -0200 Subject: [PATCH 04/46] Fix user to run rake task for dbsetup --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 65303e37..f23739ed 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -65,7 +65,7 @@ if [ ! -f /vagrant/config/database.yml ] && [ -f /vagrant/config/database.yml.ex echo -e "\nSetting up your database from config/database.yml...\n" cp config/database.yml.example config/database.yml if [ ! -f db/development.sqlite3 ] && [ ! -f db/test.sqlite3 ]; then - bundle exec rake db:setup + su - vagrant -c "cd /vagrant/; bundle exec rake db:setup" else echo -e "\n\nWARNING: You have already have a development/test database." echo -e "WARNING: Please make sure this database works in this vagrant box!\n\n" From e01d8493742728334e726b7dfdc7aa2599a08d4e Mon Sep 17 00:00:00 2001 From: James Mason Date: Thu, 30 Nov 2017 10:37:20 -0800 Subject: [PATCH 05/46] Add a picture format for conference tickets --- app/uploaders/picture_uploader.rb | 9 +++++++++ db/migrate/20171130172334_rebuild_conference_pictures.rb | 9 +++++++++ db/schema.rb | 2 +- spec/models/conference_spec.rb | 4 ++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171130172334_rebuild_conference_pictures.rb diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index b17f0d76..76cf0708 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -80,6 +80,11 @@ class PictureUploader < CarrierWave::Uploader::Base process resize_and_pad: [320, 120, 'white'] end + version :ticket, if: :conference? + version :ticket do + process resize_and_pad: [120, 70] + end + # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_white_list @@ -95,4 +100,8 @@ class PictureUploader < CarrierWave::Uploader::Base def sponsor?(_picture) object_class_name == 'sponsors' end + + def conference?(_picture) + object_class_name == 'conferences' + end end diff --git a/db/migrate/20171130172334_rebuild_conference_pictures.rb b/db/migrate/20171130172334_rebuild_conference_pictures.rb new file mode 100644 index 00000000..a8d74bce --- /dev/null +++ b/db/migrate/20171130172334_rebuild_conference_pictures.rb @@ -0,0 +1,9 @@ +class RebuildConferencePictures < ActiveRecord::Migration + def up + Conference.all.each do |conference| + conference.picture.recreate_versions! + end + end + + def down; end +end diff --git a/db/schema.rb b/db/schema.rb index de53720a..6df61a48 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171118113113) do +ActiveRecord::Schema.define(version: 20171130172334) do create_table "ahoy_events", force: :cascade do |t| t.integer "visit_id" diff --git a/spec/models/conference_spec.rb b/spec/models/conference_spec.rb index 26070134..0af13eed 100755 --- a/spec/models/conference_spec.rb +++ b/spec/models/conference_spec.rb @@ -1704,4 +1704,8 @@ describe Conference do it { is_expected.to eq [past_conference1, past_conference2] } end + + it 'should have a picture format for tickets' do + expect(create(:conference).picture.ticket.url) + end end From 710010cb7611466a51961ad9b746c5e94629b6f4 Mon Sep 17 00:00:00 2001 From: James Mason Date: Thu, 30 Nov 2017 10:40:02 -0800 Subject: [PATCH 06/46] Use a picture format for ticketing Instead of analyzing image size using the local file, rely on a processed image of the appropriate dimensions. Resolves #1828 --- app/pdfs/ticket_pdf.rb | 18 +++++++++++++----- app/uploaders/picture_uploader.rb | 4 ---- app/views/physical_tickets/show.html.haml | 7 +------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/pdfs/ticket_pdf.rb b/app/pdfs/ticket_pdf.rb index 9a09f9fe..d21a1e27 100644 --- a/app/pdfs/ticket_pdf.rb +++ b/app/pdfs/ticket_pdf.rb @@ -1,3 +1,5 @@ +require 'open-uri' + class TicketPdf < Prawn::Document def initialize(conference, user, physical_ticket, ticket_layout, file_name) super(page_layout: ticket_layout, page_size: 'A4', filename: file_name) @@ -43,11 +45,17 @@ class TicketPdf < Prawn::Document def draw_second_square move_up 150 if @conference.picture? - if 7 * @conference.picture.image[:width] > 12 * @conference.picture.image[:height] - image "#{Rails.root}/public#{@conference.picture_url}", at: [@mid_horizontal + 30, cursor], width: 120 - else - image "#{Rails.root}/public#{@conference.picture_url}", at: [@mid_horizontal + 30, cursor], height: 70 - end + conference_image = case @conference.picture.ticket.url[0, 4] + when 'http', 'ftp:' # CDNs + open(@conference.picture.ticket.url) + when '/sys' # local storage + open([ + Rails.root, + '/public', + @conference.picture.ticket.url + ].join) + end + image conference_image, at: [@mid_horizontal + 30, cursor] else image "#{Rails.root}/public/img/osem-logo.png", at: [@mid_horizontal + 30, cursor], height: 70 end diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 76cf0708..41bcab7b 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -52,10 +52,6 @@ class PictureUploader < CarrierWave::Uploader::Base "system/#{object_class_name}/#{mounted_as}/#{model.id}" end - def image - @image ||= MiniMagick::Image.open(file.file) - end - # Create different versions of your uploaded files: version :large do process resize_to_fit: [300, 300] diff --git a/app/views/physical_tickets/show.html.haml b/app/views/physical_tickets/show.html.haml index 40513ae8..7dbc44da 100644 --- a/app/views/physical_tickets/show.html.haml +++ b/app/views/physical_tickets/show.html.haml @@ -31,12 +31,7 @@ = @user.email .col-md-5.col-md-offset-2.box.well - if @conference.picture? - - width = @conference.picture.image[:width] - - height = @conference.picture.image[:height] - - if 10 * width > 15 * height - = image_tag(@conference.picture_url, width: '150') - - else - = image_tag(@conference.picture_url, height: '100') + = image_tag(@conference.picture.ticket.url, class: 'img-responsive') - else = image_tag('/img/osem-logo.png', class: 'img-responsive') %p.text-left From 32fa0bde6ba6d0e878fd0e3d88befe81c42cfc19 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Wed, 11 Jan 2017 16:45:58 +0200 Subject: [PATCH 07/46] Add mass import of commercials Fix #1055 --- .../admin/commercials_controller.rb | 20 +++++ app/models/commercial.rb | 25 ++++++- app/views/admin/events/index.html.haml | 75 ++++++++++++------- config/routes.rb | 1 + spec/factories/commercials.rb | 2 +- spec/features/commercials_spec.rb | 3 +- 6 files changed, 97 insertions(+), 29 deletions(-) diff --git a/app/controllers/admin/commercials_controller.rb b/app/controllers/admin/commercials_controller.rb index f13b4322..3c694246 100644 --- a/app/controllers/admin/commercials_controller.rb +++ b/app/controllers/admin/commercials_controller.rb @@ -49,6 +49,26 @@ module Admin end end + ## + # Received a file from user + # Reads file and creates commercial for event + # File content example: + # EventID:MyURL + def mass_upload + errors = Commercial.read_file(params[:file]) if params[:file] + + if errors.all? { |_k, v| v.blank? } + flash[:notice] = 'Successfully added commercials.' + else + errors_text = '' + errors_text << 'Unable to find event with ID: ' + errors[:no_event].join(', ') + '. ' if errors[:no_event].any? + errors_text << 'There were some errors: ' + errors[:validation_errors].join('. ') if errors[:validation_errors].any? + + flash[:error] = errors_text + end + redirect_to :back + end + private def commercial_params diff --git a/app/models/commercial.rb b/app/models/commercial.rb index 0976fe44..ad9597e4 100644 --- a/app/models/commercial.rb +++ b/app/models/commercial.rb @@ -5,7 +5,7 @@ class Commercial < ApplicationRecord has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id } - validates :url, presence: true + validates :url, presence: true, uniqueness: { scope: :commercialable } validates :url, format: URI::regexp(%w(http https)) validate :valid_url @@ -20,6 +20,29 @@ class Commercial < ApplicationRecord end end + def self.read_file(file) + errors = {} + errors[:no_event] = [] + errors[:validation_errors] = [] + + file.read.each_line do |line| + # Get the event id (text before :) + id = line.match(/:/).pre_match.to_i + # Get the commercial url (text after :) + url = line.match(/:/).post_match + event = Event.find_by(id: id) + + # Go to next event, if the event is not found + errors[:no_event] << id && next unless event + + commercial = event.commercials.new(url: url) + unless commercial.save + errors[:validation_errors] << "Could not create commercial for event with ID #{event.id} (" + commercial.errors.full_messages.to_sentence + ')' + end + end + errors + end + private def valid_url diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index f8b58b63..be7abe05 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -4,37 +4,60 @@ %h1 Events = "(#{@events.length})" if @events.any? - .pull-right + + .btn-group.pull-right + %button.btn.btn-primary{ 'data-toggle' => 'modal', 'data-target' => '#mass-commercials-modal', title: 'Mass import of commercials for events' } + Add Commercials + - if can? :create, Event - =link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info' + = link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info' + - if can? :read, Event .btn-group - .btn-group - %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } - Export PDF - %span.caret - %ul.dropdown-menu{ role: 'menu' } - %li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all') - %li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed') - %li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments') - .btn-group - %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } - Export CSV - %span.caret - %ul.dropdown-menu{ role: 'menu' } - %li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all') - %li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'confirmed') - %li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all_with_comments') - .btn-group - %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } - Export XLS - %span.caret - %ul.dropdown-menu{ role: 'menu' } - %li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all') - %li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'confirmed') - %li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all_with_comments') + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export PDF + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all') + %li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed') + %li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export CSV + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'confirmed') + %li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all_with_comments') + .btn-group + %button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' } + Export XLS + %span.caret + %ul.dropdown-menu{ role: 'menu' } + %li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all') + %li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'confirmed') + %li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all_with_comments') + %p.text-muted All the submissions of your speakers + +.modal#mass-commercials-modal + .modal-dialog + .modal-content + .modal-header + %h1 Add commercials to events + .text-muted + Upload your file with data in the following format: + %b Event_ID:Commercial_Link + , eg. + %br + %b 11:https://youtube.com/myvideo + + .modal-body + = semantic_form_for '', url: mass_upload_commercials_admin_conference_program_path(@conference.short_title), method: :post do |f| + = f.input 'file', as: :file + .modal-footer + = f.submit 'Add', class: 'btn btn-primary' .row .col-md-4 = render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Events state', data: @event_distribution } diff --git a/config/routes.rb b/config/routes.rb index 33a92a48..4e2fca74 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -98,6 +98,7 @@ Osem::Application.routes.draw do end resources :event_types resources :difficulty_levels + post 'mass_upload_commercials' => 'commercials#mass_upload' resources :events do member do patch :toggle_attendance diff --git a/spec/factories/commercials.rb b/spec/factories/commercials.rb index 2578d1cd..cf865348 100644 --- a/spec/factories/commercials.rb +++ b/spec/factories/commercials.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :commercial do - url 'https://www.youtube.com/watch?v=BTTygyxuGj8' + sequence(:url) { |n| "https://www.youtube.com/watch?v=BTTygyxuGj#{n}" } factory :conference_commercial do association :commercialable, factory: :conference diff --git a/spec/features/commercials_spec.rb b/spec/features/commercials_spec.rb index 65efa0b6..d460a725 100644 --- a/spec/features/commercials_spec.rb +++ b/spec/features/commercials_spec.rb @@ -98,7 +98,8 @@ feature Commercial do scenario 'does not update a commercial of an event with invalid data', feature: true, versioning: true, js: true do commercial = create(:commercial, commercialable_id: event.id, - commercialable_type: 'Event') + commercialable_type: 'Event', + url: 'https://www.youtube.com/watch?v=BTTygyxuGj8') visit edit_conference_program_proposal_path(conference.short_title, event.id) click_link 'Commercials' fill_in "commercial_url_#{commercial.id}", with: 'invalid_commercial_url' From 0bfb2130a940707a6274ca2a397c645e80b03307 Mon Sep 17 00:00:00 2001 From: Alexandros Pagonis Date: Thu, 9 Nov 2017 19:26:01 +0200 Subject: [PATCH 08/46] Ticket_button added --- app/views/conference_registrations/show.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/conference_registrations/show.html.haml b/app/views/conference_registrations/show.html.haml index a50cf198..83efbd60 100644 --- a/app/views/conference_registrations/show.html.haml +++ b/app/views/conference_registrations/show.html.haml @@ -104,7 +104,9 @@ = humanized_money @total_price_per_ticket[ticket_id] %br - if @tickets.any? - = link_to 'Get more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default" + .btn-group + = link_to 'View all tickets', conference_physical_tickets_path(@conference.short_title), class: "btn btn-success" + = link_to 'Get more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default" - else You haven't bought any tickets. = link_to 'Please get some tickets to support us!', conference_tickets_path(@conference.short_title) From d813470995fc3dea8a4981827a398eb4dba7b65f Mon Sep 17 00:00:00 2001 From: Sidharth Date: Fri, 8 Dec 2017 15:03:30 +0530 Subject: [PATCH 09/46] Contribution.md broken url The link to capybara was broken in CONTRIBUTION.md file Fixes #1862 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5193725d..aa8bdbb2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ You can read through current enabled rules in `.rubocop.yml` file. Explanations Additionally you can read through the [ruby style-guide](https://github.com/bbatsov/ruby-style-guide) to better understand core principles. ### Test Suite -We are using [rspec](http://rspec.info/)+[capybara](http://jnicklas.github.io/capybara/)+[factory girl](https://github.com/thoughtbot/factory_girl) as a test suite. You can run it locally +We are using [rspec](http://rspec.info/)+[capybara](http://www.rubydoc.info/github/jnicklas/capybara)+[factory girl](https://github.com/thoughtbot/factory_girl) as a test suite. You can run it locally ```shell vagrant exec bundle exec rspec From b93613fcc586f6ae61f352414f9b7796a87a84ae Mon Sep 17 00:00:00 2001 From: Sidharth Bansal Date: Tue, 12 Dec 2017 11:45:23 +0530 Subject: [PATCH 10/46] Updated link --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa8bdbb2..bef64aab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ You can read through current enabled rules in `.rubocop.yml` file. Explanations Additionally you can read through the [ruby style-guide](https://github.com/bbatsov/ruby-style-guide) to better understand core principles. ### Test Suite -We are using [rspec](http://rspec.info/)+[capybara](http://www.rubydoc.info/github/jnicklas/capybara)+[factory girl](https://github.com/thoughtbot/factory_girl) as a test suite. You can run it locally +We are using [rspec](http://rspec.info/)+[capybara](http://teamcapybara.github.io/capybara/)+[factory girl](https://github.com/thoughtbot/factory_girl) as a test suite. You can run it locally ```shell vagrant exec bundle exec rspec From 9608e2032a0a5ebb529fa74765322859683df3c4 Mon Sep 17 00:00:00 2001 From: Thaleia Tagaraki Date: Sat, 2 Dec 2017 16:23:56 +0200 Subject: [PATCH 11/46] Add autofocus in admin/tickets#new --- app/views/admin/tickets/_form.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/tickets/_form.html.haml b/app/views/admin/tickets/_form.html.haml index 319f7996..f66cea51 100644 --- a/app/views/admin/tickets/_form.html.haml +++ b/app/views/admin/tickets/_form.html.haml @@ -9,8 +9,8 @@ .row .col-md-8 = semantic_form_for(@ticket, url: (@ticket.new_record? ? admin_conference_tickets_path : admin_conference_ticket_path(@conference.short_title, @ticket))) do |f| - = f.input :title - = f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } } + = f.input :title, input_html: { autofocus: true } + = f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :price = f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY', 'CHF'], include_blank: false = f.input :registration_ticket, hint: 'A registration ticket is with which user register for the conference.' From 6d7e1f4865a93962009746cfca5bddf664f64abc Mon Sep 17 00:00:00 2001 From: Adriano Vieira Date: Sat, 9 Dec 2017 12:00:50 -0200 Subject: [PATCH 12/46] autofill CFP end date - automatically setting the end date to the start date when creating CFP for UX reasons (fix #1872) --- app/assets/javascripts/osem-datepickers.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/osem-datepickers.js b/app/assets/javascripts/osem-datepickers.js index 84533b49..6dc89f43 100644 --- a/app/assets/javascripts/osem-datepickers.js +++ b/app/assets/javascripts/osem-datepickers.js @@ -98,6 +98,9 @@ $(function () { $("#registration-period-start-datepicker").on("dp.change",function (e) { $('#registration-period-end-datepicker').data("DateTimePicker").setMinDate(e.date); + if (!$('#registration-period-end-datepicker').val()) { + $('#registration-period-end-datepicker').data("DateTimePicker").setDate(e.date); + } }); $("#registration-period-end-datepicker").on("dp.change",function (e) { $('#registration-period-start-datepicker').data("DateTimePicker").setMaxDate(e.date); From e5009f168c46155e7162d5c873f3cc691840f617 Mon Sep 17 00:00:00 2001 From: rishabhptr Date: Tue, 5 Dec 2017 17:03:44 +0530 Subject: [PATCH 13/46] Fixed email text overflow in proposal#show Email icon is used solve email text overflow. Fixes #1838 --- app/views/proposals/show.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index 19f9371f..99f2d49e 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -36,8 +36,10 @@ .col-md-8 %h4 = link_to speaker.name, user_path(speaker.id) + %br - if speaker.email_public? - = "(#{speaker.email})" + = mail_to "#{ speaker.email }" do + %i.fa.fa-envelope-o.fa-2x - if speaker.affiliation? .text-muted from From ac8b187f1f855d339a62cd05e565bbd413a4d9cb Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Thu, 23 Nov 2017 01:19:26 +0530 Subject: [PATCH 14/46] Speaker is also able to see the proposal and able to modify it --- app/models/user.rb | 2 +- spec/models/user_spec.rb | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 4510aece..9a44a6a6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -216,7 +216,7 @@ class User < ApplicationRecord end def proposals(conference) - events.where('program_id = ? AND event_users.event_role=?', conference.program.id, 'submitter') + events.where('program_id = ? AND (event_users.event_role=? OR event_users.event_role=?)', conference.program.id, 'submitter', 'speaker') end def proposal_count(conference) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e742b993..b5b63089 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -345,24 +345,34 @@ describe User do end describe 'proposals methods' do - let(:submitter) { create(:submitter, user: user) } + let(:submitter) { create(:user) } + let(:speaker) { create(:user) } let(:event1) { create(:event, program: conference.program) } let(:event2) { create(:event, program: conference.program) } before do - event1.event_users << create(:event_user, user: user, event_role: 'submitter') - event2.event_users << create(:event_user, user: user, event_role: 'submitter') + event1.event_users << create(:event_user, user: submitter, event_role: 'submitter') + event2.event_users << create(:event_user, user: submitter, event_role: 'submitter') + event1.event_users << create(:event_user, user: speaker, event_role: 'speaker') end describe '#proposals' do it 'returns events submitted by user' do - expect(user.proposals(conference)).to match [event1, event2] + expect(submitter.proposals(conference)).to match [event1, event2] + end + + it 'returns events in which user is a speaker' do + expect(speaker.proposals(conference)).to match [event1] end end describe '#proposal_count' do it 'returns number of events submitted by user' do - expect(user.proposal_count(conference)).to eq 2 + expect(submitter.proposal_count(conference)).to eq 2 + end + + it 'returns number of events in which the user is a speaker' do + expect(speaker.proposal_count(conference)).to eq 1 end end end From 4409610a89f4848bd1c74f58242d9b06f72089a5 Mon Sep 17 00:00:00 2001 From: rishabh92 Date: Sun, 10 Dec 2017 21:08:55 -0600 Subject: [PATCH 15/46] Add database config examples for all supported databases Example for MySQL and PostgreSQL added. Fixes #1676 Update comments based on code review --- config/database.yml.example | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/config/database.yml.example b/config/database.yml.example index 51a4dd45..f47361d5 100644 --- a/config/database.yml.example +++ b/config/database.yml.example @@ -9,6 +9,35 @@ development: pool: 5 timeout: 5000 +## PostgreSQL +## gem install pg +## +## Ensure the postgres gem is defined in your Gemfile +## gem 'pg' +## Update with your database name and login credentials +# development: +# adapter: postgresql +# encoding: unicode +# database: database_name +# pool: 5 +# username: username +# password: password + +## MySQL +## gem install mysql2 +## +## Ensure the mysql gem is defined in your Gemfile +## gem 'mysql2' +## Update with your database name and login credentials +# development: +# adapter: mysql2 +# encoding: utf8 +# database: database_name +# pool: 5 +# username: username +# password: password +# socket: /tmp/mysql.sock + # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. From 4289f699ac8a812699d7a39e72eb9e7e08b6fda1 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Sun, 12 Feb 2017 17:57:55 +0200 Subject: [PATCH 16/46] Add enabled to event_schedules To show scheduled events that have been cancelled/withdrawn as 'cancelled', and consequently also show when an event is their replacement. admin/schedules#show does not show events that were scheduled and then cancelled/withdrawn, however a record in event_schedules exists for those events, but event_schedule.enabled = false --- app/controllers/admin/events_controller.rb | 9 +++++++++ app/controllers/proposals_controller.rb | 9 +++++++++ app/models/event.rb | 8 ++++++++ app/models/event_schedule.rb | 3 ++- .../20170212145523_add_enabled_to_event_schedules.rb | 5 +++++ db/schema.rb | 3 ++- 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20170212145523_add_enabled_to_event_schedules.rb diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index accfb281..164e0407 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -124,6 +124,15 @@ module Admin def cancel update_state(:cancel, 'Event canceled!') + selected_schedule = @event.program.selected_schedule + event_schedule = EventSchedule.unscoped.where(event: @event).find_by(schedule: selected_schedule) if selected_schedule + Rails.logger.debug "schedule: #{selected_schedule.inspect} and event_schedule #{event_schedule.inspect}" + if selected_schedule && event_schedule + event_schedule.enabled = false + event_schedule.save + else + @event.event_schedules.destroy_all + end end def reject diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 66052310..7ea81dc0 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -91,6 +91,15 @@ class ProposalsController < ApplicationController begin @event.withdraw + selected_schedule = @event.program.selected_schedule + event_schedule = @event.event_schedules.find_by(schedule: selected_schedule) if selected_schedule + Rails.logger.debug "schedule: #{selected_schedule.inspect} and event_schedule #{event_schedule.inspect}" + if selected_schedule && event_schedule + event_schedule.enabled = false + event_schedule.save + else + @event.event_schedules.destroy_all + end rescue Transitions::InvalidTransition redirect_to :back, error: "Event can't be withdrawn" return diff --git a/app/models/event.rb b/app/models/event.rb index 34c217f3..943572eb 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -197,6 +197,14 @@ class Event < ApplicationRecord send(transition) end save + # If the event was previously scheduled, and then withdrawn or cancelled + # its event_schedule will have enabled set to false + # If the event is now confirmed again, we want it to be available for scheduling + Rails.logger.debug "transition is #{transition}" + if transition == :confirm + Rails.logger.debug "schedules #{EventSchedule.unscoped.where(event: self, enabled: false)}" + EventSchedule.unscoped.where(event: self, enabled: false).destroy_all + end rescue Transitions::InvalidTransition => e alert = "Update state failed. #{e.message}" end diff --git a/app/models/event_schedule.rb b/app/models/event_schedule.rb index cb5d1675..9d59713d 100644 --- a/app/models/event_schedule.rb +++ b/app/models/event_schedule.rb @@ -1,4 +1,5 @@ class EventSchedule < ApplicationRecord + default_scope { where(enabled: true) } belongs_to :schedule belongs_to :event belongs_to :room @@ -33,7 +34,7 @@ class EventSchedule < ApplicationRecord # Returns event schedules that are scheduled in the same room and start_time as event # def intersecting_event_schedules - room.event_schedules.where(start_time: start_time, schedule: schedule).where.not(id: id) + EventSchedule.unscoped.where(room: room, start_time: start_time, schedule: schedule).where.not(id: id) end def replacement? diff --git a/db/migrate/20170212145523_add_enabled_to_event_schedules.rb b/db/migrate/20170212145523_add_enabled_to_event_schedules.rb new file mode 100644 index 00000000..d89505fe --- /dev/null +++ b/db/migrate/20170212145523_add_enabled_to_event_schedules.rb @@ -0,0 +1,5 @@ +class AddEnabledToEventSchedules < ActiveRecord::Migration + def change + add_column :event_schedules, :enabled, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6df61a48..43602f9b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -217,6 +217,7 @@ ActiveRecord::Schema.define(version: 20171130172334) do t.datetime "start_time" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "enabled", default: true t.index ["event_id", "schedule_id"], name: "index_event_schedules_on_event_id_and_schedule_id", unique: true t.index ["event_id"], name: "index_event_schedules_on_event_id" t.index ["room_id"], name: "index_event_schedules_on_room_id" @@ -494,7 +495,7 @@ ActiveRecord::Schema.define(version: 20171130172334) do t.integer "user_id" t.integer "payment_id" t.integer "week" - t.float "amount_paid", default: 0.0 + t.float "amount_paid" end create_table "ticket_scannings", force: :cascade do |t| From 2df8adea699a7356ac52cf033262d4a21367bcc9 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 12 Dec 2017 11:49:20 +0100 Subject: [PATCH 17/46] Link to an existing video with embeddable content Otherwise the Commercial validation hits --- spec/factories/commercials.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/factories/commercials.rb b/spec/factories/commercials.rb index cf865348..7fa052a7 100644 --- a/spec/factories/commercials.rb +++ b/spec/factories/commercials.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :commercial do - sequence(:url) { |n| "https://www.youtube.com/watch?v=BTTygyxuGj#{n}" } + sequence(:url) { |n| "https://www.youtube.com/watch?v=4VrhlyIgo3M&factory=#{n}" } factory :conference_commercial do association :commercialable, factory: :conference From 83053f4626a1a9ed26b4279ac286b7b5ff39e209 Mon Sep 17 00:00:00 2001 From: ViditChitkara Date: Sat, 21 Oct 2017 02:38:41 +0530 Subject: [PATCH 18/46] added email presence validation to openid closes #1658 added test for openid fixed robocup offences written tests for email presence validation minor changes shifted omniauth callback tests to rspec controllers fixed linting bug minor changes minor changes --- .../users/omniauth_callbacks_controller.rb | 5 +++ app/models/openid.rb | 2 +- .../omniauth_callbacks_controller_spec.rb | 31 +++++++++++++++++++ spec/factories/openid.rb | 10 ++++++ spec/models/openid.rb | 15 +++++++++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 spec/controllers/users/omniauth_callbacks_controller_spec.rb create mode 100644 spec/factories/openid.rb create mode 100644 spec/models/openid.rb diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index ed7ce011..1d0400cd 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -11,6 +11,11 @@ module Users def handle(provider) auth_hash = request.env['omniauth.auth'] + unless auth_hash.info.email.present? + flash[:error] = "Email field is missing in your #{provider} account" + redirect_to new_user_registration_path + return + end username = auth_hash.info.email.split('@')[0] openid = Openid.find_for_oauth(auth_hash) # Get or create openid # If openid exists and is associated with a user, sign in with associated user, diff --git a/app/models/openid.rb b/app/models/openid.rb index 2b954f8b..b0f45f0c 100644 --- a/app/models/openid.rb +++ b/app/models/openid.rb @@ -1,6 +1,6 @@ class Openid < ApplicationRecord belongs_to :user - validates :provider, :uid, presence: true + validates :provider, :uid, :email, presence: true # Searches for openid based on provider and uid. # Returns found openid or a new openid. diff --git a/spec/controllers/users/omniauth_callbacks_controller_spec.rb b/spec/controllers/users/omniauth_callbacks_controller_spec.rb new file mode 100644 index 00000000..c67e6ac9 --- /dev/null +++ b/spec/controllers/users/omniauth_callbacks_controller_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Users::OmniauthCallbacksController do + context 'email is not there in auth hash' do + before do + stub_env_for_omniauth + get :google + end + + it { expect(flash[:error]).to eq('Email field is missing in your google account') } + end +end + +def stub_env_for_omniauth + request.env['devise.mapping'] = Devise.mappings[:user] + env = OmniAuth::AuthHash.new( + provider: 'google', + uid: 'google-test-uid-1', + info: { + name: 'google user', + email: nil, + username: 'user_google' + }, + credentials: { + token: 'google_mock_token', + secret: 'google_mock_secret' + } + ) + request.env['omniauth.auth'] = env + @controller.stub(:env).and_return(env) +end diff --git a/spec/factories/openid.rb b/spec/factories/openid.rb new file mode 100644 index 00000000..6950c718 --- /dev/null +++ b/spec/factories/openid.rb @@ -0,0 +1,10 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :openid do + provider { Faker::Internet.domain_word } + email { Faker::Internet.email } + uid { SecureRandom.hex } + user + end +end diff --git a/spec/models/openid.rb b/spec/models/openid.rb new file mode 100644 index 00000000..42b6a74f --- /dev/null +++ b/spec/models/openid.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe Openid do + subject { create(:openid) } + + describe 'validation' do + it { is_expected.to validate_presence_of(:provider) } + it { is_expected.to validate_presence_of(:uid) } + it { is_expected.to validate_presence_of(:email) } + end + + describe 'association' do + it { is_expected.to belong_to(:user) } + end +end From 57e596c67e1ebd0330381600666080b7c56e578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sede=C3=B1o?= Date: Tue, 12 Dec 2017 22:08:48 +0100 Subject: [PATCH 19/46] Use distinct instead of uniq because deprectation. --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 9a44a6a6..d062529a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,8 +45,8 @@ class User < ApplicationRecord attr_accessor :login has_many :event_users, dependent: :destroy - has_many :events, -> { uniq }, through: :event_users - has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).uniq }, through: :event_users, source: :event + has_many :events, -> { distinct }, through: :event_users + has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).distinct }, through: :event_users, source: :event has_many :registrations, dependent: :destroy do def for_conference conference where(conference: conference).first From 2180e6197c8772704d3d1fff72971c963fcf3824 Mon Sep 17 00:00:00 2001 From: Harry30897 Date: Mon, 27 Nov 2017 23:33:34 +0530 Subject: [PATCH 20/46] Conference name repeated in revision_history on adding commercial --- app/views/admin/versions/_object_desc_and_link.html.haml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/views/admin/versions/_object_desc_and_link.html.haml b/app/views/admin/versions/_object_desc_and_link.html.haml index 6b182c2f..0df93aa9 100644 --- a/app/views/admin/versions/_object_desc_and_link.html.haml +++ b/app/views/admin/versions/_object_desc_and_link.html.haml @@ -234,6 +234,12 @@ = link_to_organization(version.conference_id) - else (Organization Deleted) + - elsif version.item_type == 'Commercial' + - commercial = current_or_last_object_state(version.item_type, version.item_id) + - commercialable = current_or_last_object_state(commercial.commercialable_type, commercial.commercialable_id) + - unless commercial.commercialable_type == 'Conference' + in conference + = link_to_conference(version.conference_id) - else in conference = link_to_conference(version.conference_id) From 99ab06d117985dc03fae03e7464ec7524880d1b9 Mon Sep 17 00:00:00 2001 From: Akshit Ahluwalia Date: Mon, 11 Dec 2017 16:27:18 -0800 Subject: [PATCH 21/46] Add templates for github issues & pull requests re: #1763 based on: #1764 --- .github/ISSUE_TEMPLATE.md | 15 +++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..a3778efa --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,15 @@ +**I'm submitting a ..** +- [ ] Bug Report +- [ ] Feature Request + +**Current behavior:** + + +**Expected correct behavior:** + + +**Steps to reproduce:** + + +**Other information:** + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..501ce4df --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +**Checklist** + +- [ ] I have read the [Contribution & Best practices Guide](https://github.com/openSUSE/osem/blob/master/CONTRIBUTING.md). +- [ ] My branch is up-to-date with the upstream `master` branch. +- [ ] The tests pass locally with my changes. +- [ ] I have added tests that prove my fix is effective or that my feature works(if appropriate). +- [ ] I have added necessary documentation (if appropriate). + +**Short description of what this resolves/which [issues](https://github.com/openSUSE/osem/issues) does this fix?:** + + + +- + +**Changes proposed in this pull request:** + + + +- From 505d9da3d4874636f47bd97f62989f8158638278 Mon Sep 17 00:00:00 2001 From: Ronaq13 Date: Sat, 9 Dec 2017 14:03:59 +0530 Subject: [PATCH 22/46] Fix Performance/HashEachMethods offenses values.each and keys.each methods are depreciated, so they have replaced by each_value and each_key respectively. This has done manually. Closes https://github.com/openSUSE/osem/issues/1825 --- .rubocop_todo.yml | 9 --------- app/controllers/admin/conferences_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/views/schedules/show.xml.haml | 4 ++-- .../20140701123203_add_events_per_week_to_conference.rb | 2 +- spec/factories/event_users.rb | 2 +- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7664f6c3..a576c435 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -376,15 +376,6 @@ Naming/VariableNumber: Exclude: - 'spec/models/ticket_purchase_spec.rb' -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect. -Performance/HashEachMethods: - Exclude: - - 'app/controllers/admin/conferences_controller.rb' - - 'app/helpers/application_helper.rb' - - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' - - 'spec/factories/event_users.rb' # Offense count: 1 # Cop supports --auto-correct. diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index 8f8f2959..921a23d1 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -155,7 +155,7 @@ module Admin # Set line color using a hash function @tickets = [] - @tickets_data.keys.each do |title| + @tickets_data.each_key do |title| @tickets.append(short_title: title, color: "\##{Digest::MD5.hexdigest(title)[0..5]}") end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b1e249ba..9497cb1c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -99,7 +99,7 @@ module ApplicationHelper end def normalize_array_length(hashmap, length) - hashmap.each do |_, value| + hashmap.each_value do |value| if value.length < length value.fill(value[-1], value.length...length) end diff --git a/app/views/schedules/show.xml.haml b/app/views/schedules/show.xml.haml index 541377ad..f42ad801 100644 --- a/app/views/schedules/show.xml.haml +++ b/app/views/schedules/show.xml.haml @@ -9,10 +9,10 @@ %timeslot_duration= length_timestamp(@conference.program.schedule_interval) - if @events_xml.any? - - @events_xml.keys.each.with_index(1) do |day, index| + - @events_xml.each_key.with_index(1) do |day, index| %day{ date: day, index: index } - events_in_rooms = @events_xml[day].group_by(&:room) - - events_in_rooms.keys.each do |room| + - events_in_rooms.each_key do |room| %room{ name: room.name } - events_in_rooms[room].each do |event| %event{ guid: event.guid, id: event.id } diff --git a/db/migrate/20140701123203_add_events_per_week_to_conference.rb b/db/migrate/20140701123203_add_events_per_week_to_conference.rb index 36bbf40d..2b4d3342 100644 --- a/db/migrate/20140701123203_add_events_per_week_to_conference.rb +++ b/db/migrate/20140701123203_add_events_per_week_to_conference.rb @@ -77,7 +77,7 @@ class AddEventsPerWeekToConference < ActiveRecord::Migration hash.each do |week, values| if previous - values.each do |state, _value| + values.each_key do |state| hash[week][state] += previous[state] end end diff --git a/spec/factories/event_users.rb b/spec/factories/event_users.rb index 78bcd10d..5d1574a9 100644 --- a/spec/factories/event_users.rb +++ b/spec/factories/event_users.rb @@ -4,7 +4,7 @@ FactoryGirl.define do factory :event_user do user - Hash[EventUser::ROLES].values.each do |role| + Hash[EventUser::ROLES].each_value do |role| factory role do event_role role end From 8f6eeaaf4524ccce9a642b24bbd9738781610448 Mon Sep 17 00:00:00 2001 From: rishabh92 Date: Sun, 17 Dec 2017 19:25:13 -0600 Subject: [PATCH 23/46] Fix commercials does not accept slideshare https url Updated ruby-oembed to latest version 0.12.0, issue was due to ruby-oembed version 0.8.14 not accepting https slideshare links. Fixes #1775 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 79bbdb3f..69e750d4 100644 --- a/Gemfile +++ b/Gemfile @@ -179,7 +179,7 @@ gem 'acts_as_list' gem 'bootstrap-switch-rails', '~> 3.0.0' # for parsing OEmbed data -gem 'ruby-oembed' +gem 'ruby-oembed', '~>0.12.0' # for uploading images to the cloud gem 'cloudinary' diff --git a/Gemfile.lock b/Gemfile.lock index 1023f255..17c25857 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -479,7 +479,7 @@ GEM rainbow (>= 2.2.2, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-oembed (0.8.14) + ruby-oembed (0.12.0) ruby-openid (2.5.0) ruby-progressbar (1.9.0) ruby_dep (1.5.0) @@ -662,7 +662,7 @@ DEPENDENCIES rspec-activemodel-mocks rspec-rails (~> 3.5, >= 3.5.2) rubocop (~> 0.51.0) - ruby-oembed + ruby-oembed (~> 0.12.0) sass-rails (>= 4.0.2) selectize-rails shoulda-matchers From 6a1d757f43213a05f5517dfaf6aa836e65cf0673 Mon Sep 17 00:00:00 2001 From: foteinidd Date: Thu, 21 Dec 2017 18:48:19 +0200 Subject: [PATCH 24/46] Add check for rooms in tracks#edit --- app/views/admin/tracks/_form.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/tracks/_form.html.haml b/app/views/admin/tracks/_form.html.haml index 9109e4f5..a621e1a4 100644 --- a/app/views/admin/tracks/_form.html.haml +++ b/app/views/admin/tracks/_form.html.haml @@ -14,7 +14,7 @@ = f.input :color, input_html: {size: 6, type: 'color'}, required: true = f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly', required: @track.self_organized_and_accepted_or_confirmed? } = f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly', required: @track.self_organized_and_accepted_or_confirmed? } - - if @conference.venue.try(:rooms) + - if @conference.venue.try(:rooms).present? = f.input :room, as: :select, collection: (@conference.venue.rooms).map {|room| ["#{room.name}", room.id]}, include_blank: true, label: 'Room', input_html: { class: 'select-help-toggle', required: @track.self_organized_and_accepted_or_confirmed? } - else %b From 6eb8c8d6aed64d5c7190c5914d2c1e5b6b106b6d Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Fri, 17 Nov 2017 00:02:23 +0530 Subject: [PATCH 25/46] Added tests for program#any_event_for_this_date? --- app/models/program.rb | 2 +- spec/factories/conferences.rb | 2 +- spec/models/program_spec.rb | 50 ++++++++++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/app/models/program.rb b/app/models/program.rb index 4f0298f4..dab2f2b6 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -165,7 +165,7 @@ class Program < ApplicationRecord # * +False+ -> If there is not any event for the given date def any_event_for_this_date?(date) parsed_date = DateTime.parse("#{date} 00:00").utc - EventSchedule.where(schedule: selected_schedule).where(start_time: parsed_date..(parsed_date + 1)).any? + EventSchedule.where(schedule: selected_schedule).where(start_time: parsed_date..(parsed_date + 1.day)).any? end ## diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index 1e4d8551..31f72344 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -5,7 +5,7 @@ FactoryGirl.define do title { Faker::Book.title } short_title { SecureRandom.urlsafe_base64(4) } timezone { Faker::Address.time_zone } - start_date { Date.today } + start_date { Date.current } end_date { 6.days.from_now } start_hour 9 end_hour 20 diff --git a/spec/models/program_spec.rb b/spec/models/program_spec.rb index ccb1bfbc..a4b7e44f 100644 --- a/spec/models/program_spec.rb +++ b/spec/models/program_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Program do subject { create(:program) } - let!(:conference) { create(:conference, end_date: Date.today + 3) } + let!(:conference) { create(:conference, end_date: Date.current + 3) } let!(:program) { conference.program } describe 'association' do @@ -241,6 +241,54 @@ describe Program do end end + describe '#any_event_for_this_date?' do + + let(:event){ create(:event, program: program) } + + context 'when no schedule is selected for the conference' do + let(:schedule) { create(:schedule, program: program) } + let!(:event_schedule) { create(:event_schedule, event: event, schedule: schedule, start_time: DateTime.parse("#{Date.current + 1} 10:00").utc) } + + it 'returns false irrespective of any date' do + expect(program.any_event_for_this_date?(Date.current + 1)).to eq false + end + + it 'returns false if date passed is empty' do + expect(program.any_event_for_this_date?('')).to eq false + end + + it 'returns false if date passed is nil' do + expect(program.any_event_for_this_date?(nil)).to eq false + end + end + + context 'when schedule is selected for the conference' do + let(:schedule) { create(:schedule, program: program) } + let!(:event_schedule) { create(:event_schedule, event: event, schedule: schedule, start_time: DateTime.parse("#{Date.current + 1} 10:00").utc) } + + before :each do + program.selected_schedule = event_schedule.schedule + program.save! + end + + it 'returns true if there is any event for this date' do + expect(program.any_event_for_this_date?(Date.current + 1)).to eq true + end + + it 'returns false if there is no event for this date' do + expect(program.any_event_for_this_date?(Date.current + 2)).to eq false + end + + it 'returns false if date passed is empty' do + expect(program.any_event_for_this_date?('')).to eq false + end + + it 'returns false if date passed is nil' do + expect(program.any_event_for_this_date?(nil)).to eq false + end + end + end + describe '#cfp' do it 'returns the cfp for events' do create(:cfp, cfp_type: 'events', program: program, end_date: Date.current + 1) From 808625106ccd198c9c14ae8d89e44c3761005a12 Mon Sep 17 00:00:00 2001 From: Naman Gupta <01namangupta@gmail.com> Date: Wed, 20 Dec 2017 22:21:40 +0530 Subject: [PATCH 26/46] Removed Style/DateTime offences which occured due to the use of DateTime class in spec/models/program_spec.rb --- .rubocop_todo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a576c435..a4542c19 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -413,6 +413,7 @@ Style/DateTime: - 'app/models/conference.rb' - 'app/models/program.rb' - 'spec/models/conference_spec.rb' + - 'spec/models/program_spec.rb' # Offense count: 488 Style/Documentation: From 2e89920954e0de8243c8660334043ed05a0a522d Mon Sep 17 00:00:00 2001 From: kostino Date: Mon, 4 Dec 2017 17:03:47 +0200 Subject: [PATCH 27/46] Add Button that links to /admin/organizations in _admin_sidebar_index partial file located in views/layouts --- app/views/layouts/_admin_sidebar_index.html.haml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/layouts/_admin_sidebar_index.html.haml b/app/views/layouts/_admin_sidebar_index.html.haml index 9a3d19f3..f828fe85 100644 --- a/app/views/layouts/_admin_sidebar_index.html.haml +++ b/app/views/layouts/_admin_sidebar_index.html.haml @@ -27,6 +27,11 @@ = link_to(admin_users_path) do %span.fa.fa-user Users + - if can? :index, Organization + %li + = link_to(admin_organizations_path) do + %span.fa.fa-users + Organizations - if can? :index, PaperTrail::Version %li = link_to(admin_revision_history_path) do From 29a640a2675310ef4c4d570bde50b302a1acf91b Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 24 Oct 2017 19:58:03 -0700 Subject: [PATCH 28/46] 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 995176ffe59cd590626c5e26fd9f5e7416221d17 Mon Sep 17 00:00:00 2001 From: James Mason Date: Fri, 17 Nov 2017 19:34:26 -0800 Subject: [PATCH 29/46] 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 9497cb1c..77f4f85e 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 - 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 b12137d8..cb319d32 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -33,6 +33,7 @@ class Conference < ApplicationRecord 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 < ApplicationRecord 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 e60dc8c09d7a719cf999730e2c49ad9d0e3018e7 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 20 Nov 2017 19:46:12 -0800 Subject: [PATCH 30/46] 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 7f2346650fbaca6213864c5aaaae60e7d34d3807 Mon Sep 17 00:00:00 2001 From: James Mason Date: Fri, 17 Nov 2017 18:32:08 -0800 Subject: [PATCH 31/46] 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 69e750d4..e624a1f7 100644 --- a/Gemfile +++ b/Gemfile @@ -214,6 +214,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 17c25857..1645c8be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,6 +145,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.3) @@ -597,6 +598,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 cf598a16..11a8c06b 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 f4b869c1297652ced7f8258cd51a754febec7b9e Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 09:54:27 -0800 Subject: [PATCH 32/46] 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 | 75 +++++++------ app/views/conferences/_tickets.html.haml | 53 +++++---- app/views/conferences/_venue.html.haml | 67 +++++------ app/views/conferences/show.html.haml | 106 ++++++++---------- 11 files changed, 335 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..5f961acd 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -2,40 +2,43 @@ %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.sponsorship_levels, + @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 3cdef86d6425f71615129b042f4136ce510b4dbc Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:06:58 -0800 Subject: [PATCH 33/46] Redesign & move splashpage header into a partial ... this allows conferences/show to consistently just show layout. --- app/views/conferences/_header.haml | 32 ++++++++++++++++++++++++++++ app/views/conferences/show.html.haml | 26 +--------------------- 2 files changed, 33 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..3d68ff17 --- /dev/null +++ b/app/views/conferences/_header.haml @@ -0,0 +1,32 @@ +- 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 92927a4f8844142f0054d5120fc74cfb2c760e32 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:14:54 -0800 Subject: [PATCH 34/46] 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 394448dc36bf7883c774a2a0a5443cdd8a94a971 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:26:19 -0800 Subject: [PATCH 35/46] Fold booths into the schedule section of splashpage --- app/views/conferences/_booths.html.haml | 4 ---- app/views/conferences/_schedule_splashpage.html.haml | 9 ++++++--- app/views/conferences/show.html.haml | 4 +--- 3 files changed, 7 insertions(+), 10 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..90803430 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -1,9 +1,9 @@ = content_for :splash_nav do %li - =link_to('#program', class: 'smoothscroll') do - Program + %a.smoothscroll{ href: '#program' } Program -- cache [@confererence, @conference.confirmed_tracks, '#splash#program'] do +- cache [@confererence, @conference.confirmed_tracks, + @conference.confirmed_booths,'#splash#schedule'] do %section#program .container .row @@ -55,3 +55,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 f0c3fc357b5a46b73ab63e5914a3ced573b37dac Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 10:56:46 -0800 Subject: [PATCH 36/46] 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 1645c8be..0f64b0e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -293,7 +293,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) nio4r (2.1.0) 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 37ad4e15..1451b907 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 aee1f58607d7d2c9653e077d2588b1f41db6867e Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 21 Nov 2017 18:31:14 -0800 Subject: [PATCH 37/46] 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 b2e1eb5fa9d874e5e2d379eed4fdd032daf9b5ba Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:34:27 -0800 Subject: [PATCH 38/46] 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 77f4f85e..1fd0b6db 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 20e2b4b76b57360ab89dccb01b7ad1a1f125d805 Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:37:02 -0800 Subject: [PATCH 39/46] Move sponsor modal to a generic partial & redesign. ... use for booths also. --- app/views/conferences/_booths.html.haml | 28 +++++-------- app/views/conferences/_modal_description.haml | 21 ++++++++++ app/views/conferences/_sponsors.html.haml | 40 +++++++------------ app/views/conferences/_tickets.html.haml | 19 +++++---- app/views/conferences/show.html.haml | 2 + 5 files changed, 58 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..9e37ac95 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -6,21 +6,15 @@ %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 + - content_for :modals do + = 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 5f961acd..aa15ab5a 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.html.haml @@ -6,34 +6,24 @@ @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 + - content_for :modals do + = 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 494a1b32a42307106b9d8cd78840ca25837b217a Mon Sep 17 00:00:00 2001 From: James Mason Date: Sun, 26 Nov 2017 20:53:03 -0800 Subject: [PATCH 40/46] 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 8f43da79b5eabb4c54e40fcb21217ac6bd60f151 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 27 Nov 2017 18:26:34 -0800 Subject: [PATCH 41/46] Redesign splashpage program section & split out partials --- app/views/conferences/_booths.html.haml | 37 +++++----- app/views/conferences/_highlights.haml | 18 +++++ .../_schedule_splashpage.html.haml | 71 ++++++------------- app/views/conferences/_tracks.haml | 17 +++++ 4 files changed, 73 insertions(+), 70 deletions(-) create mode 100644 app/views/conferences/_highlights.haml create mode 100644 app/views/conferences/_tracks.haml diff --git a/app/views/conferences/_booths.html.haml b/app/views/conferences/_booths.html.haml index 9e37ac95..92bfbaae 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.html.haml @@ -1,20 +1,17 @@ -- 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 - - content_for :modals do - = render 'modal_description', object: booth +.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.booth + %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 + - content_for :modals do + = render 'modal_description', object: booth 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 90803430..08958c94 100644 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ b/app/views/conferences/_schedule_splashpage.html.haml @@ -3,58 +3,29 @@ %a.smoothscroll{ href: '#program' } Program - cache [@confererence, @conference.confirmed_tracks, - @conference.confirmed_booths,'#splash#schedule'] do + @conference.confirmed_booths,'#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?) + .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_booths && @conference.confirmed_booths.any? - = render 'booths' + - if @conference.splashpage.include_tracks && @conference.confirmed_tracks.any? + = render 'tracks' + + - if @conference.splashpage.include_booths && @conference.confirmed_booths.any? + = render 'booths' + + - 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 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 27f6d8ad73e7bf3559057e6305ba2a4d905fcb29 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 27 Nov 2017 20:04:54 -0800 Subject: [PATCH 42/46] Let's get serious about linting, folks. --- .haml-lint_todo.yml | 11 --- app/helpers/conference_helper.rb | 18 +++++ .../{_booths.html.haml => _booths.haml} | 6 +- 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 | 33 +++++++++ app/views/conferences/_registration.haml | 34 +++++++++ app/views/conferences/_registration.html.haml | 33 --------- .../_schedule_splashpage.html.haml | 31 --------- app/views/conferences/_social_media.haml | 20 ++++++ app/views/conferences/_social_media.html.haml | 20 ------ .../{_sponsors.html.haml => _sponsors.haml} | 18 ++--- .../{_tickets.html.haml => _tickets.haml} | 8 +-- app/views/conferences/_tracks.haml | 5 +- 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, 341 insertions(+), 235 deletions(-) create mode 100644 app/helpers/conference_helper.rb rename app/views/conferences/{_booths.html.haml => _booths.haml} (81%) 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} (58%) 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 81% rename from app/views/conferences/_booths.html.haml rename to app/views/conferences/_booths.haml index 92bfbaae..87c6cac5 100644 --- a/app/views/conferences/_booths.html.haml +++ b/app/views/conferences/_booths.haml @@ -1,8 +1,8 @@ .row - .col-md-12.text-center - %h2 Booths + .col-md-12 + %h3.text-center Booths .row.row-centered - - @conference.confirmed_booths.each do |booth| + - conference.confirmed_booths.to_a.sort_by!(&:title).each do |booth| .col-md-2.col-sm-2.col-centered.col-top.booth %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..8499f4ac --- /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 3d68ff17..7a635ae7 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,32 +1,36 @@ -- 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) - - if @conference.venue + = 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) + - 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..67e058c7 --- /dev/null +++ b/app/views/conferences/_program.haml @@ -0,0 +1,33 @@ += content_for :splash_nav do + %li + %a.smoothscroll{ href: '#program' } Program + +- cache [@confererence, @conference.confirmed_tracks, + @conference.confirmed_booths,'#splash#program'] do + %section#program + .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.splashpage.include_booths + - if conference.confirmed_booths.any? + = render 'booths', 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 diff --git a/app/views/conferences/_registration.haml b/app/views/conferences/_registration.haml new file mode 100644 index 00000000..f327344b --- /dev/null +++ b/app/views/conferences/_registration.haml @@ -0,0 +1,34 @@ += 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 is open + = date_string(conference.registration_period.start_date, + conference.registration_period.end_date) + - if conference.registration_open? + %p.cta-button + = link_to('Register Now', + new_conference_conference_registration_path(conference.short_title), + class: 'btn btn-lg btn-success') 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 08958c94..00000000 --- a/app/views/conferences/_schedule_splashpage.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -= content_for :splash_nav do - %li - %a.smoothscroll{ href: '#program' } Program - -- cache [@confererence, @conference.confirmed_tracks, - @conference.confirmed_booths,'#splash#program'] do - %section#program - .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.splashpage.include_booths && @conference.confirmed_booths.any? - = render 'booths' - - - 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 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 58% rename from app/views/conferences/_sponsors.html.haml rename to app/views/conferences/_sponsors.haml index aa15ab5a..f75939f6 100644 --- a/app/views/conferences/_sponsors.html.haml +++ b/app/views/conferences/_sponsors.haml @@ -2,12 +2,12 @@ %li %a.smoothscroll{ href: '#sponsors' } Sponsors -- cache [@conference, @conference.sponsors, @conference.sponsorship_levels, - @conference.try(:call_for_sponsors), '#splash#sponsors'] do +- cache [conference, conference.sponsors, conference.sponsorship_levels, + 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 @@ -15,8 +15,8 @@ .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}"], @@ -24,11 +24,11 @@ - content_for :modals do = 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..3dd8e628 100644 --- a/app/views/conferences/_tracks.haml +++ b/app/views/conferences/_tracks.haml @@ -1,9 +1,8 @@ .row .col-md-12 - %h3.text-center - Tracks + %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 From 245a312c1bf376faf7b7921ffdd8b3ab4e9f1ae6 Mon Sep 17 00:00:00 2001 From: James Mason Date: Tue, 28 Nov 2017 17:46:12 -0800 Subject: [PATCH 43/46] Add emphasis to call for sponsors --- app/views/conferences/_sponsors.haml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/conferences/_sponsors.haml b/app/views/conferences/_sponsors.haml index f75939f6..95856d72 100644 --- a/app/views/conferences/_sponsors.haml +++ b/app/views/conferences/_sponsors.haml @@ -27,8 +27,7 @@ - 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! + %h3.text-center + Want to sponsor? + = link_to(sponsorship_mailto(conference)) do + Contact us! From 5fb09f398a84aaf40615217a5605f7a4e9b73d13 Mon Sep 17 00:00:00 2001 From: James Mason Date: Wed, 29 Nov 2017 09:15:42 -0800 Subject: [PATCH 44/46] FIXUP: Reorder splashpage & align form * Per PR comments, place program above registration/tickets * Reorder splashpage admin form based on splashpage order --- app/views/admin/splashpages/_form.html.haml | 55 ++++++--- app/views/admin/splashpages/show.html.haml | 123 +++++++------------- app/views/conferences/show.html.haml | 22 ++-- 3 files changed, 90 insertions(+), 110 deletions(-) diff --git a/app/views/admin/splashpages/_form.html.haml b/app/views/admin/splashpages/_form.html.haml index 96a1a300..1d15b38c 100644 --- a/app/views/admin/splashpages/_form.html.haml +++ b/app/views/admin/splashpages/_form.html.haml @@ -2,21 +2,46 @@ .col-md-12 .page-header %h1 Splashpage -.row - .col-md-8 - = semantic_form_for(@splashpage, url: admin_conference_splashpage_path(@conference.short_title)) do |f| + += semantic_form_for(@splashpage, url: admin_conference_splashpage_path(@conference.short_title)) do |f| + .row + .col-md-12 = 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 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) } - = f.input :include_lodgings, label: 'Display the lodgings', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_lodgings) } - = f.input :include_sponsors, label: 'Display sponsors', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_sponsors) } - = f.input :include_booths, label: 'Display confirmed booths', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_booths) } - = f.input :include_social_media, label: 'Display social media', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_social_media) } + %ul.fa-ul + %li + = f.input :include_cfp, label: 'Display call for papers and call for tracks, while open', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_cfp) } + %li + = f.input :include_program, label: 'Display the program', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_program) } + + %ul.fa-ul + %li + = f.input :include_tracks, label: 'Include confirmed tracks', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tracks) } + %li + = f.input :include_booths, label: 'Include confirmed booths', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_booths) } + + %li + = f.input :include_registrations, label: 'Display the registration period', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_registrations) } + + %li + = f.input :include_tickets, label: 'Display tickets', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_tickets) } + + %li + = f.input :include_venue, label: 'Display the venue', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_venue) } + + %li + = f.input :include_lodgings, label: 'Display the lodgings', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_lodgings) } + + %li + = f.input :include_sponsors, label: 'Display sponsors', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_sponsors) } + + %li + = f.input :include_social_media, label: 'Display social media links', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_social_media) } + = f.inputs name: 'Access' do - = f.input :public, label: 'Make splash page public?' + %ul.fa-ul + %li + = f.input :public, label: 'Make splash page public?' + .row + .col-md-12 %p.text-right - = f.submit 'Save Splashpage', class: 'btn btn-primary' + = f.submit 'Save Changes', class: 'btn btn-primary' diff --git a/app/views/admin/splashpages/show.html.haml b/app/views/admin/splashpages/show.html.haml index 8d799eda..ec625385 100644 --- a/app/views/admin/splashpages/show.html.haml +++ b/app/views/admin/splashpages/show.html.haml @@ -8,92 +8,47 @@ with all the information for your conference - if @splashpage .row - .col-md-8 - %dl.dl-horizontal - %dt - Include Tracks: - %dd - - if @splashpage.include_tracks - Yes - - else - No - %dt - Include Program: - %dd - - if @splashpage.include_program - Yes - - else - No - %dt - Include Calls for Content: - %dd - - if @splashpage.include_cfp - Yes - - else - No - %dt - Include Venue: - %dd - -if @splashpage.include_venue - Yes - -else - No - %dt - Include Registrations: - %dd - - if @splashpage.include_registrations - Yes - - else - No - %dt - Include Tickets: - %dd - - if @splashpage.include_tickets - Yes - - else - No - %dt - Include Lodgins - %dd - -if @splashpage.include_lodgings - Yes - -else - No - %dt - Include Sponsors: - %dd - - if @splashpage.include_sponsors - Yes - - else - No - %dt - Include Booths - %dd - - if @splashpage.include_booths - Yes - - else - No - %dt - Include Social Media: - %dd - - if @splashpage.include_social_media - Yes - - else - No - %dt - Public - %dd - - if @splashpage.public - Yes - - else - No + .col-md-12 + %ul.fa-ul + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_cfp?}" } + Display call for papers and call for tracks, while open + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_program?}" } + Display the program + %ul.fa-ul + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_program?}" } + Include confirmed tracks + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_booths?}" } + Include confirmed booths + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_registrations?}" } + Display the registration period + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_tickets?}" } + Display tickets + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_venue?}" } + Display the venue + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_lodgings?}" } + Display the lodgings + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_sponsors?}" } + Display sponsors + %li + %i{ class: "fa-li #{icon_for_todo @splashpage.include_social_media?}" } + Display social media links + .row .col-md-12 - - if can? :update, @splashpage - = link_to 'Edit', edit_admin_conference_splashpage_path, class: 'btn btn-primary' - - if can? :destroy, @splashpage - = link_to 'Delete', admin_conference_splashpage_path, - method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' + - if can? :update, @splashpage + = link_to 'Edit', edit_admin_conference_splashpage_path, class: 'btn btn-primary' + - if can? :destroy, @splashpage + = link_to 'Delete', admin_conference_splashpage_path, + method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' - else .row .col-md-12.text-right diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index ac0fc854..e5da32e6 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -11,33 +11,33 @@ = @conference.title #splash - // header/description + -# header/description = render 'header', conference: @conference - // attendance/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 + + -# 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 - // 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 - - // geo + -# geo - if @conference.splashpage.include_venue && @conference.venue = render 'venue', conference: @conference - if @conference.splashpage.include_lodgings && @conference.lodgings.any? = render 'lodging', conference: @conference - // sponsorship + -# sponsorship - if @conference.splashpage.include_sponsors = render 'sponsors', conference: @conference - // footer + -# footer - if @conference.splashpage.include_social_media - if @conference.contact.has_social_media? = render 'social_media', conference: @conference From 754d201b0141387ed56cdfe37be2fc7beb32cfec Mon Sep 17 00:00:00 2001 From: James Mason Date: Wed, 29 Nov 2017 15:29:06 -0800 Subject: [PATCH 45/46] FIXUP fragment caching issues --- app/controllers/conferences_controller.rb | 2 +- app/views/conferences/_booths.haml | 2 - app/views/conferences/_modal_description.haml | 41 ++++++++++--------- app/views/conferences/_program.haml | 4 ++ app/views/conferences/_sponsors.haml | 6 ++- app/views/conferences/_venue.haml | 10 ++--- app/views/layouts/application.html.haml | 2 +- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index e5626aa1..9bd0a4df 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -12,7 +12,6 @@ class ConferencesController < ApplicationController @conference = Conference.unscoped.eager_load( :organization, :splashpage, - :venue, :registration_period, :tickets, :confirmed_tracks, @@ -26,6 +25,7 @@ class ConferencesController < ApplicationController :sponsors, :call_for_sponsors, :contact, + venue: [:commercial], highlighted_events: [:speakers], sponsorship_levels: [:sponsors] ).order( diff --git a/app/views/conferences/_booths.haml b/app/views/conferences/_booths.haml index 87c6cac5..a6b09251 100644 --- a/app/views/conferences/_booths.haml +++ b/app/views/conferences/_booths.haml @@ -13,5 +13,3 @@ - else .caption %h3.text-center= booth.title - - content_for :modals do - = render 'modal_description', object: booth diff --git a/app/views/conferences/_modal_description.haml b/app/views/conferences/_modal_description.haml index a8d1b1d2..eb6f2b69 100644 --- a/app/views/conferences/_modal_description.haml +++ b/app/views/conferences/_modal_description.haml @@ -1,21 +1,22 @@ - 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' + - cache [object, '#modal'] 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 index 67e058c7..eba300a1 100644 --- a/app/views/conferences/_program.haml +++ b/app/views/conferences/_program.haml @@ -31,3 +31,7 @@ = link_to(conference_schedule_path(conference.short_title), class: 'btn btn-success btn-lg') do Full Schedule + +- conference.confirmed_booths.each do |booth| + - content_for :modals do + = render 'modal_description', object: booth diff --git a/app/views/conferences/_sponsors.haml b/app/views/conferences/_sponsors.haml index 95856d72..e6cda589 100644 --- a/app/views/conferences/_sponsors.haml +++ b/app/views/conferences/_sponsors.haml @@ -21,8 +21,6 @@ class: ['img-responsive', 'img-sponsor', "img-sponsor-#{sponsorship_level.position}"], title: sponsor.name - - content_for :modals do - = render 'modal_description', object: sponsor - if conference.call_for_sponsors.try(:open?) .row @@ -31,3 +29,7 @@ Want to sponsor? = link_to(sponsorship_mailto(conference)) do Contact us! + +- conference.sponsors.each do |sponsor| + - content_for :modals do + = render 'modal_description', object: sponsor diff --git a/app/views/conferences/_venue.haml b/app/views/conferences/_venue.haml index c88695ac..2225341b 100644 --- a/app/views/conferences/_venue.haml +++ b/app/views/conferences/_venue.haml @@ -2,11 +2,11 @@ %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 +%section#venue + - if conference.venue.location? + = render '/conferences/venue_map', conference: conference + - else + - cache [conference.venue, conference.venue.commercial, '#splash#venue'] do .container .row .col-md-6 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ee88a24c..aa155bcb 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -43,5 +43,5 @@ You can run, copy, distribute, study, change and improve it. The source code and the developers are on =link_to "github.", "https://github.com/openSUSE/osem" - = content_for(:script_body) + = yield :script_body = piwik_tracking_tag From fa552241632c73f93b3b589df8a806385a15ab95 Mon Sep 17 00:00:00 2001 From: James Mason Date: Thu, 21 Dec 2017 19:06:36 -0800 Subject: [PATCH 46/46] Break up the one-query-of-doom The single query was producing a tremendously large ActiveRecord allocation. While this isn't nearly as cool as one query, it's still a significant reduction in SQL trips, and now has the bonus of only loading what is actually going to be displayed. --- app/controllers/conferences_controller.rb | 60 ++++++++++++------- app/helpers/application_helper.rb | 2 +- app/helpers/conference_helper.rb | 5 +- app/models/conference.rb | 1 - app/views/admin/cfps/_events_cfp.html.haml | 2 +- app/views/admin/programs/show.html.haml | 2 +- app/views/conferences/_booths.haml | 2 +- app/views/conferences/_call_for_content.haml | 12 ++-- app/views/conferences/_call_for_papers.haml | 31 +++++----- app/views/conferences/_call_for_tracks.haml | 9 ++- app/views/conferences/_header.haml | 13 ++-- app/views/conferences/_highlights.haml | 4 +- app/views/conferences/_lodging.haml | 8 +-- app/views/conferences/_program.haml | 23 +++---- app/views/conferences/_registration.haml | 13 ++-- app/views/conferences/_social_media.haml | 22 +++---- app/views/conferences/_sponsors.haml | 31 +++++----- app/views/conferences/_tickets.haml | 4 +- app/views/conferences/_tracks.haml | 2 +- app/views/conferences/_venue.haml | 37 ++++++------ app/views/conferences/_venue_map.haml | 10 ++-- app/views/conferences/show.html.haml | 26 +++++--- .../proposals/_encouragement_text.html.haml | 2 +- spec/features/splashpage_spec.rb | 4 +- spec/features/versions_spec.rb | 12 ++-- spec/helpers/conference_helper_spec.rb | 9 ++- 26 files changed, 181 insertions(+), 165 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 9bd0a4df..4b01ca29 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -9,34 +9,48 @@ class ConferencesController < ApplicationController end def show + # load conference with header content @conference = Conference.unscoped.eager_load( - :organization, :splashpage, - :registration_period, - :tickets, - :confirmed_tracks, - :call_for_events, - :event_types, :program, - :call_for_tracks, - :lodgings, - :call_for_booths, - :confirmed_booths, - :sponsors, - :call_for_sponsors, + :registration_period, :contact, - venue: [:commercial], - highlighted_events: [:speakers], - sponsorship_levels: [:sponsors] - ).order( - 'sponsorship_levels.position ASC', - 'sponsors.name', - 'tracks.name', - 'booths.title', - 'lodgings.name', - 'tickets.price_cents' + venue: :commercial ).find_by(conference_finder_conditions) - authorize! :show, @conference + authorize! :show, @conference # TODO: reduce the 10 queries performed here + + splashpage = @conference.splashpage + if splashpage.include_cfp + cfps = @conference.program.cfps + @call_for_events = cfps.find { |call| call.cfp_type == 'events' } + if @call_for_events.try(:open?) + @event_types = @conference.event_types.pluck(:title) + @track_names = @conference.confirmed_tracks.pluck(:name).sort + end + @call_for_tracks = cfps.find { |call| call.cfp_type == 'tracks' } + end + if splashpage.include_program + @highlights = @conference.highlighted_events.eager_load(:speakers) + if splashpage.include_tracks + @tracks = @conference.confirmed_tracks.eager_load( + :room + ).order('tracks.name') + end + if splashpage.include_booths + @booths = @conference.confirmed_booths.order('title') + end + end + if splashpage.include_registrations || splashpage.include_tickets + @tickets = @conference.tickets.order('price_cents') + end + if splashpage.include_lodgings + @lodgings = @conference.lodgings.order('name') + end + if splashpage.include_sponsors + @sponsorship_levels = @conference.sponsorship_levels.eager_load( + :sponsors + ).order('sponsorship_levels.position ASC', 'sponsors.name') + end end private diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1fd0b6db..f0311c7a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -141,7 +141,7 @@ module ApplicationHelper hint: 'The people responsible for the booth. You can only select existing users.' end - def event_types(conference) + def event_types_sentence(conference) conference.event_types.map { |et| et.title.pluralize }.to_sentence end diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 3909ce92..481461dc 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -1,8 +1,7 @@ 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?) + def one_call_open(*calls) + calls.one? { |call| call.try(:open?) } end # URL for sponsorship emails diff --git a/app/models/conference.rb b/app/models/conference.rb index cb319d32..7f821cdc 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -46,7 +46,6 @@ class Conference < ApplicationRecord 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 diff --git a/app/views/admin/cfps/_events_cfp.html.haml b/app/views/admin/cfps/_events_cfp.html.haml index f4557bb4..686f292e 100644 --- a/app/views/admin/cfps/_events_cfp.html.haml +++ b/app/views/admin/cfps/_events_cfp.html.haml @@ -21,7 +21,7 @@ %dt Event types: %dd - = event_types(@conference) + = event_types_sentence(@conference) %dt Tracks: %dd diff --git a/app/views/admin/programs/show.html.haml b/app/views/admin/programs/show.html.haml index 47e50fb6..eceb21c5 100644 --- a/app/views/admin/programs/show.html.haml +++ b/app/views/admin/programs/show.html.haml @@ -22,7 +22,7 @@ %dt Event types: %dd - = event_types(@conference) + = event_types_sentence(@conference) %dt Tracks: %dd diff --git a/app/views/conferences/_booths.haml b/app/views/conferences/_booths.haml index a6b09251..da14526e 100644 --- a/app/views/conferences/_booths.haml +++ b/app/views/conferences/_booths.haml @@ -2,7 +2,7 @@ .col-md-12 %h3.text-center Booths .row.row-centered - - conference.confirmed_booths.to_a.sort_by!(&:title).each do |booth| + - booths.each do |booth| .col-md-2.col-sm-2.col-centered.col-top.booth %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 4ad6c855..ab24f407 100644 --- a/app/views/conferences/_call_for_content.haml +++ b/app/views/conferences/_call_for_content.haml @@ -5,10 +5,12 @@ %section#call .container .row - - if one_call_open(conference) + - if one_call_open(call_for_events, call_for_tracks) .col-md-3.col-sm-3.hidden-xs   - - if conference.call_for_events.try(:open?) - = render 'call_for_papers', conference: conference + - if call_for_events.try(:open?) + = render 'call_for_papers', conference_id: conference.short_title, + call: call_for_events, event_types: event_types, tracks: tracks .col-md-2.col-sm-2   - - if conference.call_for_tracks.try(:open?) - = render 'call_for_tracks', conference: conference + - if call_for_tracks.try(:open?) + = render 'call_for_tracks', conference_id: conference.short_title, + call: call_for_tracks diff --git a/app/views/conferences/_call_for_papers.haml b/app/views/conferences/_call_for_papers.haml index 8499f4ac..3bf0f295 100644 --- a/app/views/conferences/_call_for_papers.haml +++ b/app/views/conferences/_call_for_papers.haml @@ -1,30 +1,27 @@ -- cache [conference, conference.call_for_events, conference.confirmed_tracks, - '#splash#callforpapers'] do +- cache [conference_id, call, event_types, 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? + - if event_types.any? You can submit proposals for %span.notranslate - = event_types(conference) + '.' - - if conference.confirmed_tracks.any? + = event_types.map(&:pluralize).to_sentence + '.' + - if 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! + = pluralize(tracks.length, 'track') + ':' + = tracks.to_sentence + '.' + The submission period is open + %em.notranslate + = date_string(call.start_date, call.end_date) + '.' + %b + You have + = pluralize(call.remaining_days, 'day') + left! %p.cta-button = link_to "Submit your proposal now", - conference_program_proposals_path(conference.short_title), + conference_program_proposals_path(conference_id), 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 index 59681f71..7eb80fa6 100644 --- a/app/views/conferences/_call_for_tracks.haml +++ b/app/views/conferences/_call_for_tracks.haml @@ -1,4 +1,4 @@ -- cache [conference, conference.call_for_tracks, '#splash#callfortracks'] do +- cache [conference_id, call, '#splash#callfortracks'] do .col-md-5.col-sm-5.text-center %h2 Call for Tracks @@ -8,13 +8,12 @@ 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) + '.' + = date_string(call.start_date, call.end_date) + '.' %b You have - = pluralize(conference.call_for_tracks.remaining_days, 'day') + = pluralize(call.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_id), class: 'btn btn-success btn-lg text-center') diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 7a635ae7..08ad1e94 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,4 +1,4 @@ -- cache [conference, conference.venue, '#splash#header'] do +- cache [conference, venue, '#splash#header'] do #banner .container .row @@ -18,14 +18,13 @@ = 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) + - if venue.website + = sanitize link_to(venue.name, venue.website) - else - = conference.venue.city - - if conference.venue.country_name != 'US' + = venue.city + - if venue.country_name != 'US' • - = conference.venue.country_name + = venue.country_name - unless conference.description.blank? %section#about diff --git a/app/views/conferences/_highlights.haml b/app/views/conferences/_highlights.haml index 6e610370..1949f4a2 100644 --- a/app/views/conferences/_highlights.haml +++ b/app/views/conferences/_highlights.haml @@ -5,10 +5,10 @@ .row .col-md-12 .row.row-centered - - conference.highlighted_events.each do |event| + - highlights.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, + = link_to(conference_program_proposal_path(conference_id, event), class: 'thumbnail') do = image_tag speaker.gravatar_url(size: 300), diff --git a/app/views/conferences/_lodging.haml b/app/views/conferences/_lodging.haml index 301dd142..724e78ca 100644 --- a/app/views/conferences/_lodging.haml +++ b/app/views/conferences/_lodging.haml @@ -2,21 +2,21 @@ %li %a.smoothscroll{ href: '#lodging' } Lodging -- cache [conference.venue, conference.lodgings, '#splash#lodging'] do +- cache [venue, lodgings, '#splash#lodging'] do %section#lodging .container .row .col-md-12.text-center %h2 Where to stay - - if conference.venue + - if venue in - = conference.venue.city + = venue.city %p.lead We recommend the following accommodations for your visit. .row.row-centered - - conference.lodgings.each do |lodging| + - lodgings.each do |lodging| .col-md-4.col-sm-4.col-centered.col-top .thumbnail - if lodging.picture? diff --git a/app/views/conferences/_program.haml b/app/views/conferences/_program.haml index eba300a1..2ab2ef70 100644 --- a/app/views/conferences/_program.haml +++ b/app/views/conferences/_program.haml @@ -2,8 +2,7 @@ %li %a.smoothscroll{ href: '#program' } Program -- cache [@confererence, @conference.confirmed_tracks, - @conference.confirmed_booths,'#splash#program'] do +- cache [conference, highlights, tracks, booths, '#splash#program'] do %section#program .container .row @@ -13,16 +12,17 @@ = conference.title has the most awesome program ever! - - if conference.highlighted_events.any? - = render 'highlights', conference: conference + - unless highlights.blank? + = render 'highlights', conference_id: conference.short_title, + highlights: highlights - if conference.splashpage.include_tracks - - if conference.confirmed_tracks.any? - = render 'tracks', conference: conference + - unless tracks.blank? + = render 'tracks', tracks: tracks - if conference.splashpage.include_booths - - if conference.confirmed_booths.any? - = render 'booths', conference: conference + - unless booths.blank? + = render 'booths', booths: booths - if conference.program.try(:schedule_public?) .row @@ -32,6 +32,7 @@ class: 'btn btn-success btn-lg') do Full Schedule -- conference.confirmed_booths.each do |booth| - - content_for :modals do - = render 'modal_description', object: booth +- unless booths.blank? + - booths.each do |booth| + - content_for :modals do + = render 'modal_description', object: booth diff --git a/app/views/conferences/_registration.haml b/app/views/conferences/_registration.haml index f327344b..d789cbf2 100644 --- a/app/views/conferences/_registration.haml +++ b/app/views/conferences/_registration.haml @@ -2,8 +2,7 @@ %li %a.smoothscroll{ href: '#registration' } Registration -- cache [conference.registration_period, conference.tickets, - '#splash#registration'] do +- cache [conference, registration_period, tickets, '#splash#registration'] do %section#registration .container .row @@ -12,23 +11,23 @@ - if conference.registration_limit_exceeded? %p Sorry, the conference registration limit has exceeded - - elsif conference.tickets.empty? + - elsif 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) + = date_string(registration_period.end_date) so we can plan for the right amount of people. %p.cta-button - else %p The registration period is open - = date_string(conference.registration_period.start_date, - conference.registration_period.end_date) + = date_string(registration_period.start_date, + registration_period.end_date) - if conference.registration_open? %p.cta-button = link_to('Register Now', - new_conference_conference_registration_path(conference.short_title), + new_conference_conference_registration_path(conference_id), class: 'btn btn-lg btn-success') diff --git a/app/views/conferences/_social_media.haml b/app/views/conferences/_social_media.haml index d227c54a..32cf1b16 100644 --- a/app/views/conferences/_social_media.haml +++ b/app/views/conferences/_social_media.haml @@ -1,20 +1,20 @@ -- cache [conference.contact, '#splash#social'] do +- cache [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 + - unless contact.facebook.blank? + = link_to "#{ contact.facebook }" do %i.fa.fa-facebook-square.fa-4x - - unless conference.contact.twitter.blank? - = link_to "#{ conference.contact.twitter }" do + - unless contact.twitter.blank? + = link_to "#{ contact.twitter }" do %i.fa.fa-twitter.fa-4x - - unless conference.contact.instagram.blank? - = link_to "#{ conference.contact.instagram }" do + - unless contact.instagram.blank? + = link_to "#{ contact.instagram }" do %i.fa.fa-instagram.fa-4x - - unless conference.contact.googleplus.blank? - = link_to "#{ conference.contact.googleplus }" do + - unless contact.googleplus.blank? + = link_to "#{ contact.googleplus }" do %i.fa.fa-google-plus-square.fa-4x - - unless conference.contact.email.blank? - = mail_to "#{ conference.contact.email }" do + - unless contact.email.blank? + = mail_to "#{ contact.email }" do %i.fa.fa-envelope-o.fa-4x diff --git a/app/views/conferences/_sponsors.haml b/app/views/conferences/_sponsors.haml index e6cda589..8f4d55c6 100644 --- a/app/views/conferences/_sponsors.haml +++ b/app/views/conferences/_sponsors.haml @@ -2,11 +2,10 @@ %li %a.smoothscroll{ href: '#sponsors' } Sponsors -- cache [conference, conference.sponsors, conference.sponsorship_levels, - conference.try(:call_for_sponsors), '#splash#sponsors'] do +- cache [conference, sponsorship_levels, '#splash#sponsors'] do %section#sponsors .container - - conference.sponsorship_levels.each do |sponsorship_level| + - sponsorship_levels.each do |sponsorship_level| - if sponsorship_level.sponsors.any? .row.text-center %h3 @@ -17,19 +16,21 @@ .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 + - if sponsor.logo_file_name + = image_tag get_logo(sponsor), + class: ['img-responsive', 'img-sponsor', + "img-sponsor-#{sponsorship_level.position}"], + title: sponsor.name + - else + %h4.text-center= sponsor.name - - if conference.call_for_sponsors.try(:open?) - .row - .col-md-12 - %h3.text-center - Want to sponsor? - = link_to(sponsorship_mailto(conference)) do - Contact us! + .row + .col-md-12 + %h3.text-center + Want to sponsor? + = link_to(sponsorship_mailto(conference)) do + Contact us! -- conference.sponsors.each do |sponsor| +- sponsorship_levels.collect(&:sponsors).flatten.each do |sponsor| - content_for :modals do = render 'modal_description', object: sponsor diff --git a/app/views/conferences/_tickets.haml b/app/views/conferences/_tickets.haml index ce4ca802..0a927593 100644 --- a/app/views/conferences/_tickets.haml +++ b/app/views/conferences/_tickets.haml @@ -2,7 +2,7 @@ %li %a.smoothscroll{ href: '#tickets' } Tickets -- cache [conference, conference.tickets, '#splash#tickets'] do +- cache [conference, tickets, '#splash#tickets'] do %section#tickets .container .row @@ -11,7 +11,7 @@ Support = conference.title .row.row-centered - - conference.tickets.each do |ticket| + - 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 diff --git a/app/views/conferences/_tracks.haml b/app/views/conferences/_tracks.haml index 3dd8e628..7742778f 100644 --- a/app/views/conferences/_tracks.haml +++ b/app/views/conferences/_tracks.haml @@ -2,7 +2,7 @@ .col-md-12 %h3.text-center Tracks .row.row-centered - - conference.confirmed_tracks.to_a.sort_by!(&:name).each do |track| + - tracks.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 index 2225341b..fbdcde48 100644 --- a/app/views/conferences/_venue.haml +++ b/app/views/conferences/_venue.haml @@ -3,42 +3,41 @@ %a.smoothscroll{ href: '#venue' } Venue %section#venue - - if conference.venue.location? - = render '/conferences/venue_map', conference: conference + - if venue.location? + = render '/conferences/venue_map', venue: venue - else - - cache [conference.venue, conference.venue.commercial, '#splash#venue'] do + - cache [venue, commercial, '#splash#venue'] do .container .row .col-md-6 .thumbnail#venue-pic - - if commercial = conference.venue.commercial + - if 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" + - elsif venue.picture? + = image_tag venue.picture.url, + title: 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) + = venue.name + - unless venue.description.blank? + = markdown(venue.description) .col-md-6 %h2 - = conference.venue.city + = venue.city \/ - = conference.venue.country_name + = venue.country_name %address - = conference.venue.street + = venue.street %br - = conference.venue.postalcode + ',' - = conference.venue.city + = venue.postalcode + ',' + = venue.city %br - = conference.venue.country_name - - if conference.venue.website + = venue.country_name + - if venue.website %br - = sanitize link_to(h(conference.venue.website), - h(conference.venue.website)) + = sanitize link_to(h(venue.website), h(venue.website)) diff --git a/app/views/conferences/_venue_map.haml b/app/views/conferences/_venue_map.haml index e4e56ea3..07f387bc 100644 --- a/app/views/conferences/_venue_map.haml +++ b/app/views/conferences/_venue_map.haml @@ -1,13 +1,13 @@ #map{ style: "height: 500px;" } - content_for(:script_body) do - marker = escape_javascript(render '/conferences/venue_map_marker', - venue: conference.venue) + venue: 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)} + #{venue.latitude.to_f + 0.05}, + #{h(venue.longitude)} ], 11); // add an OpenStreetMap tile layer L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { @@ -20,8 +20,8 @@ // 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} + #{h venue.latitude}, + #{h venue.longitude} ]).addTo(map) .bindPopup("#{marker}") .openPopup(); diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index e5da32e6..d43c99cf 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -12,35 +12,43 @@ #splash -# header/description - = render 'header', conference: @conference + = render 'header', conference: @conference, venue: @conference.venue -# calls for content, or program - if @conference.splashpage.include_cfp - = render 'call_for_content', conference: @conference + = render 'call_for_content', conference: @conference, + call_for_events: @call_for_events, call_for_tracks: @call_for_tracks, + event_types: @event_types, tracks: @track_names + - if @conference.splashpage.include_program - = render 'program', conference: @conference + = render 'program', conference: @conference, tracks: @tracks, + highlights: @highlights, booths: @booths -# attendance/registration - if @conference.splashpage.include_registrations - if @conference.registration_open? - = render 'registration', conference: @conference + = render 'registration', conference: @conference, + registration_period: @conference.registration_period, + tickets: @tickets, conference_id: @conference_id.short_title - if @conference.splashpage.include_tickets && @conference.tickets.any? - = render 'tickets', conference: @conference + = render 'tickets', conference: @conference, tickets: @tickets -# geo - if @conference.splashpage.include_venue && @conference.venue - = render 'venue', conference: @conference + = render 'venue', conference: @conference, venue: @conference.venue, + commercial: @conference.venue.commercial - if @conference.splashpage.include_lodgings && @conference.lodgings.any? - = render 'lodging', conference: @conference + = render 'lodging', venue: @conference.venue, lodgings: @lodgings -# sponsorship - if @conference.splashpage.include_sponsors - = render 'sponsors', conference: @conference + = render 'sponsors', conference: @conference, + sponsorship_levels: @sponsorship_levels -# footer - if @conference.splashpage.include_social_media - if @conference.contact.has_social_media? - = render 'social_media', conference: @conference + = render 'social_media', contact: @conference.contact = render 'footer' = yield :modals diff --git a/app/views/proposals/_encouragement_text.html.haml b/app/views/proposals/_encouragement_text.html.haml index 48fcd045..ad9f01ea 100644 --- a/app/views/proposals/_encouragement_text.html.haml +++ b/app/views/proposals/_encouragement_text.html.haml @@ -1,7 +1,7 @@ %p.lead - if @program.event_types.any? You can submit proposals for - = "#{event_types(@conference)}." + = "#{event_types_sentence(@conference)}." - if @program.tracks.confirmed.cfp_active.any? Proposals should fit in one of the = "#{pluralize(@program.tracks.confirmed.cfp_active.count, 'track')}:" diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index d33c6c85..006df419 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -13,7 +13,7 @@ feature Splashpage do visit admin_conference_splashpage_path(conference.short_title) click_link 'Create Splashpage' - click_button 'Save Splashpage' + click_button 'Save Changes' expect(flash).to eq('Splashpage successfully created.') expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) @@ -28,7 +28,7 @@ feature Splashpage do click_link 'Edit' check('Make splash page public') - click_button 'Save Splashpage' + click_button 'Save Changes' expect(flash).to eq('Splashpage successfully updated.') expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 1451b907..62536019 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -233,18 +233,18 @@ feature 'Version' do scenario 'display changes in splashpages', feature: true, versioning: true, js: true do visit admin_conference_splashpage_path(conference.short_title) click_link 'Create Splashpage' - click_button 'Save Splashpage' + click_button 'Save Changes' click_link 'Edit' - uncheck('Display program') - uncheck('Display call for papers and call for tracks information on splashpage, while open') - uncheck('Display venue') + uncheck('Display the program') + uncheck('Display call for papers and call for tracks, while open') + uncheck('Display the venue') uncheck('Display tickets') uncheck('Display the lodgings') uncheck('Display sponsors') - uncheck('Display social media') + uncheck('Display social media links') check('Make splash page public?') - click_button 'Save Splashpage' + click_button 'Save Changes' splashpage_id = conference.splashpage.id click_link 'Delete' diff --git a/spec/helpers/conference_helper_spec.rb b/spec/helpers/conference_helper_spec.rb index 2ed5517e..09e38e69 100644 --- a/spec/helpers/conference_helper_spec.rb +++ b/spec/helpers/conference_helper_spec.rb @@ -6,7 +6,7 @@ describe ConferenceHelper, type: :helper do describe '#one_call_open' do it 'is falsey if neither call is open' do - expect(one_call_open(conference)).to be_falsey + expect(one_call_open(*conference.program.cfps)).to be_falsey end it 'is truthy if call_for_papers is open' do @@ -17,8 +17,7 @@ describe ConferenceHelper, type: :helper do start_date: conference.start_date, end_date: conference.end_date ) - - expect(one_call_open(conference)).to be_truthy + expect(one_call_open(*conference.program.cfps)).to be_truthy end it 'is truthy if call_for_tracks is open' do @@ -30,7 +29,7 @@ describe ConferenceHelper, type: :helper do end_date: conference.end_date ) - expect(one_call_open(conference)).to be_truthy + expect(one_call_open(*conference.program.cfps)).to be_truthy end it 'is falsey if both calls are open' do @@ -49,7 +48,7 @@ describe ConferenceHelper, type: :helper do end_date: conference.end_date ) - expect(one_call_open(conference)).to be_falsey + expect(one_call_open(*conference.program.cfps)).to be_falsey end end