Retire semantic_form_for

Also a buttload of form cleanups...
This commit is contained in:
Henne Vogelsang 2022-02-23 17:52:16 +01:00
parent 350b1ebbbe
commit 81853d1ef9
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
136 changed files with 1825 additions and 1441 deletions

View file

@ -68,7 +68,6 @@ module Admin
def new
@conference = Conference.new
@organizations = Organization.accessible_by(current_ability, :update).pluck(:name, :id)
end
def create

View file

@ -12,11 +12,12 @@ module Admin
def update
authorize! :update, @conference.program
@program = @conference.program
params['program']['languages'] = params['program']['languages'].join(',') if params['program']['languages'].present?
@program.assign_attributes(program_params)
send_mail_on_schedule_public = @program.notify_on_schedule_public?
event_schedules_count_was = @program.event_schedules.count
if @program.update(program_params)
if @program.save
ConferenceScheduleUpdateMailJob.perform_later(@conference) if send_mail_on_schedule_public
respond_to do |format|
format.html do
@ -40,7 +41,7 @@ module Admin
private
def program_params
params.require(:program).permit(:rating, :schedule_public, :schedule_interval, :schedule_fluid, :languages, :blind_voting, :voting_start_date, :voting_end_date, :selected_schedule_id)
params.require(:program).permit(:rating, :schedule_public, :schedule_interval, :schedule_fluid, :blind_voting, :voting_start_date, :voting_end_date, :selected_schedule_id, :languages)
end
end
end

View file

@ -3,7 +3,7 @@
module Admin
class QuestionsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference, except: [:new, :create]
load_and_authorize_resource except: [:new, :create]
def index
authorize! :index, Question.new(conference_id: @conference.id)

View file

@ -20,7 +20,7 @@ module Admin
respond_to do |format|
format.html
format.json do
render json: RegistrationDatatable.new(view_context: view_context, conference: @conference)
render json: RegistrationDatatable.new({}, conference: @conference, view_context: view_context)
end
format.pdf { render 'index', layout: false }
format.xlsx do

View file

@ -17,7 +17,7 @@ module Admin
def create
@ticket = @conference.tickets.new(ticket_params)
if @ticket.save(ticket_params)
if @ticket.save
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully created.'
else