Merge pull request #177 from gopesht/add_tickets_to_registration_segment

Add tickets to registration segment
This commit is contained in:
James Mason 2014-05-29 13:18:19 -07:00
commit 9e39fedf05
14 changed files with 94 additions and 18 deletions

View file

@ -9,7 +9,8 @@ class Conference < ActiveRecord::Base
:questions_attributes, :question_ids, :answers_attributes, :answer_ids,
:difficulty_levels_attributes, :use_difficulty_levels,
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
:media_id, :media_type, :color, :description
:media_id, :media_type, :color, :description,
:registration_description, :ticket_description
has_paper_trail

View file

@ -2,5 +2,5 @@ class SupporterLevel < ActiveRecord::Base
belongs_to :conference
has_many :supporter_registrations
attr_accessible :conference, :title, :url
attr_accessible :conference, :title, :url, :description, :ticket_price
end

View file

@ -14,6 +14,8 @@
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
= f.input :registration_description, hint: 'This description will appear in registration segment of the splash'
= f.input :ticket_description, hint: 'This will appear in the Tickets segment of the splash'
= f.inputs :name => "Media" do
- if !@conference.logo.blank?

View file

@ -2,6 +2,9 @@
<%= f.inputs do %>
<%= f.input :title%>
<%= f.input :url %>
<%= f.input :description %>
<%= f.input :ticket_price, hint: 'Please enter price with currency symbol.
For example, $200,₹300' %>
<%= remove_association_link :supporter_level, f %>
<% end %>
</div>

View file

@ -0,0 +1,14 @@
= content_for :splash_nav do
%li
%a{ href: '#registration' } Registration
%div.container.text-center
%div.row
%h2 Registration
- if !@conference.registration_description.blank?
%p
= @conference.registration_description
%h4 Registration period #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
- if @conference.registration_open?
= link_to "Register for #{@conference.short_title}", register_conference_path(@conference.short_title), :class =>"btn btn-success btn-lg", target: '_blank'
- if @conference.use_supporter_levels?
= render 'tickets'

View file

@ -0,0 +1,15 @@
%div.row
%h3 Tickets
-if !@conference.ticket_description.blank?
%p #{ @conference.ticket_description }
- @conference.supporter_levels.each do |s|
%div.col-md-6
- if !s.title.blank?
%h4 #{ s.title }
-if !s.description.blank?
%p #{ s.description }
- if !s.url.blank?
%div.btn-group
= link_to "Buy Ticket", s.url, class: 'btn btn-success', target: '_blank'
- if !s.ticket_price.blank?
= button_tag "#{s.ticket_price}", class: 'btn btn-success'

View file

@ -2,3 +2,6 @@
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
%div#program
= render 'program'
%div#registration
= render 'registration'

View file

@ -45,6 +45,9 @@
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))}
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title)
%li{ class: active_nav_li(admin_conference_supporter_levels_path(@conference.short_title)) }
= link_to(admin_conference_supporter_levels_path(@conference.short_title)) do
Supporter Levels
%li{:class=> active_nav_li(admin_conference_emails_path(@conference.short_title))}
= link_to(admin_conference_emails_path(@conference.short_title)) do
%span.glyphicon.glyphicon-envelope

View file

@ -0,0 +1,5 @@
class AddRegistrationDescriptionToConference < ActiveRecord::Migration
def change
add_column :conferences, :registration_description, :text
end
end

View file

@ -0,0 +1,5 @@
class AddTicketDescriptionToConference < ActiveRecord::Migration
def change
add_column :conferences, :ticket_description, :text
end
end

View file

@ -0,0 +1,5 @@
class AddDescriptionToSupporterLevel < ActiveRecord::Migration
def change
add_column :supporter_levels, :description, :text
end
end

View file

@ -0,0 +1,5 @@
class AddTicketPriceToSupporterLevel < ActiveRecord::Migration
def change
add_column :supporter_levels, :ticket_price, :string
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140528072939) do
ActiveRecord::Schema.define(version: 20140529133339) do
create_table "answers", force: true do |t|
t.string "title"
@ -51,15 +51,15 @@ ActiveRecord::Schema.define(version: 20140528072939) do
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
create_table "conferences", force: true do |t|
t.string "guid", null: false
t.string "title", null: false
t.string "short_title", null: false
t.string "guid", null: false
t.string "title", null: false
t.string "short_title", null: false
t.string "social_tag"
t.string "contact_email", null: false
t.string "timezone", null: false
t.string "contact_email", null: false
t.string "timezone", null: false
t.string "html_export_path"
t.date "start_date", null: false
t.date "end_date", null: false
t.date "start_date", null: false
t.date "end_date", null: false
t.integer "venue_id"
t.datetime "created_at"
t.datetime "updated_at"
@ -69,16 +69,19 @@ ActiveRecord::Schema.define(version: 20140528072939) do
t.string "logo_content_type"
t.integer "logo_file_size"
t.datetime "logo_updated_at"
t.boolean "use_dietary_choices", default: false
t.boolean "use_supporter_levels", default: false
t.boolean "use_dietary_choices", default: false
t.boolean "use_supporter_levels", default: false
t.integer "revision"
t.boolean "use_vpositions", default: false
t.boolean "use_vdays", default: false
t.boolean "use_difficulty_levels", default: false
t.boolean "use_vpositions", default: false
t.boolean "use_vdays", default: false
t.boolean "use_difficulty_levels", default: false
t.boolean "use_volunteers"
t.string "media_id"
t.string "media_type"
t.string "color", default: "#000000"
t.string "color", default: "#000000"
t.text "description"
t.text "registration_description"
t.text "ticket_description"
end
create_table "conferences_questions", id: false, force: true do |t|
@ -290,6 +293,8 @@ ActiveRecord::Schema.define(version: 20140528072939) do
t.integer "conference_id"
t.string "title", null: false
t.string "url"
t.text "description"
t.string "ticket_price"
end
create_table "supporter_registrations", force: true do |t|

View file

@ -1,10 +1,20 @@
require 'spec_helper'
describe 'conference/show.html.haml' do
it 'renders program partial' do
@conference = create(:conference, description: 'Lorem Ipsum')
before(:each) do
@conference = create(:conference, registration_description: 'Lorem Ipsum Dolor',
registration_start_date: Date.today,
registration_end_date: Date.tomorrow,
description: 'Lorem Ipsum')
assign :conference, @conference
render
end
it 'renders program partial' do
expect(render).to include("#{@conference.description}")
expect(view).to render_template(partial: 'conference/_program')
end
it 'renders registration partial' do
expect(rendered).to include("#{@conference.registration_description}")
expect(view).to render_template(partial: 'conference/_registration')
end
end