Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-23 18:00:29 +01:00
FEATURE: add can_create_tag
Dieser Commit ist enthalten in:
Ursprung
12cd8ac201
Commit
345bb310e8
8 geänderte Dateien mit 28 neuen und 7 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,
|
||||
|
|
Laden …
In neuem Issue referenzieren