Merge pull request #503 from ChrisBr/move_sponsor_email
Moves sponsor email attribute from conference to contact
This commit is contained in:
commit
fbbe7d1fdd
10 changed files with 49 additions and 11 deletions
|
|
@ -15,7 +15,7 @@ class Conference < ActiveRecord::Base
|
||||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||||
:vpositions_attributes, :use_volunteers, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||||
:sponsor_email, :photos_attributes, :targets, :targets_attributes,
|
:photos_attributes, :targets, :targets_attributes,
|
||||||
:campaigns, :campaigns_attributes
|
:campaigns, :campaigns_attributes
|
||||||
|
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
class Contact < ActiveRecord::Base
|
class Contact < ActiveRecord::Base
|
||||||
attr_accessible :conference_id, :social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public
|
attr_accessible :conference_id, :social_tag, :email, :facebook, :googleplus, :twitter,
|
||||||
|
:instagram, :public, :sponsor_email
|
||||||
|
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
|
|
||||||
validates :conference, presence: true
|
validates :conference, presence: true
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,4 @@
|
||||||
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
= f.input :timezone, :as => :time_zone, :hint => "The conference time zone"
|
||||||
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
= f.input :start_date, :as => :string, :input_html => { :id => "conference-start-datepicker", :readonly => "readonly" }
|
||||||
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
||||||
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
|
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
= semantic_form_for(@contact, :url => admin_conference_contact_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
= semantic_form_for(@contact, :url => admin_conference_contact_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||||
= f.inputs :name => 'Contact' do
|
= f.inputs :name => 'Contact' do
|
||||||
= f.input :email, hint: 'Contact email address for your conference. Will be used as reply-to address in emails sent out by the system.'
|
= f.input :email, hint: 'Contact email address for your conference. Will be used as reply-to address in emails sent out by the system.'
|
||||||
|
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
|
||||||
= f.inputs :name => 'Social Media' do
|
= f.inputs :name => 'Social Media' do
|
||||||
= f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
|
= f.input :social_tag, hint: "The hashtag you'll use on Twitter and Google+. Don't include the '#' sign!'"
|
||||||
= f.input :facebook, hint: 'This will appear in the social media section as link to the Facebook page of your Conference'
|
= f.input :facebook, hint: 'This will appear in the social media section as link to the Facebook page of your Conference'
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
= link_to "#{ @contact.email }" do
|
= link_to "#{ @contact.email }" do
|
||||||
%i.fa.fa-envelope.fa-3x
|
%i.fa.fa-envelope.fa-3x
|
||||||
= @contact.email
|
= @contact.email
|
||||||
|
- unless @contact.sponsor_email.blank?
|
||||||
|
%li
|
||||||
|
= link_to "#{ @contact.sponsor_email }" do
|
||||||
|
%i.fa.fa-money.fa-3x
|
||||||
|
= @contact.sponsor_email
|
||||||
- unless @contact.social_tag.blank?
|
- unless @contact.social_tag.blank?
|
||||||
%li
|
%li
|
||||||
= link_to "#{ @contact.social_tag }" do
|
= link_to "#{ @contact.social_tag }" do
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
-if !@conference.splashpage.sponsor_description.blank?
|
-if !@conference.splashpage.sponsor_description.blank?
|
||||||
.lead
|
.lead
|
||||||
= markdown(@conference.splashpage.sponsor_description)
|
= markdown(@conference.splashpage.sponsor_description)
|
||||||
-if !@conference.sponsor_email.blank?
|
-if @conference.contact && @conference.contact.sponsor_email.present?
|
||||||
%h3= mail_to "#{ @conference.sponsor_email }", 'Become a Sponsor'
|
%h3= mail_to "#{ @conference.contact.sponsor_email }", 'Become a Sponsor'
|
||||||
- if !@conference.sponsorship_levels.blank?
|
- if !@conference.sponsorship_levels.blank?
|
||||||
- @conference.sponsorship_levels.each do |l|
|
- @conference.sponsorship_levels.each do |l|
|
||||||
- if !l.sponsors.blank?
|
- if !l.sponsors.blank?
|
||||||
|
|
|
||||||
26
db/migrate/20140930092923_move_sponsor_email_to_contact.rb
Normal file
26
db/migrate/20140930092923_move_sponsor_email_to_contact.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
class MoveSponsorEmailToContact < ActiveRecord::Migration
|
||||||
|
class TempConference < ActiveRecord::Base
|
||||||
|
self.table_name = 'conferences'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempContact < ActiveRecord::Base
|
||||||
|
self.table_name = 'contacts'
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_column :contacts, :sponsor_email, :string
|
||||||
|
|
||||||
|
TempConference.all.each do |conference|
|
||||||
|
contact = TempContact.find_by(conference_id: conference.id)
|
||||||
|
if contact
|
||||||
|
contact.sponsor_email = conference.sponsor_email
|
||||||
|
contact.save
|
||||||
|
else
|
||||||
|
Contact.create(conference_id: conference.id,
|
||||||
|
sponsors_email: conference.sponsor_email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_column :conferences, :sponsor_email
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -105,7 +105,6 @@ ActiveRecord::Schema.define(version: 20141106141750) do
|
||||||
t.boolean "use_difficulty_levels", default: false
|
t.boolean "use_difficulty_levels", default: false
|
||||||
t.boolean "use_volunteers"
|
t.boolean "use_volunteers"
|
||||||
t.string "color"
|
t.string "color"
|
||||||
t.string "sponsor_email"
|
|
||||||
t.text "events_per_week"
|
t.text "events_per_week"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -124,6 +123,7 @@ ActiveRecord::Schema.define(version: 20141106141750) do
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.string "sponsor_email"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "delayed_jobs", force: true do |t|
|
create_table "delayed_jobs", force: true do |t|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ feature Contact do
|
||||||
visit edit_admin_conference_contact_path(conference.short_title)
|
visit edit_admin_conference_contact_path(conference.short_title)
|
||||||
click_link 'Edit'
|
click_link 'Edit'
|
||||||
fill_in 'contact_email', with: 'example@example.com'
|
fill_in 'contact_email', with: 'example@example.com'
|
||||||
|
fill_in 'contact_sponsor_email', with: 'sponsor@example.com'
|
||||||
fill_in 'contact_social_tag', with: 'example'
|
fill_in 'contact_social_tag', with: 'example'
|
||||||
fill_in 'contact_facebook', with: 'http:\\www.facebook.com'
|
fill_in 'contact_facebook', with: 'http:\\www.facebook.com'
|
||||||
fill_in 'contact_twitter', with: 'http:\\www.twitter.com'
|
fill_in 'contact_twitter', with: 'http:\\www.twitter.com'
|
||||||
|
|
@ -28,6 +29,7 @@ feature Contact do
|
||||||
|
|
||||||
contact.reload
|
contact.reload
|
||||||
expect(contact.email).to eq('example@example.com')
|
expect(contact.email).to eq('example@example.com')
|
||||||
|
expect(contact.sponsor_email).to eq('sponsor@example.com')
|
||||||
expect(contact.social_tag).to eq('example')
|
expect(contact.social_tag).to eq('example')
|
||||||
expect(contact.facebook).to eq('http:\\www.facebook.com')
|
expect(contact.facebook).to eq('http:\\www.facebook.com')
|
||||||
expect(contact.twitter).to eq('http:\\www.twitter.com')
|
expect(contact.twitter).to eq('http:\\www.twitter.com')
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ require 'spec_helper'
|
||||||
describe 'conference/show.html.haml' do
|
describe 'conference/show.html.haml' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
|
allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
|
||||||
@conference = create(:conference,
|
@conference = create(:conference)
|
||||||
sponsor_email: 'example@example.com')
|
|
||||||
|
|
||||||
@conference.splashpage = create(:splashpage,
|
@conference.splashpage = create(:splashpage,
|
||||||
banner_description: 'Lorem Ipsum',
|
banner_description: 'Lorem Ipsum',
|
||||||
|
|
@ -18,21 +17,25 @@ describe 'conference/show.html.haml' do
|
||||||
include_social_media: true,
|
include_social_media: true,
|
||||||
include_venue: true,
|
include_venue: true,
|
||||||
include_lodgings: true)
|
include_lodgings: true)
|
||||||
@conference.contact.update(facebook: 'http://www.fbexample.com',
|
|
||||||
|
@conference.contact.update(sponsor_email: 'example@example.com',
|
||||||
|
facebook: 'http://www.fbexample.com',
|
||||||
googleplus: 'http://www.google-example.com',
|
googleplus: 'http://www.google-example.com',
|
||||||
instagram: 'http://instagram.com',
|
instagram: 'http://instagram.com',
|
||||||
twitter: 'http://twitter.com')
|
twitter: 'http://twitter.com')
|
||||||
|
|
||||||
@conference.registration_period = create(:registration_period,
|
@conference.registration_period = create(:registration_period,
|
||||||
start_date: Date.today,
|
start_date: Date.today,
|
||||||
end_date: Date.tomorrow)
|
end_date: Date.tomorrow)
|
||||||
|
|
||||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
|
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
|
||||||
include_cfp_in_splash: true)
|
include_cfp_in_splash: true)
|
||||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference,
|
|
||||||
include_cfp_in_splash: true)
|
|
||||||
@conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
|
@conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
|
||||||
@sponsorship_level = @conference.sponsorship_levels.first
|
@sponsorship_level = @conference.sponsorship_levels.first
|
||||||
@sponsorship_level.sponsors << create(:sponsor, sponsorship_level: @sponsorship_level,
|
@sponsorship_level.sponsors << create(:sponsor, sponsorship_level: @sponsorship_level,
|
||||||
conference: @conference)
|
conference: @conference)
|
||||||
|
|
||||||
@conference.venue = create(:venue)
|
@conference.venue = create(:venue)
|
||||||
@conference.venue.lodgings << create(:lodging, venue: @conference.venue)
|
@conference.venue.lodgings << create(:lodging, venue: @conference.venue)
|
||||||
assign :conference, @conference
|
assign :conference, @conference
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue