Merge f952dd7c9b into 139a8565e2
This commit is contained in:
commit
96a92670c6
8 changed files with 44 additions and 2 deletions
|
|
@ -186,7 +186,7 @@ module Admin
|
||||||
:vpositions_attributes, :use_volunteers, :color,
|
:vpositions_attributes, :use_volunteers, :color,
|
||||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||||
:targets, :targets_attributes,
|
:targets, :targets_attributes,
|
||||||
:campaigns, :campaigns_attributes, :registration_limit)
|
:campaigns, :campaigns_attributes, :registration_limit, :payment_method)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ class Conference < ActiveRecord::Base
|
||||||
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
|
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
|
||||||
validates :registration_limit, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
validates :registration_limit, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||||
|
|
||||||
|
validates :payment_method, presence: true, null: false, inclusion: {in: %w(online offline),
|
||||||
|
message: "'%{value}' is not a valid payment method"}
|
||||||
|
|
||||||
# This validation is needed since a conference with a start date greater than the end date is not possible
|
# This validation is needed since a conference with a start date greater than the end date is not possible
|
||||||
validate :valid_date_range?
|
validate :valid_date_range?
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,13 @@
|
||||||
= 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.inputs name: "Registrations" do
|
= f.inputs name: "Registrations" do
|
||||||
= f.input :registration_limit, as: :number, in: 0..9999, hint: "Limit the number of registrations to the conference (0 no limit)"
|
= f.input :registration_limit, as: :number, in: 0..9999, hint: "Limit the number of registrations to the conference (0 no limit)"
|
||||||
|
= f.inputs name: "Tickets" do
|
||||||
|
= f.label :payment_method
|
||||||
|
.btn-group{"data-toggle" => :payment_method, class: "pull-right"}
|
||||||
|
%label.btn.btn-default
|
||||||
|
= f.radio_button :payment_method, 'online'
|
||||||
|
Pay Online
|
||||||
|
%label.btn.btn-default
|
||||||
|
= f.radio_button :payment_method, 'offline'
|
||||||
|
Pay at the venue
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,14 @@
|
||||||
= f.input :timezone, as: :time_zone, hint: 'Please select in what time zone your conference will take place.'
|
= f.input :timezone, as: :time_zone, hint: 'Please select in what time zone your conference will take place.'
|
||||||
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' }
|
= f.input :start_date, as: :string, input_html: { id: 'conference-start-datepicker', required: 'required' }
|
||||||
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', required: 'required' }
|
= f.input :end_date, as: :string, input_html: { id: 'conference-end-datepicker', required: 'required' }
|
||||||
|
= f.inputs name: "Tickets" do
|
||||||
|
= f.label :payment_method
|
||||||
|
.btn-group{"data-toggle" => :payment_method, class: "pull-right"}
|
||||||
|
%label.btn.btn-default
|
||||||
|
= f.radio_button :payment_method, 'online'
|
||||||
|
Pay Online
|
||||||
|
%label.btn.btn-default
|
||||||
|
= f.radio_button :payment_method, 'offline'
|
||||||
|
Pay at the venue
|
||||||
= f.actions do
|
= f.actions do
|
||||||
= f.action :submit, button_html: {class: 'btn btn-success pull-right'}
|
= f.action :submit, button_html: {class: 'btn btn-success pull-right'}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddPaymentMethodToConferences < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :conferences, :payment_method, :string, default: 'offline', null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160427104236) do
|
ActiveRecord::Schema.define(version: 20160603043546) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: :cascade do |t|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.uuid "visit_id", limit: 16
|
t.uuid "visit_id", limit: 16
|
||||||
|
|
@ -102,6 +102,7 @@ ActiveRecord::Schema.define(version: 20160427104236) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "registration_limit", default: 0
|
t.integer "registration_limit", default: 0
|
||||||
t.string "picture"
|
t.string "picture"
|
||||||
|
t.string "payment_method", default: "offline", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "conferences_questions", id: false, force: :cascade do |t|
|
create_table "conferences_questions", id: false, force: :cascade do |t|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ FactoryGirl.define do
|
||||||
end_date { 6.days.from_now }
|
end_date { 6.days.from_now }
|
||||||
registration_limit 0
|
registration_limit 0
|
||||||
description { Faker::Hipster.paragraph }
|
description { Faker::Hipster.paragraph }
|
||||||
|
payment_method 'offline'
|
||||||
|
|
||||||
after(:create) do |conference|
|
after(:create) do |conference|
|
||||||
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
||||||
|
|
|
||||||
|
|
@ -1545,6 +1545,20 @@ describe Conference do
|
||||||
should validate_presence_of(:end_date)
|
should validate_presence_of(:end_date)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'is not valid without payment mode' do
|
||||||
|
should validate_presence_of(:payment_method)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is valid with payment mode as Online' do
|
||||||
|
should allow_value('online').for(:payment_method).
|
||||||
|
with_message("'%{value}' is not a valid payment method")
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is valid with payment mode as Offline' do
|
||||||
|
should allow_value('offline').for(:payment_method).
|
||||||
|
with_message("'%{value}' is not a valid payment method")
|
||||||
|
end
|
||||||
|
|
||||||
it 'is not valid with a duplicate short title' do
|
it 'is not valid with a duplicate short title' do
|
||||||
should validate_uniqueness_of(:short_title)
|
should validate_uniqueness_of(:short_title)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue