Before a few renames
This commit is contained in:
@@ -6,20 +6,20 @@ module IdCard
|
||||
def edit
|
||||
@employer = Employer.find_by(slug: params[:employer_id])
|
||||
if @employer.id_card_enabled?
|
||||
@setup = @employer.id_card_configuration
|
||||
@configuration = @employer.id_card_configuration
|
||||
else
|
||||
@setup = @employer.create_id_card_configuration
|
||||
@configuration = @employer.create_id_card_configuration
|
||||
end
|
||||
render :edit
|
||||
end
|
||||
|
||||
def update
|
||||
setup_params = IdCard::Configuration.permitted_params(params)
|
||||
@setup = IdCard::Configuration.find(params[:id])
|
||||
@configuration = IdCard::Configuration.find(params[:id])
|
||||
|
||||
if @setup.update(setup_params)
|
||||
if @configuration.update(setup_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Configuration was successfully updated.'
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Configuration was successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :edit, status: :unprocessable_entity
|
||||
@@ -30,8 +30,8 @@ module IdCard
|
||||
def general
|
||||
provider_defaults = IdCard::ProviderSection.defaults
|
||||
@provider_options = provider_defaults.map { |p| ["Default #{p.title}", p.id] }.concat(provider_defaults.map { |p| ["New #{p.title}", "new|#{p.id}"] })
|
||||
if @setup.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@setup.provider_section_id)
|
||||
@provider_options.insert(0, ["#{@employer.name} Custom", @setup.provider_section_id])
|
||||
if @configuration.provider_section_id.present? && provider_defaults.map(&:id).exclude?(@configuration.provider_section_id)
|
||||
@provider_options.insert(0, ["#{@employer.name} Custom", @configuration.provider_section_id])
|
||||
end
|
||||
@rx_options = IdCard::RxSection.all
|
||||
@fairos_rx_id = IdCard::RxSection.find_by(title: "FairosRx").id
|
||||
@@ -45,7 +45,7 @@ module IdCard
|
||||
params[:id_card_configuration]["provider_section_id"] = new_provider_section.id
|
||||
end
|
||||
general_params = IdCard::Configuration.permitted_params(params)
|
||||
if @setup.update(general_params)
|
||||
if @configuration.update(general_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@employer.slug), notice: 'ID Card Configuration was successfully updated.'
|
||||
else
|
||||
@@ -61,9 +61,9 @@ module IdCard
|
||||
|
||||
def update_plans
|
||||
plans_params = IdCard::Plan.permitted_params(params)
|
||||
if @setup.update(plans_params)
|
||||
if @configuration.update(plans_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.'
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Plans successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :plans, status: :unprocessable_entity
|
||||
@@ -77,9 +77,9 @@ module IdCard
|
||||
|
||||
def update_field_exceptions
|
||||
field_exceptions_params = IdCard::FieldException.permitted_params(params)
|
||||
if @setup.update(field_exceptions_params)
|
||||
if @configuration.update(field_exceptions_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.'
|
||||
redirect_to employer_path(@configuration.employer.slug), notice: 'ID Card Exceptions successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :field_exceptions, status: :unprocessable_entity
|
||||
@@ -100,9 +100,9 @@ module IdCard
|
||||
def set_employer_and_setup
|
||||
@employer = Employer.find_by(slug: params[:employer_id])
|
||||
if @employer.id_card_configuration.present?
|
||||
@setup = @employer.id_card_configuration
|
||||
@configuration = @employer.id_card_configuration
|
||||
else
|
||||
@setup = @employer.create_id_card_configuration
|
||||
@configuration = @employer.create_id_card_configuration
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user