From 2421eaf4ea05518f71d2e048510068cd416713c2 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Sat, 15 Mar 2014 20:21:01 +0100 Subject: [PATCH] Implements more embed codes for events - add slideshare embed code TODO: - review help texts - refactor video_type collection to event model enumeration - add more embed code (flickr, instagram, myvideo) - video_type and video_id is now more like media_type and media_id -> it should considered to rename these attributes #26 --- app/assets/javascripts/osem.js | 7 +++++++ app/views/proposal/_proposal_form.html.haml | 6 +++++- app/views/proposal/show.html.haml | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/osem.js b/app/assets/javascripts/osem.js index 21dd66c8..989b00db 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() + '-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/views/proposal/_proposal_form.html.haml b/app/views/proposal/_proposal_form.html.haml index 762ff6ac..6e6379cb 100644 --- a/app/views/proposal/_proposal_form.html.haml +++ b/app/views/proposal/_proposal_form.html.haml @@ -31,7 +31,11 @@ %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 => [['YoubTube', 'youtube'], ['SlideShare', 'slideshare']], :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 + = 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 9e0bc20d..2d91454f 100644 --- a/app/views/proposal/show.html.haml +++ b/app/views/proposal/show.html.haml @@ -31,7 +31,10 @@ .row-fluid .span12.flexvideo -if @event.video_id - %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/#{@event.video_id}?rel=0"} + -if @event.video_type == "youtube" + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/#{@event.video_id}?rel=0"} + -if @event.video_type == "slideshare" + %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.slideshare.net/slideshow/embed_code/#{@event.video_id}"} -else %iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=>request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/Eiv4e5ZxTmg?rel=0"} .row-fluid