Tweak Materials to allow anything

This commit is contained in:
Michael Ball 2020-07-10 22:03:51 -07:00
parent 74b77e132d
commit b553e0fed7
5 changed files with 24 additions and 23 deletions

View file

@ -62,7 +62,7 @@
- if @event.commercials.empty? - if @event.commercials.empty?
%h5.text-warning %h5.text-warning
No video of the event yet, sorry! No materials for the event yet, sorry!
- unless @conference.commercials.empty? - unless @conference.commercials.empty?
Meanwhile... Meanwhile...
- unless @conference.commercials.empty? - unless @conference.commercials.empty?

View file

@ -1,15 +1,19 @@
- if commercial.url .flexvideo
= Commercial.render_from_url(commercial.url)[:html] - if commercial.url
- else = Commercial.render_from_url(commercial.url)[:html]
- if commercial.commercial_type == 'SlideShare'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.slideshare.net/slideshow/embed_code/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Flickr'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://flic.kr/p/#{commercial.commercial_id}/player/268a054da2"}
- elsif commercial.commercial_type == 'Vimeo'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "//player.vimeo.com/video/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Speakerdeck'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://speakerdeck.com/player/#{commercial.commercial_id}?"}
- elsif commercial.commercial_type == 'Instagram'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', scrolling: 'no', allowtransparency: 'true', src: "//instagram.com/p/#{commercial.commercial_id}/embed/"}
- else - else
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.youtube.com/embed/#{commercial.commercial_id}?rel=0"} - if commercial.commercial_type == 'SlideShare'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.slideshare.net/slideshow/embed_code/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Flickr'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://flic.kr/p/#{commercial.commercial_id}/player/268a054da2"}
- elsif commercial.commercial_type == 'Vimeo'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "//player.vimeo.com/video/#{commercial.commercial_id}"}
- elsif commercial.commercial_type == 'Speakerdeck'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://speakerdeck.com/player/#{commercial.commercial_id}?"}
- elsif commercial.commercial_type == 'Instagram'
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', scrolling: 'no', allowtransparency: 'true', src: "//instagram.com/p/#{commercial.commercial_id}/embed/"}
- else
%iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.youtube.com/embed/#{commercial.commercial_id}?rel=0"}
- if commercial.url
%br
= link_to('Open in a new tab', commercial.url, target: '_blank')

View file

@ -1,7 +1,6 @@
- unless commercials.empty? - unless commercials.empty?
- if commercials.length == 1 - if commercials.length == 1
.flexvideo = render partial: 'shared/media_item', locals: { commercial: commercials.first }
= render partial: 'shared/media_item', locals: { commercial: commercials.first }
- else - else
%ul.nav.nav-tabs{ 'role'=>'tablist' } %ul.nav.nav-tabs{ 'role'=>'tablist' }
- commercials.each.with_index(1) do |commercial, index| - commercials.each.with_index(1) do |commercial, index|
@ -12,9 +11,7 @@
- commercials.each.with_index(1) do |commercial, index| - commercials.each.with_index(1) do |commercial, index|
- if index == 1 - if index == 1
.tab-pane.active{'id'=>"#{index}"} .tab-pane.active{'id'=>"#{index}"}
.flexvideo = render partial: 'shared/media_item', locals: { commercial: commercial }
= render partial: 'shared/media_item', locals: { commercial: commercial }
- else - else
.tab-pane{'id'=>"#{index}"} .tab-pane{'id'=>"#{index}"}
.flexvideo = render partial: 'shared/media_item', locals: { commercial: commercial }
= render partial: 'shared/media_item', locals: { commercial: commercial }

View file

@ -1,5 +1,5 @@
class AddUrlToRooms < ActiveRecord::Migration[5.2] class AddUrlToRooms < ActiveRecord::Migration[5.2]
def change def change
add_column :rooms, :url, :text add_column :rooms, :url, :string
end end
end end

View file

@ -406,7 +406,7 @@ ActiveRecord::Schema.define(version: 2020_07_10_215300) do
t.string "name", null: false t.string "name", null: false
t.integer "size" t.integer "size"
t.integer "venue_id", null: false t.integer "venue_id", null: false
t.text "url" t.string "url"
end end
create_table "schedules", force: :cascade do |t| create_table "schedules", force: :cascade do |t|