0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-21 17:00:29 +01:00

FEATURE: add can_create_tag

Dieser Commit ist enthalten in:
Angus McLeod 2022-10-26 10:04:50 +02:00
Ursprung 12cd8ac201
Commit 345bb310e8
8 geänderte Dateien mit 28 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -114,6 +114,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
:property, :property,
:preview_template, :preview_template,
:placeholder, :placeholder,
:can_create_tag,
prefill: mapped_params, prefill: mapped_params,
content: mapped_params, content: mapped_params,
condition: mapped_params, condition: mapped_params,

Datei anzeigen

@ -17,6 +17,7 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
:property, :property,
:content, :content,
:tag_groups, :tag_groups,
:can_create_tag,
:validations, :validations,
:max_length, :max_length,
:char_counter, :char_counter,
@ -98,6 +99,10 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
object.tag_groups object.tag_groups
end end
def can_create_tag
object.can_create_tag
end
def validations def validations
validations = {} validations = {}
object.validations&.each do |type, props| object.validations&.each do |type, props|

Datei anzeigen

@ -5,4 +5,5 @@
everyTag=true everyTag=true
options=(hash options=(hash
maximum=field.limit maximum=field.limit
allowAny=field.can_create_tag
)}} )}}

Datei anzeigen

@ -222,6 +222,18 @@
}} }}
</div> </div>
</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}} {{/if}}
{{#wizard-subscription-container}} {{#wizard-subscription-container}}

Datei anzeigen

@ -277,6 +277,7 @@ en:
prefill: "Prefill" prefill: "Prefill"
content: "Content" content: "Content"
tag_groups: "Tag Groups" tag_groups: "Tag Groups"
can_create_tag: "Can Create Tag"
date_time_format: date_time_format:
label: "Format" label: "Format"
instructions: "<a href='https://momentjs.com/docs/#/displaying/format/' target='_blank'>Moment.js format</a>" instructions: "<a href='https://momentjs.com/docs/#/displaying/format/' target='_blank'>Moment.js format</a>"

Datei anzeigen

@ -20,9 +20,6 @@ pre-commit:
glob: "*.js" glob: "*.js"
include: "app/assets/javascripts|plugins/.+?/assets/javascripts" include: "app/assets/javascripts|plugins/.+?/assets/javascripts"
run: yarn eslint -f compact --quiet {staged_files} 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: lints:
parallel: true parallel: true
@ -36,6 +33,3 @@ lints:
run: yarn prettier --list-different **/*.scss run: yarn prettier --list-different **/*.scss
eslint: eslint:
run: yarn eslint -f compact --quiet --ext .js . 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}

Datei anzeigen

@ -135,6 +135,10 @@ class CustomWizard::Builder
params[:limit] = field_template['limit'] params[:limit] = field_template['limit']
end end
if field_template['type'] === 'tag'
params[:can_create_tag] = standardise_boolean(field_template['can_create_tag'])
end
if field_template['type'] === 'category' if field_template['type'] === 'category'
params[:property] = field_template['property'] params[:property] = field_template['property']
end end

Datei anzeigen

@ -22,6 +22,7 @@ class CustomWizard::Field
:property, :property,
:content, :content,
:tag_groups, :tag_groups,
:can_create_tag,
:preview_template, :preview_template,
:placeholder :placeholder
@ -47,6 +48,7 @@ class CustomWizard::Field
@property = attrs[:property] @property = attrs[:property]
@content = attrs[:content] @content = attrs[:content]
@tag_groups = attrs[:tag_groups] @tag_groups = attrs[:tag_groups]
@can_create_tag = attrs[:can_create_tag]
@preview_template = attrs[:preview_template] @preview_template = attrs[:preview_template]
@placeholder = attrs[:placeholder] @placeholder = attrs[:placeholder]
end end
@ -113,7 +115,8 @@ class CustomWizard::Field
limit: nil, limit: nil,
prefill: nil, prefill: nil,
content: nil, content: nil,
tag_groups: nil tag_groups: nil,
can_create_tag: false
}, },
category: { category: {
limit: 1, limit: 1,