diff --git a/db/manifest b/db/manifest index 2a21c812a..641c740df 100755 --- a/db/manifest +++ b/db/manifest @@ -134,4 +134,5 @@ fix_max_mind_isp_and_geo.sql update_get_work_for_client_type.sql events.sql cascading_delete_constraints_for_release.sql +events_social_description.sql diff --git a/db/up/events_social_description.sql b/db/up/events_social_description.sql new file mode 100644 index 000000000..36f3675e1 --- /dev/null +++ b/db/up/events_social_description.sql @@ -0,0 +1 @@ +ALTER TABLE events ADD COLUMN social_description TEXT; diff --git a/ruby/lib/jam_ruby/models/event.rb b/ruby/lib/jam_ruby/models/event.rb index c21e655ab..5d041485e 100644 --- a/ruby/lib/jam_ruby/models/event.rb +++ b/ruby/lib/jam_ruby/models/event.rb @@ -1,9 +1,15 @@ class JamRuby::Event < ActiveRecord::Base - attr_accessible :slug, :title, :description, :show_sponser, as: :admin + attr_accessible :slug, :title, :description, :show_sponser, :social_description, as: :admin validates :slug, uniqueness: true, presence: true validates :show_sponser, :inclusion => {:in => [true, false]} + before_validation :sanitize_active_admin + + def sanitize_active_admin + self.social_description = nil if self.social_description == '' + end + has_many :event_sessions, class_name: 'JamRuby::EventSession' end diff --git a/web/app/views/events/event.html.haml b/web/app/views/events/event.html.haml index 4f77ff03c..866dcbdc5 100644 --- a/web/app/views/events/event.html.haml +++ b/web/app/views/events/event.html.haml @@ -1,5 +1,20 @@ - provide(:title, @event.title) + +-content_for :social_meta do + %meta{property: 'fb_app_id', content: Rails.application.config.facebook_app_id} + %meta{property: 'og:title', content: 'JamKazam'} + %meta{property: 'og:url', content: request.original_url} + %meta{property: 'og:description', content: @event.social_description || "Play music together over the Internet as if in the same room."} + %meta{property: 'og:image', content: request.protocol + request.host_with_port + image_path("web/logo-256.png")} + %meta{property: 'og:image:width', content: '256'} + %meta{property: 'og:image:height', content: '256'} + %meta{property: 'og:type', content: 'website'} + %meta{property: 'twitter:card', content: 'summary'} + %meta{property: 'twitter:site', content: '@jamkazam'} + %meta{property: 'twitter:title', content: 'JamKazam'} + %meta{property: 'twitter:description',content: @event.social_description || "Play music together over the Internet as if in the same room."} + .landing-content %h1= @event.title %p.w60= raw(@event.description)