venue_management/app/controllers/admin/venue_management_signups_co...

54 lines
1.6 KiB
Ruby
Raw Normal View History

2020-05-07 15:26:34 +00:00
# encoding: utf-8
class Admin::VenueManagementSignupsController < OrbitAdminController
include Admin::VenueManagementsHelper
before_action ->(module_app = @app_title) { set_variables module_app }
def initialize
super
@app_title = "venue_management"
end
def edit
OrbitHelper.set_params(params,current_user)
params[:controller] = "admin/venue_managements"
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management = VenueManagementMain.find(@venue_management_signup.venue_management_main_id)
@form_index = 0
end
def update
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management_signup.update_attributes(venue_management_signup_params)
if !params[:venue_management_signup_values].nil?
params[:venue_management_signup_values].each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = VenueManagementSignupValue.put_field_values(@venue_management_signup, r.last, r.last[:id], field_value)
end
end
redirect_to "/admin/venue_managements/#{@venue_management_signup.venue_management_main_id}/venue_management_signup"
end
def destroy
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management_main_id = @venue_management_signup.venue_management_main_id
@venue_management_signup.destroy
redirect_to "/admin/venue_managements/#{@venue_management_main_id}/venue_management_signup"
end
private
def venue_management_signup_params
params.require(:venue_management_signup).permit!
end
end