Social media component
6
Gemfile
|
|
@ -1,6 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
# Use rails as framework
|
||||
# Use rails as framework
|
||||
gem 'rails', '~> 4.1'
|
||||
|
||||
# Use mysql as the database for Active Record
|
||||
|
|
@ -82,13 +82,13 @@ group :development, :test do
|
|||
gem 'shoulda'
|
||||
end
|
||||
|
||||
# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
|
||||
# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
|
||||
gem 'protected_attributes'
|
||||
|
||||
# We use this bootstrap/html5 rdoc generator
|
||||
gem 'rdoc-generator-fivefish'
|
||||
|
||||
# We use factory_girl for seeds
|
||||
# We use factory_girl for seeds
|
||||
gem 'factory_girl_rails'
|
||||
|
||||
# Use guard and spring for testing in development
|
||||
|
|
|
|||
BIN
app/assets/images/fb-logo-blue.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/assets/images/flickr.png
Normal file
|
After Width: | Height: | Size: 938 B |
BIN
app/assets/images/google-logo.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
app/assets/images/instagram.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/assets/images/slideshare.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
app/assets/images/speakerdeck.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/assets/images/twitter-logo-blue.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/assets/images/vimeo-logo-dark.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/assets/images/youtube-color-logo.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
|
@ -2,6 +2,7 @@
|
|||
# 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,
|
||||
|
|
@ -10,7 +11,8 @@ class Conference < ActiveRecord::Base
|
|||
:difficulty_levels_attributes, :use_difficulty_levels,
|
||||
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
||||
:media_id, :media_type, :color, :description,
|
||||
:registration_description, :ticket_description
|
||||
:registration_description, :ticket_description, :facebook_url,
|
||||
:google_url, :twitter_url
|
||||
|
||||
has_paper_trail
|
||||
|
||||
|
|
@ -59,6 +61,8 @@ 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
|
||||
|
|
|
|||
|
|
@ -24,9 +24,12 @@
|
|||
= 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 => "slideshare-help", :style => "display:none"} Go to your SlideShare, click on "share" -> "link" and copy the link
|
||||
%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 => "speakerdeck-help", :style => "display:none"} Go to your SpeakerDeck, click on "share" -> "link" and copy the link
|
||||
%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"}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
%a{ href: '#registration' } Registration
|
||||
%div.container.text-center
|
||||
%div.row
|
||||
%h2 Registration
|
||||
%h1 Registration
|
||||
- if !@conference.registration_description.blank?
|
||||
%p
|
||||
= @conference.registration_description
|
||||
|
|
|
|||
36
app/views/conference/_social_media.html.haml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
= content_for :splash_nav do
|
||||
%li
|
||||
%a{ href: '#social-media' } Social Media
|
||||
|
||||
%div.container#social-media.text-center
|
||||
%h1 We are Social
|
||||
%div.row
|
||||
- if !@conference.facebook_url.blank?
|
||||
%div.col-md-3
|
||||
= link_to image_tag('fb-logo-blue.png', class: 'img-responsive'),
|
||||
"#{ @conference.facebook_url }"
|
||||
- if !@conference.twitter_url.blank?
|
||||
%div.col-md-3
|
||||
= link_to image_tag('twitter-logo-blue.png', class: 'img-responsive'), "#{ @conference.twitter_url }"
|
||||
- if !@conference.media_type.blank? && !@conference.media_id.blank?
|
||||
%div.col-md-3
|
||||
-if @conference.media_type == 'YouTube'
|
||||
= link_to image_tag('youtube-color-logo.png', class: 'img-responsive'),
|
||||
"http://youtu.be/#{ @conference.media_id}"
|
||||
-if @conference.media_type == 'SlideShare'
|
||||
= link_to image_tag('slideshare.png', class: 'img-responsive'), "#{ @conference.media_id}"
|
||||
-if @conference.media_type == 'Instagram'
|
||||
= link_to image_tag('instagram.png', class: 'img-responsive'),
|
||||
"http://instagram.com/p/#{ @conference.media_id}"
|
||||
-if @conference.media_type == 'Vimeo'
|
||||
= link_to image_tag('vimeo-logo-dark.png', class: 'img-responsive'),
|
||||
"http://vimeo.com/#{ @conference.media_id}"
|
||||
-if @conference.media_type == 'Speakerdeck'
|
||||
= link_to image_tag('speakerdeck.png', class: 'img-responsive'),"#{ @conference.media_id}"
|
||||
-if @conference.media_type == 'Flickr'
|
||||
= link_to image_tag('flickr.png', class: 'img-responsive'),
|
||||
"https://flic.kr/p/#{ @conference.media_id}"
|
||||
- if !@conference.google_url.blank?
|
||||
%div.col-md-3
|
||||
= link_to image_tag('google-logo.png', class: 'img-responsive'),
|
||||
"#{ @conference.google_url }"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
%div.row
|
||||
%h3 Tickets
|
||||
%h2 Tickets
|
||||
-if !@conference.ticket_description.blank?
|
||||
%p #{ @conference.ticket_description }
|
||||
- @conference.supporter_levels.each do |s|
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
= content_for :brand do
|
||||
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
|
||||
|
||||
%div#program
|
||||
= render 'program'
|
||||
%div#registration
|
||||
= render 'registration'
|
||||
%div#callforpapers
|
||||
= render 'call_for_papers'
|
||||
%div#social-media
|
||||
= render 'social_media'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddFacebookUrlToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :facebook_url, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddGoogleUrlToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :google_url, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddTwitterUrlToConference < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :twitter_url, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -81,6 +81,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
|||
t.text "description"
|
||||
t.text "registration_description"
|
||||
t.text "ticket_description"
|
||||
t.string "facebook_url"
|
||||
t.string "google_url"
|
||||
t.string "twitter_url"
|
||||
end
|
||||
|
||||
create_table "conferences_questions", id: false, force: true do |t|
|
||||
|
|
|
|||
|
|
@ -4,14 +4,18 @@ describe 'conference/show.html.haml' do
|
|||
@conference = create(:conference, registration_description: 'Lorem Ipsum Dolor',
|
||||
registration_start_date: Date.today,
|
||||
registration_end_date: Date.tomorrow,
|
||||
description: 'Lorem Ipsum')
|
||||
description: 'Lorem Ipsum',
|
||||
facebook_url: 'http://www.fbexample.com',
|
||||
google_url: 'http://www.google-example.com',
|
||||
media_type: 'YouTube',
|
||||
media_id: 'rtyutut')
|
||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference)
|
||||
assign :conference, @conference
|
||||
render
|
||||
end
|
||||
|
||||
it 'renders program partial' do
|
||||
expect(render).to include("#{@conference.description}")
|
||||
expect(rendered).to include("#{@conference.description}")
|
||||
expect(view).to render_template(partial: 'conference/_program')
|
||||
end
|
||||
|
||||
|
|
@ -21,6 +25,13 @@ describe 'conference/show.html.haml' do
|
|||
end
|
||||
|
||||
it 'renders call_for_papers partial' do
|
||||
expect(render).to include("#{@conference.call_for_papers.description}")
|
||||
expect(rendered).to include("#{@conference.call_for_papers.description}")
|
||||
end
|
||||
|
||||
it 'renders social media partial' do
|
||||
expect(view).to render_template('conference/_social_media')
|
||||
expect(rendered).to include('http://www.fbexample.com')
|
||||
expect(rendered).to include('http://www.google-example.com')
|
||||
expect(rendered).to include('http://youtu.be/rtyutut')
|
||||
end
|
||||
end
|
||||
|
|
|
|||