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,
|
: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,
|
||||||
|
|
|
@ -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|
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
everyTag=true
|
everyTag=true
|
||||||
options=(hash
|
options=(hash
|
||||||
maximum=field.limit
|
maximum=field.limit
|
||||||
|
allowAny=field.can_create_tag
|
||||||
)}}
|
)}}
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
|
@ -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>"
|
||||||
|
|
|
@ -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}
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
# 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
|
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact_emails: development@pavilion.tech
|
# contact_emails: development@pavilion.tech
|
||||||
|
|
Laden …
In neuem Issue referenzieren