diff --git a/Gemfile b/Gemfile index 2c549672..96040044 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -# Use rails as framework +# Use rails as framework gem 'rails', '~> 4.1' # Use mysql as the database for Active Record @@ -82,13 +82,13 @@ group :development, :test do gem 'shoulda' end -# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/ +# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/ gem 'protected_attributes' # We use this bootstrap/html5 rdoc generator gem 'rdoc-generator-fivefish' -# We use factory_girl for seeds +# We use factory_girl for seeds gem 'factory_girl_rails' # Use guard and spring for testing in development diff --git a/app/assets/images/fb-logo-blue.png b/app/assets/images/fb-logo-blue.png new file mode 100644 index 00000000..86f565a1 Binary files /dev/null and b/app/assets/images/fb-logo-blue.png differ diff --git a/app/assets/images/flickr.png b/app/assets/images/flickr.png new file mode 100644 index 00000000..3a76415b Binary files /dev/null and b/app/assets/images/flickr.png differ diff --git a/app/assets/images/google-logo.png b/app/assets/images/google-logo.png new file mode 100644 index 00000000..ccd1d4a2 Binary files /dev/null and b/app/assets/images/google-logo.png differ diff --git a/app/assets/images/instagram.png b/app/assets/images/instagram.png new file mode 100644 index 00000000..992f8dd3 Binary files /dev/null and b/app/assets/images/instagram.png differ diff --git a/app/assets/images/slideshare.png b/app/assets/images/slideshare.png new file mode 100644 index 00000000..d730f0ae Binary files /dev/null and b/app/assets/images/slideshare.png differ diff --git a/app/assets/images/speakerdeck.png b/app/assets/images/speakerdeck.png new file mode 100644 index 00000000..895ad79b Binary files /dev/null and b/app/assets/images/speakerdeck.png differ diff --git a/app/assets/images/twitter-logo-blue.png b/app/assets/images/twitter-logo-blue.png new file mode 100644 index 00000000..a1435701 Binary files /dev/null and b/app/assets/images/twitter-logo-blue.png differ diff --git a/app/assets/images/vimeo-logo-dark.png b/app/assets/images/vimeo-logo-dark.png new file mode 100644 index 00000000..c8952544 Binary files /dev/null and b/app/assets/images/vimeo-logo-dark.png differ diff --git a/app/assets/images/youtube-color-logo.png b/app/assets/images/youtube-color-logo.png new file mode 100644 index 00000000..b29e7789 Binary files /dev/null and b/app/assets/images/youtube-color-logo.png differ diff --git a/app/models/conference.rb b/app/models/conference.rb index b49a901e..45e82ba6 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -2,6 +2,7 @@ # This class represents a conference class Conference < ActiveRecord::Base + require 'uri' attr_accessible :title, :short_title, :social_tag, :contact_email, :timezone, :html_export_path, :start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes, :use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes, @@ -10,7 +11,8 @@ class Conference < ActiveRecord::Base :difficulty_levels_attributes, :use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers, :media_id, :media_type, :color, :description, - :registration_description, :ticket_description + :registration_description, :ticket_description, :facebook_url, + :google_url, :twitter_url has_paper_trail @@ -59,6 +61,8 @@ class Conference < ActiveRecord::Base :social_tag, :start_date, :end_date + validates :facebook_url, :twitter_url, :google_url, + format: URI::regexp(%w(http https)), allow_blank: true 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/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index d920ba1f..d0ada996 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -24,9 +24,12 @@ = 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 => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "link" and copy the link %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 => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "link" and copy the link %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.input :facebook_url, hint: 'This will appear in the social media section as link to the Facebook page of your Conference' + = f.input :google_url, label: 'Google+ Url', hint: 'This will appear in the social media section as the link to the Google+ Page of your Conference' + = f.input :twitter_url, hint: 'This will appear in the social media section as the link to the Twitter Page of your Conference' = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/conference/_registration.html.haml b/app/views/conference/_registration.html.haml index 0b63646b..b11953fa 100644 --- a/app/views/conference/_registration.html.haml +++ b/app/views/conference/_registration.html.haml @@ -3,7 +3,7 @@ %a{ href: '#registration' } Registration %div.container.text-center %div.row - %h2 Registration + %h1 Registration - if !@conference.registration_description.blank? %p = @conference.registration_description diff --git a/app/views/conference/_social_media.html.haml b/app/views/conference/_social_media.html.haml new file mode 100644 index 00000000..208b7dc5 --- /dev/null +++ b/app/views/conference/_social_media.html.haml @@ -0,0 +1,36 @@ += content_for :splash_nav do + %li + %a{ href: '#social-media' } Social Media + +%div.container#social-media.text-center + %h1 We are Social + %div.row + - if !@conference.facebook_url.blank? + %div.col-md-3 + = link_to image_tag('fb-logo-blue.png', class: 'img-responsive'), + "#{ @conference.facebook_url }" + - if !@conference.twitter_url.blank? + %div.col-md-3 + = link_to image_tag('twitter-logo-blue.png', class: 'img-responsive'), "#{ @conference.twitter_url }" + - if !@conference.media_type.blank? && !@conference.media_id.blank? + %div.col-md-3 + -if @conference.media_type == 'YouTube' + = link_to image_tag('youtube-color-logo.png', class: 'img-responsive'), + "http://youtu.be/#{ @conference.media_id}" + -if @conference.media_type == 'SlideShare' + = link_to image_tag('slideshare.png', class: 'img-responsive'), "#{ @conference.media_id}" + -if @conference.media_type == 'Instagram' + = link_to image_tag('instagram.png', class: 'img-responsive'), + "http://instagram.com/p/#{ @conference.media_id}" + -if @conference.media_type == 'Vimeo' + = link_to image_tag('vimeo-logo-dark.png', class: 'img-responsive'), + "http://vimeo.com/#{ @conference.media_id}" + -if @conference.media_type == 'Speakerdeck' + = link_to image_tag('speakerdeck.png', class: 'img-responsive'),"#{ @conference.media_id}" + -if @conference.media_type == 'Flickr' + = link_to image_tag('flickr.png', class: 'img-responsive'), + "https://flic.kr/p/#{ @conference.media_id}" + - if !@conference.google_url.blank? + %div.col-md-3 + = link_to image_tag('google-logo.png', class: 'img-responsive'), + "#{ @conference.google_url }" diff --git a/app/views/conference/_tickets.html.haml b/app/views/conference/_tickets.html.haml index 2fcfbf72..0cd5eea1 100644 --- a/app/views/conference/_tickets.html.haml +++ b/app/views/conference/_tickets.html.haml @@ -1,5 +1,5 @@ %div.row - %h3 Tickets + %h2 Tickets -if !@conference.ticket_description.blank? %p #{ @conference.ticket_description } - @conference.supporter_levels.each do |s| diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index cbadd6d3..3accff17 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -1,9 +1,13 @@ = content_for :brand do = link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand' + %div#program = render 'program' %div#registration = render 'registration' %div#callforpapers = render 'call_for_papers' +%div#social-media + = render 'social_media' + diff --git a/db/migrate/20140531130140_add_facebook_url_to_conference.rb b/db/migrate/20140531130140_add_facebook_url_to_conference.rb new file mode 100644 index 00000000..47603c38 --- /dev/null +++ b/db/migrate/20140531130140_add_facebook_url_to_conference.rb @@ -0,0 +1,5 @@ +class AddFacebookUrlToConference < ActiveRecord::Migration + def change + add_column :conferences, :facebook_url, :string + end +end diff --git a/db/migrate/20140531130219_add_google_url_to_conference.rb b/db/migrate/20140531130219_add_google_url_to_conference.rb new file mode 100644 index 00000000..0d8379aa --- /dev/null +++ b/db/migrate/20140531130219_add_google_url_to_conference.rb @@ -0,0 +1,5 @@ +class AddGoogleUrlToConference < ActiveRecord::Migration + def change + add_column :conferences, :google_url, :string + end +end diff --git a/db/migrate/20140531130500_add_twitter_url_to_conference.rb b/db/migrate/20140531130500_add_twitter_url_to_conference.rb new file mode 100644 index 00000000..53349cdb --- /dev/null +++ b/db/migrate/20140531130500_add_twitter_url_to_conference.rb @@ -0,0 +1,5 @@ +class AddTwitterUrlToConference < ActiveRecord::Migration + def change + add_column :conferences, :twitter_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 2ef5c751..122ea205 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -81,6 +81,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do t.text "description" t.text "registration_description" t.text "ticket_description" + t.string "facebook_url" + t.string "google_url" + t.string "twitter_url" end create_table "conferences_questions", id: false, force: true do |t| diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index 8e32e586..24edfbf0 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -4,14 +4,18 @@ describe 'conference/show.html.haml' do @conference = create(:conference, registration_description: 'Lorem Ipsum Dolor', registration_start_date: Date.today, registration_end_date: Date.tomorrow, - description: 'Lorem Ipsum') + description: 'Lorem Ipsum', + facebook_url: 'http://www.fbexample.com', + google_url: 'http://www.google-example.com', + media_type: 'YouTube', + media_id: 'rtyutut') @conference.call_for_papers = create(:call_for_papers, conference: @conference) assign :conference, @conference render end it 'renders program partial' do - expect(render).to include("#{@conference.description}") + expect(rendered).to include("#{@conference.description}") expect(view).to render_template(partial: 'conference/_program') end @@ -21,6 +25,13 @@ describe 'conference/show.html.haml' do end it 'renders call_for_papers partial' do - expect(render).to include("#{@conference.call_for_papers.description}") + expect(rendered).to include("#{@conference.call_for_papers.description}") + end + + it 'renders social media partial' do + expect(view).to render_template('conference/_social_media') + expect(rendered).to include('http://www.fbexample.com') + expect(rendered).to include('http://www.google-example.com') + expect(rendered).to include('http://youtu.be/rtyutut') end end