diff --git a/app/models/conference.rb b/app/models/conference.rb index 40e3e181..20825c16 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -20,7 +20,7 @@ class Conference < ActiveRecord::Base :include_social_media_in_splash, :include_program_in_splash, :make_conference_public, :photos_attributes, :banner_photo, :include_banner_in_splash, :targets, :targets_attributes, :campaigns, - :campaigns_attributes + :campaigns_attributes, :instagram_url has_paper_trail diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index 0b6c043f..c2725053 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -38,12 +38,13 @@ = 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" -> "link" and copy the link + %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" -> "link" and copy the link + %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.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.input :instagram_url, hint: 'This will appear in the social media section as the link to the Instagram Page of your Conference' = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/app/views/conference/_social_media.html.haml b/app/views/conference/_social_media.html.haml index af091888..2edcd09c 100644 --- a/app/views/conference/_social_media.html.haml +++ b/app/views/conference/_social_media.html.haml @@ -4,33 +4,19 @@ %div.container#social-media.text-center %div.row - - if !@conference.facebook_url.blank? + - unless @conference.facebook_url.blank? %div.col-md-3 = link_to "#{ @conference.facebook_url }" do %i.fa.fa-facebook-square.fa-4x - - if !@conference.twitter_url.blank? + - unless @conference.twitter_url.blank? %div.col-md-3 = link_to "#{ @conference.twitter_url }" do %i.fa.fa-twitter.fa-4x - - if !@conference.media_type.blank? && !@conference.media_id.blank? + - unless @conference.instagram_url.blank? %div.col-md-3 - -if @conference.media_type == 'YouTube' - = link_to "http://youtu.be/#{ @conference.media_id}" do - %i.fa.fa-youtube.fa-4x - -if @conference.media_type == 'SlideShare' - = link_to image_tag('slideshare.png', class: 'img-responsive'), "#{ @conference.media_id}" - -if @conference.media_type == 'Instagram' - = link_to "http://instagram.com/p/#{ @conference.media_id}" do - %i.fa.fa-instagram.fa-4x - -if @conference.media_type == 'Vimeo' - = link_to "http://vimeo.com/#{ @conference.media_id}" do - %i.fa.fa-vimeo-square.fa-4x - -if @conference.media_type == 'Speakerdeck' - = link_to image_tag('speakerdeck.png', class: 'img-responsive'),"#{ @conference.media_id}" - -if @conference.media_type == 'Flickr' - = link_to "https://flic.kr/p/#{ @conference.media_id}" do - %i.fa.fa-flickr.fa-4x - - if !@conference.google_url.blank? + = link_to "#{ @conference.instagram_url }" do + %i.fa.fa-instagram.fa-4x + - unless @conference.google_url.blank? %div.col-md-3 = link_to "#{ @conference.google_url }" do %i.fa.fa-google-plus-square.fa-4x diff --git a/db/migrate/20140627165718_add_instagram_url_to_conference.rb b/db/migrate/20140627165718_add_instagram_url_to_conference.rb new file mode 100644 index 00000000..d405bbc4 --- /dev/null +++ b/db/migrate/20140627165718_add_instagram_url_to_conference.rb @@ -0,0 +1,5 @@ +class AddInstagramUrlToConference < ActiveRecord::Migration + def change + add_column :conferences, :instagram_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index b52e553c..a58e424c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -125,6 +125,7 @@ ActiveRecord::Schema.define(version: 20140626123837) do t.integer "banner_photo_file_size" t.datetime "banner_photo_updated_at" t.boolean "include_banner_in_splash", default: false + t.string "instagram_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 9ea5e023..fb809d84 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -9,8 +9,8 @@ describe 'conference/show.html.haml' do sponsor_email: 'example@example.com', facebook_url: 'http://www.fbexample.com', google_url: 'http://www.google-example.com', - media_type: 'YouTube', - media_id: 'rtyutut', + instagram_url: "http://instagram.com", + twitter_url: "http://twitter.com", include_registrations_in_splash: true, include_program_in_splash: true, include_sponsors_in_splash: true, @@ -64,7 +64,8 @@ describe 'conference/show.html.haml' do expect(view).to render_template('conference/_social_media') expect(view.content_for(:splash)).to include('http://www.fbexample.com') expect(view.content_for(:splash)).to include('http://www.google-example.com') - expect(view.content_for(:splash)).to include('http://youtu.be/rtyutut') + expect(view.content_for(:splash)).to include("http://instagram.com") + expect(view.content_for(:splash)).to include("http://twitter.com") end it 'renders location partial' do