diff --git a/app/models/conference.rb b/app/models/conference.rb index 6d94b5ca..b9794564 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -2,6 +2,8 @@ # This class represents a conference class Conference < ActiveRecord::Base + require 'uri' + attr_accessible :title, :short_title, :social_tag, :contact_email, :timezone, :html_export_path, :start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes, :use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes, @@ -12,7 +14,8 @@ class Conference < ActiveRecord::Base :media_id, :media_type, :color, :description, :registration_description, :ticket_description, :sponsorship_levels_attributes, - :sponsors_attributes + :sponsors_attributes, :facebook_url, + :google_url, :twitter_url has_paper_trail @@ -65,6 +68,10 @@ class Conference < ActiveRecord::Base :social_tag, :start_date, :end_date + + validates :facebook_url, :twitter_url, :google_url, + format: URI::regexp(%w(http https)), allow_blank: true + validates_uniqueness_of :short_title validates_format_of :short_title, :with => /\A[a-zA-Z0-9_-]*\z/ before_create :generate_guid diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index d920ba1f..23026283 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -29,4 +29,7 @@ %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.input :facebook_url, hint: 'This will appear in the social media section as link to the Facebook page of your Conference' + = f.input :google_url, label: 'Google+ Url', hint: 'This will appear in the social media section as the link to the Google+ Page of your Conference' + = f.input :twitter_url, hint: 'This will appear in the social media section as the link to the Twitter Page of your Conference' = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"} diff --git a/db/migrate/20140612181230_add_social_urls_to_conference.rb b/db/migrate/20140612181230_add_social_urls_to_conference.rb new file mode 100644 index 00000000..5144cbd2 --- /dev/null +++ b/db/migrate/20140612181230_add_social_urls_to_conference.rb @@ -0,0 +1,7 @@ +class AddSocialUrlsToConference < ActiveRecord::Migration + def change + add_column :conferences, :twitter_url, :string + add_column :conferences, :facebook_url, :string + add_column :conferences, :google_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index b110fc36..a164ce3f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140605125153) do +ActiveRecord::Schema.define(version: 20140612181230) do create_table "answers", force: true do |t| t.string "title" @@ -81,6 +81,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do t.text "description" t.text "registration_description" t.text "ticket_description" + t.string "twitter_url" + t.string "facebook_url" + t.string "google_url" end create_table "conferences_questions", id: false, force: true do |t|