diff --git a/app/models/conference.rb b/app/models/conference.rb index 8b7f586a..edddb909 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -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 diff --git a/app/models/supporter_level.rb b/app/models/supporter_level.rb index e51c1be5..02c56f61 100644 --- a/app/models/supporter_level.rb +++ b/app/models/supporter_level.rb @@ -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 diff --git a/app/views/admin/conference/edit.html.haml b/app/views/admin/conference/edit.html.haml index 8ad5d0a3..d920ba1f 100644 --- a/app/views/admin/conference/edit.html.haml +++ b/app/views/admin/conference/edit.html.haml @@ -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? diff --git a/app/views/admin/supporter_levels/_supporter_level_fields.html.erb b/app/views/admin/supporter_levels/_supporter_level_fields.html.erb index ec793dc7..899efdac 100644 --- a/app/views/admin/supporter_levels/_supporter_level_fields.html.erb +++ b/app/views/admin/supporter_levels/_supporter_level_fields.html.erb @@ -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 %> diff --git a/app/views/conference/_registration.html.haml b/app/views/conference/_registration.html.haml new file mode 100644 index 00000000..5f52422b --- /dev/null +++ b/app/views/conference/_registration.html.haml @@ -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' diff --git a/app/views/conference/_tickets.html.haml b/app/views/conference/_tickets.html.haml new file mode 100644 index 00000000..2fcfbf72 --- /dev/null +++ b/app/views/conference/_tickets.html.haml @@ -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' diff --git a/app/views/conference/show.html.haml b/app/views/conference/show.html.haml index 319cb460..7489d2a9 100644 --- a/app/views/conference/show.html.haml +++ b/app/views/conference/show.html.haml @@ -2,3 +2,6 @@ = link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand' %div#program = render 'program' +%div#registration + = render 'registration' + diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 11cebd56..3f573ef7 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -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 diff --git a/db/migrate/20140528115842_add_registration_description_to_conference.rb b/db/migrate/20140528115842_add_registration_description_to_conference.rb new file mode 100644 index 00000000..b893de72 --- /dev/null +++ b/db/migrate/20140528115842_add_registration_description_to_conference.rb @@ -0,0 +1,5 @@ +class AddRegistrationDescriptionToConference < ActiveRecord::Migration + def change + add_column :conferences, :registration_description, :text + end +end diff --git a/db/migrate/20140529133052_add_ticket_description_to_conference.rb b/db/migrate/20140529133052_add_ticket_description_to_conference.rb new file mode 100644 index 00000000..ccb610d9 --- /dev/null +++ b/db/migrate/20140529133052_add_ticket_description_to_conference.rb @@ -0,0 +1,5 @@ +class AddTicketDescriptionToConference < ActiveRecord::Migration + def change + add_column :conferences, :ticket_description, :text + end +end diff --git a/db/migrate/20140529133228_add_description_to_supporter_level.rb b/db/migrate/20140529133228_add_description_to_supporter_level.rb new file mode 100644 index 00000000..4473c851 --- /dev/null +++ b/db/migrate/20140529133228_add_description_to_supporter_level.rb @@ -0,0 +1,5 @@ +class AddDescriptionToSupporterLevel < ActiveRecord::Migration + def change + add_column :supporter_levels, :description, :text + end +end diff --git a/db/migrate/20140529133339_add_ticket_price_to_supporter_level.rb b/db/migrate/20140529133339_add_ticket_price_to_supporter_level.rb new file mode 100644 index 00000000..c7ac5002 --- /dev/null +++ b/db/migrate/20140529133339_add_ticket_price_to_supporter_level.rb @@ -0,0 +1,5 @@ +class AddTicketPriceToSupporterLevel < ActiveRecord::Migration + def change + add_column :supporter_levels, :ticket_price, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 56dd290d..2950e7e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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| diff --git a/spec/views/conference/show.html.haml_spec.rb b/spec/views/conference/show.html.haml_spec.rb index d72a3070..c1d5b43a 100644 --- a/spec/views/conference/show.html.haml_spec.rb +++ b/spec/views/conference/show.html.haml_spec.rb @@ -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