Refactoring Conference/Event media to new media object

close #420
This commit is contained in:
Chrisbr 2014-08-05 18:23:42 +02:00
parent 850beb72e1
commit 2a731e8350
31 changed files with 491 additions and 57 deletions

View file

@ -1,12 +1,12 @@
-if media_type == Conference.media_types[:slideshare]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.slideshare.net/slideshow/embed_code/#{media_id}"}
-elsif media_type == Conference.media_types[:flickr]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "flic.kr/p/#{media_id}/player/268a054da2"}
-elsif media_type == Conference.media_types[:vimeo]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{media_id}"}
-elsif media_type == Conference.media_types[:speakerdeck]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{media_id}?"}
-elsif media_type == Conference.media_types[:instagram]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{media_id}/embed/"}
-if commercial_type == CONFIG['commercial_types']['slideshare']
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.slideshare.net/slideshow/embed_code/#{commercial_id}"}
-elsif commercial_type == CONFIG['commercial_types']['flickr']
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "flic.kr/p/#{commercial_id}/player/268a054da2"}
-elsif commercial_type == CONFIG['commercial_types']['vimeo']
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{commercial_id}"}
-elsif commercial_type == CONFIG['commercial_types']['speakerdeck']
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{commercial_id}?"}
-elsif commercial_type == CONFIG['commercial_types']['instagram']
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{commercial_id}/embed/"}
-else
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{media_id}?rel=0"}
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{commercial_id}?rel=0"}

View file

@ -0,0 +1,25 @@
- unless commercials.empty?
- if commercials.length == 1
.flexvideo
= render partial: 'shared/media_item', locals: { commercial_type: commercials.first.commercial_type, commercial_id: commercials.first.commercial_id }
- else
%ul.nav.nav-tabs{ 'role'=>'tablist' }
- commercials.each_with_index do |commercial, index|
- if index == 0
%li.active
%a{ 'href'=>"##{index}", 'role'=>'tab', 'data-toggle'=>'tab' }
= commercial.commercial_type
- else
%li
%a{ 'href'=>"##{index}",' "role"'=>'tab', 'data-toggle'=>'tab' }
= commercial.commercial_type
.tab-content
- commercials.each_with_index do |commercial, index|
- if index == 0
%div.tab-pane.active{'id'=>"#{index}"}
.flexvideo
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }
- else
%div.tab-pane{'id'=>"#{index}"}
.flexvideo
= render partial: 'shared/media_item', locals: { commercial_type: commercial.commercial_type, commercial_id: commercial.commercial_id }