Add conference wide media, fix proposal#show view

This commit is contained in:
Henne Vogelsang 2014-04-14 16:25:17 +02:00
parent 4592802411
commit 633fff59d8
10 changed files with 82 additions and 54 deletions

View file

@ -4,6 +4,11 @@ $(function() {
$('#' + $(this).val().toLowerCase() + '-help').show();
});
$("#conference_media_type").change(function () {
$(".media-type").hide();
$('#' + $(this).val().toLowerCase() + '-help').show();
});
$('.dropdown-toggle').dropdown();
$("#conference-start-datepicker").datepicker({
dateFormat: 'yy/mm/dd',

View file

@ -47,6 +47,10 @@ background-image: -webkit-gradient(
height: 100%;
}
.speakerinfo {
margin-top: 20px;
}
.schedule-title, .schedule-subtitle, .schedule-speaker, .schedule-track {
clear: none;
display: block;

View file

@ -8,7 +8,8 @@ class Conference < ActiveRecord::Base
:event_types_attributes, :registration_start_date, :registration_end_date, :logo,
:questions_attributes, :question_ids, :answers_attributes, :answer_ids,
:difficulty_levels_attributes, :use_difficulty_levels,
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
:media_id, :media_type
has_paper_trail
@ -64,6 +65,12 @@ class Conference < ActiveRecord::Base
before_create :create_venue
before_create :create_email_settings
def self.media_types
media_types = {:youtube => 'YouTube', :slideshare => 'SlideShare', :flickr => 'Flickr', :vimeo => 'Vimeo', :speakerdeck => 'Speakerdeck', :instagram => 'Instagram'}
return media_types
end
##
# Checks if the user is registered to the conference
#

View file

@ -45,7 +45,7 @@ class EmailSettings < ActiveRecord::Base
def parse_template(text, values)
values.each do |key, value|
text = text.gsub"{#{key}}", value
text = text.gsub"{#{key}}", value unless text.blank?
end
text
end

View file

@ -25,16 +25,11 @@ class Event < ActiveRecord::Base
accepts_nested_attributes_for :people
before_create :generate_guid
def self.media_types
media_types = {:youtube => 'YouTube', :slideshare => 'SlideShare', :flickr => 'Flickr', :vimeo => 'Vimeo', :speakerdeck => 'Speakerdeck', :instagram => 'Instagram'}
return media_types
end
validate :abstract_limit
validate :biography_exists
validates :title, :presence => true
validates :abstract, :presence => true
validates :media_type, :allow_nil => true, inclusion: {in: self.media_types.values}
validates :media_type, :allow_nil => true, inclusion: {in: Conference.media_types.values}
scope :confirmed, where(:state => "confirmed")

View file

@ -7,13 +7,24 @@
= f.input :short_title, :hint => "A short title, such as 'osc2013', to be used in URLs"
= f.input :social_tag, :hint => "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
= f.input :contact_email, :hint => "Contact email address for your conference. Will be used as reply-to address in emails sent out by the system."
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
- if !@conference.logo.blank?
= image_tag @conference.logo(:thumb)
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
= f.input :html_export_path, :hint => "The path for static HTML exports"
= f.inputs :name => "Scheduling" do
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
= f.inputs :name => "Media" do
- if !@conference.logo.blank?
= image_tag @conference.logo(:thumb)
= f.input :logo, :label => "Conference Logo", :hint => "This will be displayed on the front page."
= f.input :media_type, :as => :select, :label => "Conference Promo Media Type", :class=>"form-control", :collection => Conference.media_types.values, :include_blank => false, :hint => "This media-item will be used to represent this conference at various places in OSEM."
= f.input :media_id, :label => "Conference Promo Media ID", :as => :string
%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 => "flickr-help", :style => "display:none"} Go to your flickr image, click on "Grab the link" -> "Show short url" and copy everything behind https://flic.kr/p/
%p{:class => "help-block media-type", :id => "vimeo-help", :style => "display:none"} Go to your vimeo video, click on "share" and copy everything behind http://vimeo.com/
%p{:class => "help-block media-type", :id => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "embed" and copy the data-id
%p{:class => "help-block media-type", :id => "instagram-help", :style => "display:none"} Go to your Instagram photo page and copy everything behind instagram.com/p/ (without trailing /# hash symbol)
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -23,42 +23,28 @@
%span.label{:style =>"background-color: #{@event.track.color};"}
= @event.track.name
.col-md-9
-unless @event.media_id
.row
.col-md-12
%h5.text-error
.row
.col-md-12
- if @event.media_id.blank?
%h5.text-warning
No video of the event yet, sorry! Meanwhile...
.row
.col-md-13
-if not @event.media_id.blank?
.flexvideo
-if @event.media_type == Event.media_types[:slideshare]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.slideshare.net/slideshow/embed_code/#{@event.media_id}"}
-elsif @event.media_type == Event.media_types[:flickr]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "flic.kr/p/#{@event.media_id}/player/268a054da2"}
-elsif @event.media_type == Event.media_types[:vimeo]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//player.vimeo.com/video/#{@event.media_id}"}
-elsif @event.media_type == Event.media_types[:speakerdeck]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> "//speakerdeck.com/player/#{@event.media_id}?"}
-elsif @event.media_type == Event.media_types[:instagram]
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :scrolling =>"no", :allowtransparency=>"true", :src=> "//instagram.com/p/#{@event.media_id}/embed/"}
-else
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{@event.media_id}?rel=0"}
-else
%div.well.well-lg="No video of the event yet, sorry! Meanwhile..."
= render partial: "shared/media_item", locals: {media_type: @conference.media_type, media_id: @conference.media_id}
- else
.flexvideo
= render partial: "shared/media_item", locals: {media_type: @event.media_type, media_id: @event.media_id}
.row
.col-md-8
%h3
by
= @speaker.public_name
- if @speaker.company?
%br
%span.muted
from
= @speaker.company
-if @speaker.biography?
= simple_format(@speaker.biography)
.col-md-4
= image_tag @speaker.gravatar_url(:size => 200), :class => "img-responsive img-rounded"
.speakerinfo
.col-md-8
%h3
by
= @speaker.public_name
- if @speaker.company?
%br
%span.muted
from
= @speaker.company
-if @speaker.biography?
= simple_format(@speaker.biography)
.col-md-4
= image_tag @speaker.gravatar_url(:size => 200), :class => "img-responsive img-rounded"

View file

@ -0,0 +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/"}
-else
%iframe{:width=>"560", :height=>"315", :frameborder=>"0", :allowfullscreen=>"true", :src=> (request.ssl? ? "https://" : "http://") + "www.youtube.com/embed/#{media_id}?rel=0"}

View file

@ -0,0 +1,6 @@
class AddVideoToConferences < ActiveRecord::Migration
def change
add_column :conferences, :media_id, :string
add_column :conferences, :media_type, :string
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140401094729) do
ActiveRecord::Schema.define(:version => 20140414131028) do
create_table "answers", :force => true do |t|
t.string "title"
@ -77,6 +77,8 @@ ActiveRecord::Schema.define(:version => 20140401094729) do
t.boolean "use_vdays", :default => false
t.boolean "use_difficulty_levels", :default => false
t.boolean "use_volunteers"
t.string "media_id"
t.string "media_type"
end
create_table "conferences_questions", :id => false, :force => true do |t|