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')
|
||||
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() {
|
||||
const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Laden …
In neuem Issue referenzieren