0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

FIX: properly account for custom tag fields

Dieser Commit ist enthalten in:
Angus McLeod 2019-10-15 16:34:43 +11:00
Ursprung 9880bd780e
Commit 7792d2365b
4 geänderte Dateien mit 31 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -59,9 +59,13 @@ export default Ember.Component.extend({
@computed('availableFields')
categoryFields(fields) {
console.log(fields);
return fields.filter(f => f.type == 'category');
},
@computed('availableFields')
tagFields(fields) {
return fields.filter(f => f.type == 'tag');
},
@computed()
builderUserFields() {

Datei anzeigen

@ -114,7 +114,19 @@
{{tag-chooser tags=action.tags
filterable=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>
{{/if}}

Datei anzeigen

@ -158,6 +158,8 @@ en:
label: "Custom Category"
wizard_field: "Wizard Field"
user_field: "User Field"
custom_tag:
label: "Custom Tag"
send_to_api:
label: "Send to API"
api: "API"

Datei anzeigen

@ -558,8 +558,8 @@ class CustomWizard::Builder
end
end
if action['tags'].present?
url += "&tags=#{action['tags'].join(',')}"
if tags = action_tags(action, data)
url += "&tags=#{tags.join(',')}"
end
data['redirect_on_complete'] = Discourse.base_uri + URI.encode(url)
@ -603,7 +603,7 @@ class CustomWizard::Builder
def action_category_id(action, data)
if action['custom_category_enabled']
if action['custom_category_wizard_field']
category_id = data[action['category_id']]
data[action['category_id']]
elsif action['custom_category_user_field_key']
if action['custom_category_user_field_key'].include?('custom_fields')
field = action['custom_category_user_field_key'].split('.').last
@ -616,4 +616,12 @@ class CustomWizard::Builder
action['category_id']
end
end
def action_tags(action, data)
if action['custom_tag_enabled']
data[action['custom_tag_field']]
else
action['tags']
end
end
end