diff --git a/app/views/admin/commercials/index.html.haml b/app/views/admin/commercials/index.html.haml index 2dbe10a2..2b91c1a6 100644 --- a/app/views/admin/commercials/index.html.haml +++ b/app/views/admin/commercials/index.html.haml @@ -16,7 +16,7 @@ = semantic_form_for(@commercial, url: admin_conference_commercials_path(conference_id: @conference.short_title)) do |f| = f.input :url, label: 'URL', as: :string, input_html: { required: 'required', autofocus: true }, hint: 'Just paste the url of your video/photo provider. YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.' - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true } + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }, label: 'Save Materials' %hr - @commercials.each_slice(3) do |slice| @@ -24,10 +24,10 @@ - slice.each do |commercial| - if commercial.persisted? .col-md-4 - .thumbnail - .flexvideo{ id: "resource-content-#{commercial.id}" } + .panel + %div{ id: "resource-content-#{commercial.id}" } = render partial: 'shared/media_item', locals: { commercial: commercial } - .caption + .caption.panel-footer - if can? :update, commercial = semantic_form_for commercial, url: admin_conference_commercial_path(conference_id: @conference.short_title, id: commercial) do |f| = f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required' }, hint: 'Just paste the url of your video/photo provider' diff --git a/app/views/proposals/_form.html.haml b/app/views/proposals/_form.html.haml index 7f6716d5..652e03d9 100644 --- a/app/views/proposals/_form.html.haml +++ b/app/views/proposals/_form.html.haml @@ -22,17 +22,17 @@ = semantic_form_for(@event.commercials.build, url: conference_program_proposal_commercials_path(conference_id: @conference.short_title, proposal_id: @event)) do |f| = f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' }, hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.' - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true } + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }, label: 'Save Materials' %hr - @event.commercials.each_slice(3) do |slice| .row - slice.each do |commercial| - if commercial.persisted? .col-md-4 - .thumbnail - .flexvideo{ id: "resource-content-#{commercial.id}"} + .panel.panel-default + %div{ id: "resource-content-#{commercial.id}"} = render partial: 'shared/media_item', locals: { commercial: commercial } - .caption + .caption.panel-footer - if can? :update, commercial = semantic_form_for commercial, url: conference_program_proposal_commercial_path(conference_id: @conference.short_title, proposal_id: @event, id: commercial) do |f| = f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required', type: 'url' } diff --git a/app/views/shared/_media_item.html.haml b/app/views/shared/_media_item.html.haml index 72d94d5f..341f6e65 100644 --- a/app/views/shared/_media_item.html.haml +++ b/app/views/shared/_media_item.html.haml @@ -1,19 +1,18 @@ .flexvideo - - if commercial.url + - 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/"} + - elsif commercial.commercial_type == 'YouTube' + %iframe{width: '560', height: '315', frameborder: '0', allowfullscreen: 'true', src: "https://www.youtube.com/embed/#{commercial.commercial_id}?rel=0"} + - elsif 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/"} - - 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') + = link_to('Open in a new tab', commercial.url, target: '_blank', class: 'btn btn-info')