From c5ba8598f52b16584e0f6cde8310568652f3daa2 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Sun, 16 Mar 2014 15:03:28 +0100 Subject: [PATCH] Add Instagram support for events #26 --- app/models/event.rb | 2 +- app/views/proposal/_proposal_form.html.haml | 3 ++- app/views/proposal/show.html.haml | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/event.rb b/app/models/event.rb index 6443feed..8fa7babe 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,7 +3,7 @@ class Event < ActiveRecord::Base has_paper_trail attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :people_attributes, :person, :proposal_additional_speakers, :track_id, :video_id, :video_type, :require_registration, :difficulty_level_id - VIDEO_TYPE = [YOUTUBE = 'YouTube', SLIDE_SHARE = 'SlideShare', FLICKR = 'Flickr', VIMEO = 'Vimeo', SPEAKERDECK = 'Speakerdeck'] + VIDEO_TYPE = [YOUTUBE = 'YouTube', SLIDE_SHARE = 'SlideShare', FLICKR = 'Flickr', VIMEO = 'Vimeo', SPEAKERDECK = 'Speakerdeck', INSTAGRAM = 'Instagram'] validates :video_type, inclusion: {in: VIDEO_TYPE} diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 573b690b..285c3b7f 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -36,7 +36,8 @@ %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 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" -> "embded" and copy the data-id + %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 :video_id, :label => "Media ID", :as => :string %section#information diff --git a/app/views/proposal/show.html.haml b/app/views/proposal/show.html.haml index 6ae26b33..91b1ede0 100644 --- a/app/views/proposal/show.html.haml +++ b/app/views/proposal/show.html.haml @@ -39,6 +39,8 @@ %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{@event.video_id}"} -elsif @event.video_type == Event::SPEAKERDECK %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{@event.video_id}?"} + -elsif @event.video_type == Event::INSTAGRAM + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{@event.video_id}/embed/"} -else %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/#{@event.video_id}?rel=0"} -else