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

@ -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")