From d0fd21bfc24c963326d5a2dc14c054952a2de425 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Wed, 21 May 2014 15:42:30 +0530 Subject: [PATCH] Program component for splash page --- app/assets/stylesheets/osem.css | 5 +++ app/controllers/conference_controller.rb | 1 + app/models/conference.rb | 5 +-- app/models/person.rb | 4 ++- app/models/track.rb | 2 +- app/views/admin/conference/new.html.haml | 1 + app/views/admin/conference/show.html.haml | 30 ++++++++++++++++- app/views/admin/people/_form.html.haml | 1 + app/views/conference/show.html.haml | 33 ++++++++++++++++++- .../20140521073920_add_featured_to_people.rb | 5 +++ ...521094848_add_description_to_conference.rb | 5 +++ .../controllers/conference_controller_spec.rb | 3 +- spec/factories/conferences.rb | 11 +++++++ spec/factories/person.rb | 9 +++++ spec/factories/registrations.rb | 6 ++++ spec/factories/users.rb | 2 +- spec/features/conference_spec.rb | 2 +- spec/views/conference/show.html.haml_spec.rb | 4 +-- 18 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20140521073920_add_featured_to_people.rb create mode 100644 db/migrate/20140521094848_add_description_to_conference.rb create mode 100644 spec/factories/person.rb create mode 100644 spec/factories/registrations.rb diff --git a/app/assets/stylesheets/osem.css b/app/assets/stylesheets/osem.css index 41c72d59..166a0fff 100644 --- a/app/assets/stylesheets/osem.css +++ b/app/assets/stylesheets/osem.css @@ -50,3 +50,8 @@ body > #messages { display: block; } } + +/*spalsh page css*/ +.speaker-pic{ + margin: 0 auto; +} diff --git a/app/controllers/conference_controller.rb b/app/controllers/conference_controller.rb index 7a872c26..f78a6ccb 100644 --- a/app/controllers/conference_controller.rb +++ b/app/controllers/conference_controller.rb @@ -1,5 +1,6 @@ class ConferenceController < ApplicationController def show @conference = Conference.find_by_short_title(params[:id]) + @keynote_speakers = @conference.registrations.joins(:person).where('featured=?', true) end end diff --git a/app/models/conference.rb b/app/models/conference.rb index c7847610..21557abc 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -9,7 +9,7 @@ class Conference < ActiveRecord::Base :questions_attributes, :question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes, :use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers, - :media_id, :media_type + :media_id, :media_type, :description has_paper_trail @@ -57,7 +57,8 @@ class Conference < ActiveRecord::Base :short_title, :social_tag, :start_date, - :end_date + :end_date, + :description validates_uniqueness_of :short_title validates_format_of :short_title, :with => /\A[a-zA-Z0-9_-]*\z/ before_create :generate_guid diff --git a/app/models/person.rb b/app/models/person.rb index f7a1fd04..ee439037 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -2,7 +2,9 @@ class Person < ActiveRecord::Base include Gravtastic gravtastic :size => 32 - attr_accessible :email, :first_name, :last_name, :public_name, :biography, :company, :avatar, :irc_nickname, :mobile, :tshirt, :languages, :volunteer_experience + attr_accessible :email, :first_name, :last_name, :public_name, :biography, + :company, :avatar, :irc_nickname, :mobile, :tshirt, + :languages, :volunteer_experience, :featured belongs_to :user, :inverse_of => :person has_many :event_people, :dependent => :destroy diff --git a/app/models/track.rb b/app/models/track.rb index 7c6f685f..ffabb7b9 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -1,6 +1,6 @@ class Track < ActiveRecord::Base attr_accessible :name, :description, :color - + validates :description, presence: true belongs_to :conference before_create :generate_guid diff --git a/app/views/admin/conference/new.html.haml b/app/views/admin/conference/new.html.haml index c0d714ec..b3783ab4 100644 --- a/app/views/admin/conference/new.html.haml +++ b/app/views/admin/conference/new.html.haml @@ -4,6 +4,7 @@ = f.inputs 'Basic Information' do = f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'", input_html: { required: 'required' } + = f.input :description, hint: 'Required for program section in the splash page' = f.input :short_title, hint: "A short and unique handle for your conference, using only lower-case letters, numbers and underscores. This will be used to identify your conference in URLs etc. Example: 'froscon2011'", input_html: { required: 'required' } = f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'", diff --git a/app/views/admin/conference/show.html.haml b/app/views/admin/conference/show.html.haml index f78d0597..dde5421e 100644 --- a/app/views/admin/conference/show.html.haml +++ b/app/views/admin/conference/show.html.haml @@ -1,3 +1,31 @@ .row .col-md-8 - %h1 Dashboard for #{@conference.title} \ No newline at end of file + %h1 Dashboard for #{@conference.title} + .col-md-9 + = semantic_form_for(@conference, :url => admin_conference_path(@conference.short_title),:html => {:multipart => true}) do |f| + = f.input :title, :hint => "The full name of the conference, such as 'OpenSUSE Conference 2013'" + = f.input :description, hint: 'Required for program section in the splash page' + = f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs" + = 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.inputs :name => "Scheduling" do + = f.input :timezone, :as => :time_zone, :hint => "The conference time zone" + = f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" } + = f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" } + = f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" } + = f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" } + + = f.inputs :name => "Media" do + - if !@conference.logo.blank? + = image_tag @conference.logo(:thumb) + = f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page." + = f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM." + = f.input :media_id, :label => "Conference Promo Media ID", :as => :string + %p{:class => "help-block media-type", :id => "youtube-help"} Go to your YouTube video, click on "share" and copy everything behind http://youtu.be/" + %p{:class => "help-block media-type", :id => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "embed" and copy the id + %p{:class => "help-block media-type", :id => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/ + %p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/ + %p{:class => "help-block media-type", :id => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id + %p{:class => "help-block media-type", :id => "instagram-help", :style => "display:none"} Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol) + = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/admin/people/_form.html.haml b/app/views/admin/people/_form.html.haml index a4c5d045..10b150f4 100644 --- a/app/views/admin/people/_form.html.haml +++ b/app/views/admin/people/_form.html.haml @@ -1,5 +1,6 @@ = semantic_form_for [:admin, @person] do |f| = f.inputs "Basic Information" do + = f.input :featured, label: "Keynote Speaker" = f.input :first_name, :as => :string = f.input :last_name, :as => :string = f.input :public_name, :as => :string diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 021d213f..06cfe5d8 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,3 +1,34 @@ = content_for :splash_logo do = link_to @conference.title, "#", :class => 'navbar-brand' -= render :partial => "home/conference_details", :locals => {:conference => @conference} \ No newline at end of file += content_for :splash_header do + %ul.nav.navbar-nav + %li + %a{ href: '#program' } Program +%div.container#program.text-center + %div.row + %div.col-md-12 + %h1 Program + %p + = @conference.description + %span You can find the complete schedule in our + %span + = link_to 'Master Schedule', conference_schedule_path(@conference.short_title) + - if !@keynote_speakers.blank? + %div.row + %h2 Keynote Speakers + - @keynote_speakers.each do |k| + %div.col-lg-3.text-center + = image_tag(k.person.gravatar_url(size: '140'), class: 'img-responsive img-circle speaker-pic') + %h4 + = k.person.first_name + = k.person.last_name + -if !@conference.tracks.blank? + %div.row + %div.col-md-12 + %h2 Tracks + - @conference.tracks.each do |t| + %div.col-md-4 + %h4 + = t.name + %p + = t.description diff --git a/db/migrate/20140521073920_add_featured_to_people.rb b/db/migrate/20140521073920_add_featured_to_people.rb new file mode 100644 index 00000000..3df42acc --- /dev/null +++ b/db/migrate/20140521073920_add_featured_to_people.rb @@ -0,0 +1,5 @@ +class AddFeaturedToPeople < ActiveRecord::Migration + def change + add_column :people, :featured, :boolean, default: false + end +end diff --git a/db/migrate/20140521094848_add_description_to_conference.rb b/db/migrate/20140521094848_add_description_to_conference.rb new file mode 100644 index 00000000..3987a1fe --- /dev/null +++ b/db/migrate/20140521094848_add_description_to_conference.rb @@ -0,0 +1,5 @@ +class AddDescriptionToConference < ActiveRecord::Migration + def change + add_column :conferences, :description, :string + end +end diff --git a/spec/controllers/conference_controller_spec.rb b/spec/controllers/conference_controller_spec.rb index 464288cd..c29b27bc 100644 --- a/spec/controllers/conference_controller_spec.rb +++ b/spec/controllers/conference_controller_spec.rb @@ -1,9 +1,10 @@ require 'spec_helper' describe ConferenceController do + let(:conference) { create(:conference_with_registration) } describe 'GET #show' do it 'returns http success' do - get :show, id: 'sample' + get :show, id: conference.short_title expect(response).to be_success end end diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index 8fdbe34d..681b2b4a 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -6,8 +6,19 @@ FactoryGirl.define do sequence(:short_title) { |n| "dps#{n}14" } social_tag 'dps14' timezone 'Amsterdam' + description 'Lorem Ipsum dolsum' contact_email 'admin@example.com' start_date Date.today end_date Date.tomorrow + factory :conference_with_registration do + after(:build) do |conference| + create(:participant_role) + create(:admin_role) + user = build(:user) + conference.registrations << build(:registration, + conference: conference, + person: user.person) + end + end end end diff --git a/spec/factories/person.rb b/spec/factories/person.rb new file mode 100644 index 00000000..054630e7 --- /dev/null +++ b/spec/factories/person.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :person do + first_name 'Example first_name' + last_name 'Example last_name' + sequence(:email) { |n| "example#{n}@example.com" } + featured true + user + end +end diff --git a/spec/factories/registrations.rb b/spec/factories/registrations.rb new file mode 100644 index 00000000..fdf18e8f --- /dev/null +++ b/spec/factories/registrations.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :registration do + person + conference + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 5fe55ab8..c04fd3a7 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :user do - email 'example@example.com' + sequence(:email) { |n| "example#{n}@example.com" } password 'changeme' password_confirmation 'changeme' confirmed_at Time.now diff --git a/spec/features/conference_spec.rb b/spec/features/conference_spec.rb index 06fb21dc..6a8238d5 100644 --- a/spec/features/conference_spec.rb +++ b/spec/features/conference_spec.rb @@ -16,7 +16,7 @@ feature Conference do fill_in 'conference_title', with: 'Example Con' fill_in 'conference_short_title', with: 'ExCon' fill_in 'conference_social_tag', with: 'ExCon' - + fill_in 'conference_description', with: 'ExCon description' select('(GMT+01:00) Berlin', from: 'conference[timezone]') today = Date.today - 1 diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index b822a73e..e03334a3 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' describe 'conference/show.html.haml' do it 'renders conference details' do - @conference = create(:conference) + @conference = create(:conference, description: 'Lorem Ipsum dolsum') assign :conference, @conference render - expect(render).to include("#{@conference.title}") + expect(render).to include("#{@conference.description}") end end