Make ticket layout configurable
This commit is contained in:
parent
f37d3095e1
commit
a21d95c486
7 changed files with 19 additions and 1 deletions
|
|
@ -211,7 +211,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, :organization_id)
|
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ class Conference < ActiveRecord::Base
|
||||||
:end_date,
|
:end_date,
|
||||||
:start_hour,
|
:start_hour,
|
||||||
:end_hour,
|
:end_hour,
|
||||||
|
:ticket_layout,
|
||||||
:organization, presence: true
|
:organization, presence: true
|
||||||
|
|
||||||
validates :short_title, uniqueness: true
|
validates :short_title, uniqueness: true
|
||||||
|
|
@ -73,6 +74,11 @@ class Conference < ActiveRecord::Base
|
||||||
after_create :create_free_ticket
|
after_create :create_free_ticket
|
||||||
after_update :delete_event_schedules
|
after_update :delete_event_schedules
|
||||||
|
|
||||||
|
enum ticket_layout: {
|
||||||
|
vertical: 0,
|
||||||
|
horizontal: 1
|
||||||
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# Checks if the user is registered to the conference
|
# Checks if the user is registered to the conference
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
= f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs"
|
= f.input :short_title, hint: "A short title, e.g. 'oSC14', to be used in URLs"
|
||||||
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
|
= f.input :description, hint: markdown_hint('A description of the conference.'), input_html: { rows: 5, data: { provide: 'markdown-editable' } }
|
||||||
= f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'}
|
= f.input :color, hint: 'The color will be used eg for the dashboard.', input_html: {size: 6, type: 'color'}
|
||||||
|
= f.input :ticket_layout, as: :select, collection: Conference.ticket_layouts.keys, hint: "Layout type for tickets of the conference."
|
||||||
= f.label 'Conference Logo'
|
= f.label 'Conference Logo'
|
||||||
%br
|
%br
|
||||||
- if @conference.picture?
|
- if @conference.picture?
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddTicketLayoutToConferences < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :conferences, :ticket_layout, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -105,6 +105,7 @@ ActiveRecord::Schema.define(version: 20170603095900) do
|
||||||
t.integer "start_hour", default: 9
|
t.integer "start_hour", default: 9
|
||||||
t.integer "end_hour", default: 20
|
t.integer "end_hour", default: 20
|
||||||
t.integer "organization_id"
|
t.integer "organization_id"
|
||||||
|
t.integer "ticket_layout", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "conferences", ["organization_id"], name: "index_conferences_on_organization_id"
|
add_index "conferences", ["organization_id"], name: "index_conferences_on_organization_id"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ FactoryGirl.define do
|
||||||
start_hour 9
|
start_hour 9
|
||||||
end_hour 20
|
end_hour 20
|
||||||
registration_limit 0
|
registration_limit 0
|
||||||
|
ticket_layout 0
|
||||||
description { Faker::Hipster.paragraph }
|
description { Faker::Hipster.paragraph }
|
||||||
organization
|
organization
|
||||||
after(:create) do |conference|
|
after(:create) do |conference|
|
||||||
|
|
|
||||||
|
|
@ -1573,6 +1573,10 @@ describe Conference do
|
||||||
should validate_presence_of(:end_hour)
|
should validate_presence_of(:end_hour)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'is not valid without a ticket_layout' do
|
||||||
|
should validate_presence_of(:ticket_layout)
|
||||||
|
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