Merge pull request #207 from paviliondev/add_tag_creation_to_tag_field
FEATURE: add can_create_tag
Dieser Commit ist enthalten in:
Commit
5e3b0f6d2a
9 geänderte Dateien mit 29 neuen und 8 gelöschten Zeilen
|
@ -114,6 +114,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
|||
:property,
|
||||
:preview_template,
|
||||
:placeholder,
|
||||
:can_create_tag,
|
||||
prefill: mapped_params,
|
||||
content: mapped_params,
|
||||
condition: mapped_params,
|
||||
|
|
|
@ -17,6 +17,7 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
|||
:property,
|
||||
:content,
|
||||
:tag_groups,
|
||||
:can_create_tag,
|
||||
:validations,
|
||||
:max_length,
|
||||
:char_counter,
|
||||
|
@ -98,6 +99,10 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
|||
object.tag_groups
|
||||
end
|
||||
|
||||
def can_create_tag
|
||||
object.can_create_tag
|
||||
end
|
||||
|
||||
def validations
|
||||
validations = {}
|
||||
object.validations&.each do |type, props|
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
everyTag=true
|
||||
options=(hash
|
||||
maximum=field.limit
|
||||
allowAny=field.can_create_tag
|
||||
)}}
|
||||
|
|
|
@ -222,6 +222,18 @@
|
|||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting">
|
||||
<div class="setting-label">
|
||||
<label>{{i18n "admin.wizard.field.can_create_tag"}}</label>
|
||||
</div>
|
||||
|
||||
<div class="setting-value">
|
||||
{{input
|
||||
type="checkbox"
|
||||
checked=field.can_create_tag}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#wizard-subscription-container}}
|
||||
|
|
|
@ -277,6 +277,7 @@ en:
|
|||
prefill: "Prefill"
|
||||
content: "Content"
|
||||
tag_groups: "Tag Groups"
|
||||
can_create_tag: "Can Create Tag"
|
||||
date_time_format:
|
||||
label: "Format"
|
||||
instructions: "<a href='https://momentjs.com/docs/#/displaying/format/' target='_blank'>Moment.js format</a>"
|
||||
|
|
|
@ -20,9 +20,6 @@ pre-commit:
|
|||
glob: "*.js"
|
||||
include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
|
||||
run: yarn eslint -f compact --quiet {staged_files}
|
||||
i18n-lint:
|
||||
glob: "**/{client,server}.en.yml"
|
||||
run: bundle exec ruby script/i18n_lint.rb {staged_files}
|
||||
|
||||
lints:
|
||||
parallel: true
|
||||
|
@ -36,6 +33,3 @@ lints:
|
|||
run: yarn prettier --list-different **/*.scss
|
||||
eslint:
|
||||
run: yarn eslint -f compact --quiet --ext .js .
|
||||
i18n-lint:
|
||||
glob: "**/{client,server}.en.yml"
|
||||
run: bundle exec ruby script/i18n_lint.rb {all_files}
|
||||
|
|
|
@ -135,6 +135,10 @@ class CustomWizard::Builder
|
|||
params[:limit] = field_template['limit']
|
||||
end
|
||||
|
||||
if field_template['type'] === 'tag'
|
||||
params[:can_create_tag] = standardise_boolean(field_template['can_create_tag'])
|
||||
end
|
||||
|
||||
if field_template['type'] === 'category'
|
||||
params[:property] = field_template['property']
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ class CustomWizard::Field
|
|||
:property,
|
||||
:content,
|
||||
:tag_groups,
|
||||
:can_create_tag,
|
||||
:preview_template,
|
||||
:placeholder
|
||||
|
||||
|
@ -47,6 +48,7 @@ class CustomWizard::Field
|
|||
@property = attrs[:property]
|
||||
@content = attrs[:content]
|
||||
@tag_groups = attrs[:tag_groups]
|
||||
@can_create_tag = attrs[:can_create_tag]
|
||||
@preview_template = attrs[:preview_template]
|
||||
@placeholder = attrs[:placeholder]
|
||||
end
|
||||
|
@ -113,7 +115,8 @@ class CustomWizard::Field
|
|||
limit: nil,
|
||||
prefill: nil,
|
||||
content: nil,
|
||||
tag_groups: nil
|
||||
tag_groups: nil,
|
||||
can_create_tag: false
|
||||
},
|
||||
category: {
|
||||
limit: 1,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
# name: discourse-custom-wizard
|
||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||
# version: 2.0.7
|
||||
# version: 2.1.0
|
||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||
# contact_emails: development@pavilion.tech
|
||||
|
|
Laden …
In neuem Issue referenzieren