From 856bd11e2ae56455f62ffe53f22d0b8d98042d7c Mon Sep 17 00:00:00 2001 From: angusmcleod Date: Mon, 10 May 2021 18:46:55 +1200 Subject: [PATCH] Update step descriptions --- .../discourse/lib/wizard-schema.js.es6 | 17 ++++++----- .../components/wizard-custom-field.hbs | 30 +++++++++++-------- controllers/custom_wizard/admin/wizard.rb | 4 +-- lib/custom_wizard/validators/template.rb | 9 +++--- plugin.rb | 2 +- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index b9a47a61..09841579 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -63,14 +63,17 @@ const step = { * type: step * number: 2 * title: Add the attribute to the wizard schema - * description: Custom Wizard templates are modeled in the client via - * the wizard-schema, which, along with the serialization in - * wizard-json and models/custom-wizard, models and serializes - * data on the client. Normally when adding an attribute, you - * just need to add it to the schema, for the rest of the - * modeling and serialization to work. + * description: Custom Wizard templates are modeled and serialized in the + * client via the Wizard Schema. In some cases, when adding a new + * attribute, you just need to add it to the schema for the + * attribute to be loaded from, and sent back to, the server. + * However, if you are adding a new type-specific field attribute, + * currently you only need to add it to the field type schema on + * the server. The field schema on the server is loaded into the + * empty ``types`` object below. + * refernces: plugins/discourse-custom-wizard/discourse/lib/wizard-json + * plugins/discourse-custom-wizard/discourse/models/custom-wizard */ - const field = { basic: { id: null, diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs index de162c6f..6b8a11fc 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs @@ -98,7 +98,23 @@ class="small"}} - + + {{!-- + /* learning_step + * unit: custom_wizard:templates_and_builder + * type: step + * number: 1 + * title: Add the attribute to the template + * description: First, add a new setting block to allow the site admin to + * administer how the attribute will work. Here we can see the + * controls for the Character Counter field attribute. Note + * the attribute is only available for text type fields (see + * isTextType conditional above this block). Note the + * consistent use of the ``setting``, ``setting-label`` and + * ``setting-value`` HTML structure throughout this component, + * and other Custom Wizard admin components. + */ + --}}
@@ -111,18 +127,6 @@ checked=field.char_counter}}
- - {{!-- - /* - * unit: custom_wizard:templates_and_builder - * type: step - * number: 1 - * title: Add the attribute to the template - * description: First... [describe how it's often not necessary to update - * the component javascript] - */ - --}} - {{/if}} {{#if isUpload}} diff --git a/controllers/custom_wizard/admin/wizard.rb b/controllers/custom_wizard/admin/wizard.rb index 8648700b..07bdc1fc 100644 --- a/controllers/custom_wizard/admin/wizard.rb +++ b/controllers/custom_wizard/admin/wizard.rb @@ -70,8 +70,8 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController # type: step # number: 3 # title: Add a permitted parameter - # description: The custom wizard server admin will only accept permitted - # attributes... + # description: The custom wizard server admin controller will only accept + # permitted attributes... ## def save_wizard_params diff --git a/lib/custom_wizard/validators/template.rb b/lib/custom_wizard/validators/template.rb index 0a3a4fba..77efc076 100644 --- a/lib/custom_wizard/validators/template.rb +++ b/lib/custom_wizard/validators/template.rb @@ -11,10 +11,11 @@ class CustomWizard::TemplateValidator ## # type: step # number: 5 - # title: Add a validation - # description: If our new attribute requires validation, that should be - # handled here, which is run before the template is saved - # to the database. + # title: Add a template validation (optional) + # description: If our new attribute requires validation of a value entered + # during administration of a wizard that should be handled here. + # Template validators are run before the template is saved to + # the database. ## def perform data = @data diff --git a/plugin.rb b/plugin.rb index f440bd9b..653d8b64 100644 --- a/plugin.rb +++ b/plugin.rb @@ -6,7 +6,7 @@ # url: https://github.com/paviliondev/discourse-custom-wizard # contact emails: angus@thepavilion.io -## +## learning_unit # unit: custom_wizard:templates_and_builder # type: introduction # title: Adding a new wizard field attribute.