From 28094ab17bf9198f1fdc097149a1ba8acb44cfb1 Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Tue, 1 Jun 2021 10:57:49 +0530 Subject: [PATCH] modified docs according to new field model structure --- .../initializers/custom-wizard-field.js.es6 | 2 +- controllers/custom_wizard/admin/wizard.rb | 8 -------- lib/custom_wizard/field.rb | 15 +++++++++++++++ .../custom_wizard/wizard_field_serializer.rb | 6 ------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 b/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 index 39997948..ef45e949 100644 --- a/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 +++ b/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 @@ -20,7 +20,7 @@ export default { /* * unit: custom_wizard:templates_and_builder * type: step - * number: 9 + * number: 8 * title: Handle the attribute in the wizard client * description: We can now handle our new attribute in the wizard client. * For our "highlighted" attribute, we would add a diff --git a/controllers/custom_wizard/admin/wizard.rb b/controllers/custom_wizard/admin/wizard.rb index b01fe368..2f2efe9a 100644 --- a/controllers/custom_wizard/admin/wizard.rb +++ b/controllers/custom_wizard/admin/wizard.rb @@ -66,14 +66,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController ] end - ## - # type: step - # number: 3 - # title: Add a permitted parameter - # description: The custom wizard server admin controller will only accept - # permitted attributes... - ## - def save_wizard_params params.require(:wizard).permit( :id, diff --git a/lib/custom_wizard/field.rb b/lib/custom_wizard/field.rb index 52d9a16b..a14d877c 100644 --- a/lib/custom_wizard/field.rb +++ b/lib/custom_wizard/field.rb @@ -3,6 +3,21 @@ class CustomWizard::Field include ActiveModel::SerializerSupport + ## + # type: step + # number: 3 + # title: Add the field name to attribute map + # description: The attribute map serves as a global registry for field attributes. Set the + # key as the attribute name and value as an array of properties. Use the properties according to the + # your usecase. Here's a list and description of each of the properties. + # accessible: The attribute is passed to attr_accessor + # serializable: The attribute is serialized to the client + # permitted: The attribute is permitted to be passed to the admin side controller for saving + # mapped: The attribute is a mapped attributed and is permitted to be passed to the admin side controller for saving + # excluded: The attribute is not initialized in the constructor. This is used + # if the attribute needs a method + ## + def self.attribute_map { raw: [], diff --git a/serializers/custom_wizard/wizard_field_serializer.rb b/serializers/custom_wizard/wizard_field_serializer.rb index 9b273da3..ffad36c8 100644 --- a/serializers/custom_wizard/wizard_field_serializer.rb +++ b/serializers/custom_wizard/wizard_field_serializer.rb @@ -1,11 +1,5 @@ # frozen_string_literal: true -## -# type: step -# number: 8 -# title: Add it to the serializer -# description: We want our new attribute to be serialized to the wizard client... -## class CustomWizard::FieldSerializer < ::ApplicationSerializer attributes *CustomWizard::Field.serializable_attributes