suggested changes

This commit is contained in:
shlok007 2017-06-07 14:14:42 +05:30
parent 949f5cb591
commit b29856a122
2 changed files with 3 additions and 8 deletions

View file

@ -79,12 +79,9 @@ module Admin
end
def create
conference_params_copy = conference_params
if ENV['ORGANIZATIONS_ENABLED'] != 'true'
org = Organization.exists?(name: 'default') ? Organization.find_by(name: 'default') : Organization.create(name: 'default')
conference_params_copy[:organization_id] = org.id
end
@conference = Conference.new(conference_params_copy)
org = Organization.find_or_create_by(name: 'organization')
@conference = Conference.new(conference_params)
@conference.organization = org
if @conference.save
# user that creates the conference becomes organizer of that conference
current_user.add_role :organizer, @conference

View file

@ -6,8 +6,6 @@
input_html: { required: 'required' }
= f.input :short_title, hint: "A short and unique handle for your conference, using only letters, numbers, underscores, and dashes. This will be used to identify your conference in URLs etc. Example: 'froscon2011'",
input_html: { required: 'required', pattern: '[a-zA-Z0-9_-]+', title: 'Only letters, numbers, underscores, and dashes.' }, prepend: conferences_url + '/'
- if ENV['ORGANIZATIONS_ENABLED'] == 'true'
= f.input :organization, as: :select, collection: @organizations
= f.inputs 'Scheduling' do
= f.input :timezone, as: :time_zone, default: Time.zone.name, 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' }