Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 17:30:29 +01:00
FIX: properly account for custom tag fields
Dieser Commit ist enthalten in:
Ursprung
9880bd780e
Commit
7792d2365b
4 geänderte Dateien mit 31 neuen und 5 gelöschten Zeilen
|
@ -59,10 +59,14 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed('availableFields')
|
@computed('availableFields')
|
||||||
categoryFields(fields) {
|
categoryFields(fields) {
|
||||||
console.log(fields);
|
|
||||||
return fields.filter(f => f.type == 'category');
|
return fields.filter(f => f.type == 'category');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@computed('availableFields')
|
||||||
|
tagFields(fields) {
|
||||||
|
return fields.filter(f => f.type == 'tag');
|
||||||
|
},
|
||||||
|
|
||||||
@computed()
|
@computed()
|
||||||
builderUserFields() {
|
builderUserFields() {
|
||||||
const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');
|
const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');
|
||||||
|
|
|
@ -114,7 +114,19 @@
|
||||||
{{tag-chooser tags=action.tags
|
{{tag-chooser tags=action.tags
|
||||||
filterable=true
|
filterable=true
|
||||||
allowCreate=true
|
allowCreate=true
|
||||||
isDisabled=action.custom_category_enabled}}
|
isDisabled=action.custom_tag_enabled}}
|
||||||
|
<div class="setting-gutter">
|
||||||
|
{{input type='checkbox' checked=action.custom_tag_enabled}}
|
||||||
|
<span>{{i18n 'admin.wizard.action.custom_tag.label'}}</span>
|
||||||
|
{{#if action.custom_tag_enabled}}
|
||||||
|
<div class="custom-tag">
|
||||||
|
{{combo-box value=action.custom_tag_field
|
||||||
|
content=tagFields
|
||||||
|
nameProperty="label"
|
||||||
|
none='admin.wizard.select_field'}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -158,6 +158,8 @@ en:
|
||||||
label: "Custom Category"
|
label: "Custom Category"
|
||||||
wizard_field: "Wizard Field"
|
wizard_field: "Wizard Field"
|
||||||
user_field: "User Field"
|
user_field: "User Field"
|
||||||
|
custom_tag:
|
||||||
|
label: "Custom Tag"
|
||||||
send_to_api:
|
send_to_api:
|
||||||
label: "Send to API"
|
label: "Send to API"
|
||||||
api: "API"
|
api: "API"
|
||||||
|
|
|
@ -558,8 +558,8 @@ class CustomWizard::Builder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if action['tags'].present?
|
if tags = action_tags(action, data)
|
||||||
url += "&tags=#{action['tags'].join(',')}"
|
url += "&tags=#{tags.join(',')}"
|
||||||
end
|
end
|
||||||
|
|
||||||
data['redirect_on_complete'] = Discourse.base_uri + URI.encode(url)
|
data['redirect_on_complete'] = Discourse.base_uri + URI.encode(url)
|
||||||
|
@ -603,7 +603,7 @@ class CustomWizard::Builder
|
||||||
def action_category_id(action, data)
|
def action_category_id(action, data)
|
||||||
if action['custom_category_enabled']
|
if action['custom_category_enabled']
|
||||||
if action['custom_category_wizard_field']
|
if action['custom_category_wizard_field']
|
||||||
category_id = data[action['category_id']]
|
data[action['category_id']]
|
||||||
elsif action['custom_category_user_field_key']
|
elsif action['custom_category_user_field_key']
|
||||||
if action['custom_category_user_field_key'].include?('custom_fields')
|
if action['custom_category_user_field_key'].include?('custom_fields')
|
||||||
field = action['custom_category_user_field_key'].split('.').last
|
field = action['custom_category_user_field_key'].split('.').last
|
||||||
|
@ -616,4 +616,12 @@ class CustomWizard::Builder
|
||||||
action['category_id']
|
action['category_id']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def action_tags(action, data)
|
||||||
|
if action['custom_tag_enabled']
|
||||||
|
data[action['custom_tag_field']]
|
||||||
|
else
|
||||||
|
action['tags']
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren