From e731a6b58fe0d340a23413387f8aab1d0f96cf0d Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 18:41:08 +0530 Subject: [PATCH 1/5] Adds migration for banner photo --- app/models/conference.rb | 14 ++++++++++---- ...0140620130306_add_banner_photo_to_conference.rb | 8 ++++++++ db/schema.rb | 8 ++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20140620130306_add_banner_photo_to_conference.rb diff --git a/app/models/conference.rb b/app/models/conference.rb index 4816cf50..7eb14759 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -20,7 +20,7 @@ class Conference < ActiveRecord::Base :include_sponsors_in_splash, :include_tracks_in_splash, :include_tickets_in_splash, :include_social_media_in_splash, :include_program_in_splash, :make_conference_public, - :photos_attributes + :photos_attributes, :banner_photo has_paper_trail @@ -63,12 +63,18 @@ class Conference < ActiveRecord::Base accepts_nested_attributes_for :photos, allow_destroy: true has_attached_file :logo, - :styles => {:thumb => "100x100>", :large => "300x300>" } + styles: { thumb: '100x100>', large: '300x300>' } validates_attachment_content_type :logo, - :content_type => [/jpg/, /jpeg/, /png/, /gif/], - :size => { :in => 0..500.kilobytes } + content_type: [/jpg/, /jpeg/, /png/, /gif/], + size: { in: 0..500.kilobytes } + has_attached_file :banner_photo, + styles: { thumb: '100x100>', large: '1300x700>' } + + validates_attachment_content_type :banner_photo, + content_type: [/jpg/, /jpeg/, /png/, /gif/], + size: { in: 0..500.kilobytes } validates_presence_of :title, :short_title, :social_tag, diff --git a/db/migrate/20140620130306_add_banner_photo_to_conference.rb b/db/migrate/20140620130306_add_banner_photo_to_conference.rb new file mode 100644 index 00000000..37b66b6e --- /dev/null +++ b/db/migrate/20140620130306_add_banner_photo_to_conference.rb @@ -0,0 +1,8 @@ +class AddBannerPhotoToConference < ActiveRecord::Migration + def change + add_column :conferences, :banner_photo_file_name, :string + add_column :conferences, :banner_photo_content_type, :string + add_column :conferences, :banner_photo_file_size, :integer + add_column :conferences, :banner_photo_updated_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 71258bb0..90d0777c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140618062623) do +ActiveRecord::Schema.define(version: 20140620130306) do create_table "answers", force: true do |t| t.string "title" @@ -94,7 +94,11 @@ ActiveRecord::Schema.define(version: 20140618062623) do t.boolean "include_tickets_in_splash", default: false t.boolean "include_social_media_in_splash", default: false t.boolean "include_program_in_splash", default: false - t.boolean "make_conference_public", default: false + t.boolean "make_conference_public", default: false + t.string "banner_photo_file_name" + t.string "banner_photo_content_type" + t.integer "banner_photo_file_size" + t.datetime "banner_photo_updated_at" end create_table "conferences_questions", id: false, force: true do |t| From 095aa2b020fe765f4e117470553af85913d46f2e Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 19:12:52 +0530 Subject: [PATCH 2/5] Adds banner photo to settings --- app/views/admin/conference/edit.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index 6acdc847..4bef2cfa 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -9,7 +9,9 @@ = f.input :social_tag, :hint => "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'" = f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system." = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} - = f.input :description, hint: 'This description will be shown in the program segement of the Splash' + = f.inputs name: 'Banner for Splash' do + = f.input :banner_photo, hint: 'This will be the top most component of the splash.This background cover will contain start_date and end_date of the conference and the description' + = f.input :description, hint: 'This description will be shown at the bottom of the banner photo of the Splash' = f.inputs :name => "Scheduling" do = f.input :timezone, :as => :time_zone, :hint => "The conference time zone" From 524f22835d676bdf6265446a7d219c21964a952e Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 19:22:25 +0530 Subject: [PATCH 3/5] Adds include_banner_in_splash to settings dashboard --- app/models/conference.rb | 3 ++- app/views/admin/conference/edit.html.haml | 1 + ...40620134535_add_include_banner_in_splash_to_conference.rb | 5 +++++ db/schema.rb | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20140620134535_add_include_banner_in_splash_to_conference.rb diff --git a/app/models/conference.rb b/app/models/conference.rb index 7eb14759..1d0ac01d 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -20,7 +20,8 @@ class Conference < ActiveRecord::Base :include_sponsors_in_splash, :include_tracks_in_splash, :include_tickets_in_splash, :include_social_media_in_splash, :include_program_in_splash, :make_conference_public, - :photos_attributes, :banner_photo + :photos_attributes, :banner_photo, + :include_banner_in_splash has_paper_trail diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index 4bef2cfa..0b6c043f 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -10,6 +10,7 @@ = f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system." = f.input :color, :hint => "The color will be used eg for the dashboard.", :input_html => {:size => 6, :type => "color"} = f.inputs name: 'Banner for Splash' do + = f.input :include_banner_in_splash, hint: 'This enable the Banner Photo with description to be displayed on the splash' = f.input :banner_photo, hint: 'This will be the top most component of the splash.This background cover will contain start_date and end_date of the conference and the description' = f.input :description, hint: 'This description will be shown at the bottom of the banner photo of the Splash' diff --git a/db/migrate/20140620134535_add_include_banner_in_splash_to_conference.rb b/db/migrate/20140620134535_add_include_banner_in_splash_to_conference.rb new file mode 100644 index 00000000..99e72412 --- /dev/null +++ b/db/migrate/20140620134535_add_include_banner_in_splash_to_conference.rb @@ -0,0 +1,5 @@ +class AddIncludeBannerInSplashToConference < ActiveRecord::Migration + def change + add_column :conferences, :include_banner_in_splash, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 90d0777c..d140e248 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140620130306) do +ActiveRecord::Schema.define(version: 20140620134535) do create_table "answers", force: true do |t| t.string "title" @@ -99,6 +99,7 @@ ActiveRecord::Schema.define(version: 20140620130306) do t.string "banner_photo_content_type" t.integer "banner_photo_file_size" t.datetime "banner_photo_updated_at" + t.boolean "include_banner_in_splash", default: false end create_table "conferences_questions", id: false, force: true do |t| From cc8299294d1f2073b19849d08d14927dc52c7e85 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 20:16:22 +0530 Subject: [PATCH 4/5] Splash view for banner component --- app/assets/stylesheets/osem.css | 15 ++++++++++----- app/views/conference/_location.html.haml | 4 ++-- app/views/conference/show.html.haml | 16 ++++++++++++++-- spec/views/conference/show.html.haml_spec.rb | 9 +++++++-- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/osem.css b/app/assets/stylesheets/osem.css index 19c8e07c..f3dac7d0 100644 --- a/app/assets/stylesheets/osem.css +++ b/app/assets/stylesheets/osem.css @@ -92,22 +92,27 @@ body { padding-bottom: 20px; } -#venue-banner-disp{ +.banner-disp{ background-repeat: no-repeat; background-position: center center; width: 100%; background-size: cover; -webkit-background-size:cover; } -#venue-banner-disp.with-background{ +.banner-disp.with-location-background{ min-height: 500px; } - -#venue-banner-disp li{ +.banner-disp.with-splash-banner{ + min-height: 700px; +} +.location-links li{ display: inline-block; margin-right: 2em; } - +.banner-text{ + padding-top: 10%; + color: #fff; +} .pad{ padding-top: 35px; padding-bottom: 35px; diff --git a/app/views/conference/_location.html.haml b/app/views/conference/_location.html.haml index c98e9fd1..cadeb9fb 100644 --- a/app/views/conference/_location.html.haml +++ b/app/views/conference/_location.html.haml @@ -3,7 +3,7 @@ %a{ href: '#location' } Location -%div#venue-banner-disp{ style: ("background-image: url(#{@conference.venue.photo})" unless @conference.venue.photo.blank?), class:('with-background' unless @conference.venue.photo.blank?) } +%div.banner-disp{ style: ("background-image: url(#{@conference.venue.photo})" unless @conference.venue.photo.blank?), class:('with-location-background' unless @conference.venue.photo.blank?) } %div.container.text-center .div.row.col-md-12 - unless @conference.venue.name.blank? @@ -15,7 +15,7 @@ - unless @conference.venue.description.blank? %p %strong #{ @conference.venue.description } - %ul + %ul.location-links - unless @conference.venue.address.blank? %li %b diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 5f865265..514b3e0c 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,8 +1,20 @@ = content_for :brand do = link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand' = content_for :splash do - - unless @conference.description.blank? - %p= @conference.description + - if @conference.include_banner_in_splash? + %section{ id: 'splash-banner' } + %div.banner-disp{ style: ("background-image: url(#{@conference.banner_photo})" unless @conference.banner_photo.blank?), class:('with-splash-banner' unless @conference.banner_photo.blank?) } + %div.container.text-center.banner-text + .row.col-md-12 + %h1 + = @conference.title + - if @conference.start_date && @conference.end_date + %h3 + = conference_date_string(@conference) + + - unless @conference.description.blank? + .row-fluid.col-md-12.lead + %p= @conference.description - if @conference.include_program_in_splash? %section{ id: 'program' } diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index 2c77b3c7..717a1223 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -16,7 +16,8 @@ describe 'conference/show.html.haml' do include_sponsors_in_splash: true, include_social_media_in_splash: true, include_tracks_in_splash: true, - include_tickets_in_splash: true) + include_tickets_in_splash: true, + include_banner_in_splash: true) @conference.call_for_papers = create(:call_for_papers, conference: @conference, include_cfp_in_splash: true) @conference.sponsorship_levels << create(:sponsorship_level, conference: @conference) @@ -30,8 +31,12 @@ describe 'conference/show.html.haml' do render end - it 'renders program partial' do + it 'renders banner component' do expect(view.content_for(:splash)).to include("#{@conference.description}") + expect(view.content_for(:splash)).to include("#{@conference.title}") + end + + it 'renders program partial' do expect(view).to render_template(partial: 'conference/_program') end From 38abcd89029563d3b61a2d31b4359a00ce010e35 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Fri, 20 Jun 2014 22:41:18 +0530 Subject: [PATCH 5/5] Fix styling and layouts in splash view --- app/assets/stylesheets/osem.css | 9 ++++- app/views/conference/_location.html.haml | 2 +- app/views/conference/show.html.haml | 48 ++++++++++++------------ 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/app/assets/stylesheets/osem.css b/app/assets/stylesheets/osem.css index f3dac7d0..5adccac6 100644 --- a/app/assets/stylesheets/osem.css +++ b/app/assets/stylesheets/osem.css @@ -99,20 +99,25 @@ body { background-size: cover; -webkit-background-size:cover; } -.banner-disp.with-location-background{ + +#location .with-background { min-height: 500px; } -.banner-disp.with-splash-banner{ + +#splash-banner .with-background{ min-height: 700px; } + .location-links li{ display: inline-block; margin-right: 2em; } + .banner-text{ padding-top: 10%; color: #fff; } + .pad{ padding-top: 35px; padding-bottom: 35px; diff --git a/app/views/conference/_location.html.haml b/app/views/conference/_location.html.haml index cadeb9fb..70325c81 100644 --- a/app/views/conference/_location.html.haml +++ b/app/views/conference/_location.html.haml @@ -3,7 +3,7 @@ %a{ href: '#location' } Location -%div.banner-disp{ style: ("background-image: url(#{@conference.venue.photo})" unless @conference.venue.photo.blank?), class:('with-location-background' unless @conference.venue.photo.blank?) } +%div.banner-disp{ style: ("background-image: url(#{@conference.venue.photo})" unless @conference.venue.photo.blank?), class:('with-background' unless @conference.venue.photo.blank?) } %div.container.text-center .div.row.col-md-12 - unless @conference.venue.name.blank? diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 514b3e0c..a3b042ab 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -3,18 +3,18 @@ = content_for :splash do - if @conference.include_banner_in_splash? %section{ id: 'splash-banner' } - %div.banner-disp{ style: ("background-image: url(#{@conference.banner_photo})" unless @conference.banner_photo.blank?), class:('with-splash-banner' unless @conference.banner_photo.blank?) } - %div.container.text-center.banner-text - .row.col-md-12 - %h1 - = @conference.title - - if @conference.start_date && @conference.end_date - %h3 - = conference_date_string(@conference) + %div.banner-disp{ style: ("background-image: url(#{@conference.banner_photo})" unless @conference.banner_photo.blank?), class:('with-background' unless @conference.banner_photo.blank?) } + %div.container.text-center.banner-text + .row.col-md-12 + %h1 + = @conference.title + - if @conference.start_date && @conference.end_date + %h3 + = conference_date_string(@conference) - - unless @conference.description.blank? - .row-fluid.col-md-12.lead - %p= @conference.description + - unless @conference.description.blank? + .row-fluid.col-md-12.lead + %p= @conference.description - if @conference.include_program_in_splash? %section{ id: 'program' } @@ -23,32 +23,32 @@ - if @conference.include_registrations_in_splash? %section{ id: 'registration' } - .pad - = render 'registration' + .pad + = render 'registration' -unless @conference.call_for_papers.blank? - if @conference.call_for_papers.include_cfp_in_splash? %section{ id:'callforpapers' } - .pad - = render 'call_for_papers' + .pad + = render 'call_for_papers' -unless @conference.venue.blank? - if @conference.venue.include_venue_in_splash? %section{ id: 'location' } - .pad - = render 'location' - - unless @conference.venue.lodgings.empty? - - if @conference.venue.include_lodgings_in_splash? - = render 'lodging' + .pad + = render 'location' + - unless @conference.venue.lodgings.empty? + - if @conference.venue.include_lodgings_in_splash? + = render 'lodging' - if @conference.include_sponsors_in_splash? %section{ id: 'sponsors' } - .pad - = render 'sponsor' + .pad + = render 'sponsor' - if @conference.include_social_media_in_splash? %section{ id: 'social-media' } - .pad - = render 'social_media' + .pad + = render 'social_media'