Merge pull request #271 from gopesht/fix_social_media

Fix social media
This commit is contained in:
Gopesh Tulsyan 2014-07-01 21:50:05 +05:30
commit ef4aed5df0
6 changed files with 20 additions and 26 deletions

View file

@ -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

View file

@ -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"}

View file

@ -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

View file

@ -0,0 +1,5 @@
class AddInstagramUrlToConference < ActiveRecord::Migration
def change
add_column :conferences, :instagram_url, :string
end
end

View file

@ -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|

View file

@ -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