diff --git a/app/controllers/admin/writing_conferences_controller.rb b/app/controllers/admin/writing_conferences_controller.rb index a777238..9d3d1d4 100644 --- a/app/controllers/admin/writing_conferences_controller.rb +++ b/app/controllers/admin/writing_conferences_controller.rb @@ -23,14 +23,50 @@ class Admin::WritingConferencesController < OrbitMemberController end def create - @member = MemberProfile.find(conference_params['member_profile_id']) rescue nil - @writing_conference = WritingConference.new(conference_params) - @writing_conference.save - if params[:desktop] == "true" - render json: {"data" => get_paper_list}.to_json - else + + if !conference_params['member_profile_id'].blank? + + @member = MemberProfile.find(conference_params['member_profile_id']) rescue nil + @writing_conference = WritingConference.new(conference_params) + @writing_conference.save + + if params[:desktop] == "true" + render json: {"data" => get_paper_list}.to_json + else + redirect_to params['referer_url'] + end + + elsif !params[:author_members].blank? + + params[:author_members].each do |author_member| + + conference_params['member_profile_id'] = author_member + @writing_conference = WritingConference.new(conference_params) + @writing_conference.save + + if params[:desktop] == "true" + render json: {"data" => get_paper_list}.to_json + end + + end + redirect_to params['referer_url'] + + else + + conference_params['member_profile_id'] = User.find(current_user.id).member_profile_id + + @writing_conference = WritingConference.new(conference_params) + @writing_conference.save + + if params[:desktop] == "true" + render json: {"data" => get_paper_list}.to_json + end + + redirect_to params['referer_url'] + end + end def edit diff --git a/app/views/admin/writing_conferences/_form.html.erb b/app/views/admin/writing_conferences/_form.html.erb index cc120c9..5c71ec5 100644 --- a/app/views/admin/writing_conferences/_form.html.erb +++ b/app/views/admin/writing_conferences/_form.html.erb @@ -135,14 +135,27 @@