* adding social description ability for sharing facebook

This commit is contained in:
Seth Call 2014-03-11 18:14:05 +00:00
parent 557412992e
commit 1d1578fde8
4 changed files with 24 additions and 1 deletions

View File

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

View File

@ -0,0 +1 @@
ALTER TABLE events ADD COLUMN social_description TEXT;

View File

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

View File

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