Implements more embed codes for events
- refactor video_type collection to event model enumeration #26
This commit is contained in:
parent
2421eaf4ea
commit
03ba8d50f4
4 changed files with 10 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#event_video_type").change(function () {
|
$("#event_video_type").change(function () {
|
||||||
$(".media-type").hide();
|
$(".media-type").hide();
|
||||||
$('#' + $(this).val() + '-help').show();
|
$('#' + $(this).val().toLowerCase() + '-help').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.dropdown-toggle').dropdown();
|
$('.dropdown-toggle').dropdown();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@ class Event < ActiveRecord::Base
|
||||||
has_paper_trail
|
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
|
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']
|
||||||
|
|
||||||
|
validates :video_type, inclusion: {in: VIDEO_TYPE}
|
||||||
|
|
||||||
acts_as_commentable
|
acts_as_commentable
|
||||||
|
|
||||||
has_many :event_people, :dependent => :destroy
|
has_many :event_people, :dependent => :destroy
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
= f.input :description, :input_html => {:rows => 5, :class=> "span11"}, :hint => "This will only be shown to organizers, not to attendees."
|
= f.input :description, :input_html => {:rows => 5, :class=> "span11"}, :hint => "This will only be shown to organizers, not to attendees."
|
||||||
= f.input :video_type, :as => :select, :label => "Media Type", :collection => [['YoubTube', 'youtube'], ['SlideShare', 'slideshare']], :include_blank => false
|
= 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 => "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 => "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
|
= f.input :video_id, :label => "Media ID", :as => :string
|
||||||
|
|
||||||
%section#information
|
%section#information
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
.row-fluid
|
.row-fluid
|
||||||
.span12.flexvideo
|
.span12.flexvideo
|
||||||
-if @event.video_id
|
-if @event.video_id
|
||||||
-if @event.video_type == "youtube"
|
-if @event.video_type == Event::YOUTUBE
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.youtube.com/embed/#{@event.video_id}?rel=0"}
|
%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"
|
-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}"}
|
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> request.ssl? ? "https://" : "http://" + "www.slideshare.net/slideshow/embed_code/#{@event.video_id}"}
|
||||||
-else
|
-else
|
||||||
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=>request.ssl? ? "https://" : "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"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue