This commit is contained in:
Siddhant Bajaj 2017-06-30 00:42:54 +00:00 committed by GitHub
commit fe2af4a7ec
7 changed files with 19 additions and 1 deletions

View file

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

View file

@ -57,6 +57,7 @@ class Conference < ActiveRecord::Base
:end_date,
:start_hour,
:end_hour,
:ticket_layout,
:organization, presence: true
validates :short_title, uniqueness: true
@ -73,6 +74,11 @@ class Conference < ActiveRecord::Base
after_create :create_free_ticket
after_update :delete_event_schedules
enum ticket_layout: {
vertical: 0,
horizontal: 1
}
##
# Checks if the user is registered to the conference
#

View file

@ -11,6 +11,7 @@
= 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 :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'
%br
- if @conference.picture?

View file

@ -0,0 +1,5 @@
class AddTicketLayoutToConferences < ActiveRecord::Migration
def change
add_column :conferences, :ticket_layout, :integer, default: 0
end
end

View file

@ -105,6 +105,7 @@ ActiveRecord::Schema.define(version: 20170603095900) do
t.integer "start_hour", default: 9
t.integer "end_hour", default: 20
t.integer "organization_id"
t.integer "ticket_layout", default: 0
end
add_index "conferences", ["organization_id"], name: "index_conferences_on_organization_id"

View file

@ -10,6 +10,7 @@ FactoryGirl.define do
start_hour 9
end_hour 20
registration_limit 0
ticket_layout 0
description { Faker::Hipster.paragraph }
organization
after(:create) do |conference|

View file

@ -1573,6 +1573,10 @@ describe Conference do
should validate_presence_of(:end_hour)
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
should validate_uniqueness_of(:short_title)
end