This commit is contained in:
Rishabh Saxena 2016-06-15 16:04:03 +00:00 committed by GitHub
commit 96a92670c6
8 changed files with 44 additions and 2 deletions

View file

@ -186,7 +186,7 @@ module Admin
:vpositions_attributes, :use_volunteers, :color,
:sponsorship_levels_attributes, :sponsors_attributes,
:targets, :targets_attributes,
:campaigns, :campaigns_attributes, :registration_limit)
:campaigns, :campaigns_attributes, :registration_limit, :payment_method)
end
end
end

View file

@ -57,6 +57,9 @@ class Conference < ActiveRecord::Base
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 :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
validate :valid_date_range?
before_create :generate_guid

View file

@ -23,4 +23,13 @@
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
= 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.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"}

View file

@ -10,5 +10,14 @@
= 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 :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.action :submit, button_html: {class: 'btn btn-success pull-right'}