Mention organization name while creating a conference

This commit is contained in:
shlok007 2017-08-13 02:31:46 +05:30 committed by Shlok Srivastava
parent c596a9fda7
commit 1a5aa14e2c
3 changed files with 7 additions and 3 deletions

View file

@ -72,11 +72,12 @@ module Admin
def new
@conference = Conference.new
@organizations = Organization.accessible_by(current_ability, :update).pluck(:name, :id)
end
def create
@conference = Conference.new(conference_params)
@conference.organization = Organization.find_or_create_by(name: 'organization')
if @conference.save
# user that creates the conference becomes organizer of that conference
current_user.add_role :organizer, @conference

View file

@ -2,6 +2,7 @@
.col-md-8
= semantic_form_for(@conference, url: admin_conferences_path) do |f|
= f.inputs 'Basic Information' do
= f.input :organization, as: :select, collection: @organizations
= f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'",
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'",