From b553e0fed7a571f5c811df6b0b80aadf82388f3a Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 10 Jul 2020 22:03:51 -0700 Subject: [PATCH] Tweak Materials to allow anything --- app/views/proposals/show.html.haml | 2 +- app/views/shared/_media_item.html.haml | 32 +++++++++++-------- app/views/shared/_media_items.html.haml | 9 ++---- db/migrate/20200710215300_add_url_to_rooms.rb | 2 +- db/schema.rb | 2 +- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index 08388ac0..217a76b3 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -62,7 +62,7 @@ - if @event.commercials.empty? %h5.text-warning - No video of the event yet, sorry! + No materials for the event yet, sorry! - unless @conference.commercials.empty? Meanwhile... - unless @conference.commercials.empty? diff --git a/app/views/shared/_media_item.html.haml b/app/views/shared/_media_item.html.haml index 9357c9e2..72d94d5f 100644 --- a/app/views/shared/_media_item.html.haml +++ b/app/views/shared/_media_item.html.haml @@ -1,15 +1,19 @@ -- if commercial.url - = Commercial.render_from_url(commercial.url)[:html] -- else - - 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/"} +.flexvideo + - if commercial.url + = Commercial.render_from_url(commercial.url)[:html] - 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') diff --git a/app/views/shared/_media_items.html.haml b/app/views/shared/_media_items.html.haml index e4ef3c0d..2801ad79 100644 --- a/app/views/shared/_media_items.html.haml +++ b/app/views/shared/_media_items.html.haml @@ -1,7 +1,6 @@ - unless commercials.empty? - if commercials.length == 1 - .flexvideo - = render partial: 'shared/media_item', locals: { commercial: commercials.first } + = render partial: 'shared/media_item', locals: { commercial: commercials.first } - else %ul.nav.nav-tabs{ 'role'=>'tablist' } - commercials.each.with_index(1) do |commercial, index| @@ -12,9 +11,7 @@ - commercials.each.with_index(1) do |commercial, index| - if index == 1 .tab-pane.active{'id'=>"#{index}"} - .flexvideo - = render partial: 'shared/media_item', locals: { commercial: commercial } + = render partial: 'shared/media_item', locals: { commercial: commercial } - else .tab-pane{'id'=>"#{index}"} - .flexvideo - = render partial: 'shared/media_item', locals: { commercial: commercial } + = render partial: 'shared/media_item', locals: { commercial: commercial } diff --git a/db/migrate/20200710215300_add_url_to_rooms.rb b/db/migrate/20200710215300_add_url_to_rooms.rb index 65e46907..8eefff7b 100644 --- a/db/migrate/20200710215300_add_url_to_rooms.rb +++ b/db/migrate/20200710215300_add_url_to_rooms.rb @@ -1,5 +1,5 @@ class AddUrlToRooms < ActiveRecord::Migration[5.2] def change - add_column :rooms, :url, :text + add_column :rooms, :url, :string end end diff --git a/db/schema.rb b/db/schema.rb index dbae1f2e..f888a737 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -406,7 +406,7 @@ ActiveRecord::Schema.define(version: 2020_07_10_215300) do t.string "name", null: false t.integer "size" t.integer "venue_id", null: false - t.text "url" + t.string "url" end create_table "schedules", force: :cascade do |t|