diff --git a/app/assets/javascripts/osem.js b/app/assets/javascripts/osem.js index 21dd66c8..19700d67 100644 --- a/app/assets/javascripts/osem.js +++ b/app/assets/javascripts/osem.js @@ -1,4 +1,9 @@ $(function() { + $("#event_video_type").change(function () { + $(".media-type").hide(); + $('#' + $(this).val().toLowerCase() + '-help').show(); + }); + $('.dropdown-toggle').dropdown(); $("#conference-start-datepicker").datepicker({ dateFormat: 'yy/mm/dd', @@ -252,3 +257,5 @@ window.build_dialog = function(selector, content) { $("body").append("
\n" + content + "
"); $("#" + selector).modal(); } + + diff --git a/app/models/event.rb b/app/models/event.rb index 9abc4521..8fa7babe 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -3,6 +3,10 @@ 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', INSTAGRAM = 'Instagram'] + + validates :video_type, inclusion: {in: VIDEO_TYPE} + acts_as_commentable has_many :event_people, :dependent => :destroy diff --git a/app/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 762ff6ac..285c3b7f 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -31,7 +31,15 @@ %br %br = f.input :description, :input_html => {:rows => 5, :class=> "span11"}, :hint => "This will only be shown to organizers, not to attendees." - = f.input :video_id, :as => :string, :hint => "Go to your youtube video, click on \"share\" and copy everything behind http://youtu.be/" + = f.input :video_type, :as => :select, :label => "Media Type", :collection => Event::VIDEO_TYPE, :include_blank => false + %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 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.input :video_id, :label => "Media ID", :as => :string + %section#information = f.inputs :name => "Your Information" do = semantic_fields_for @person do |p| diff --git a/app/views/proposal/show.html.haml b/app/views/proposal/show.html.haml index f1bd4a28..91b1ede0 100644 --- a/app/views/proposal/show.html.haml +++ b/app/views/proposal/show.html.haml @@ -31,9 +31,20 @@ .row-fluid .span12.flexvideo -if @event.video_id - %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=>"http://www.youtube.com/embed/#{@event.video_id}?rel=0"} + -if @event.video_type == Event::SLIDE_SHARE + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.slideshare.net/slideshow/embed_code/#{@event.video_id}"} + -elsif @event.video_type == Event::FLICKR + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "flic.kr/p/#{@event.video_id}/player/268a054da2"} + -elsif @event.video_type == Event::VIMEO + %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 - %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=>"http://www.youtube.com/embed/Eiv4e5ZxTmg?rel=0"} + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=>request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/Eiv4e5ZxTmg?rel=0"} .row-fluid .span8 %h3