diff --git a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 b/assets/javascripts/discourse/components/wizard-custom-action.js.es6
index a2df85b3..f842a8a6 100644
--- a/assets/javascripts/discourse/components/wizard-custom-action.js.es6
+++ b/assets/javascripts/discourse/components/wizard-custom-action.js.es6
@@ -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() {
diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
index 4f9f0e2f..63919ae3 100644
--- a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
+++ b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
@@ -114,7 +114,19 @@
{{tag-chooser tags=action.tags
filterable=true
allowCreate=true
- isDisabled=action.custom_category_enabled}}
+ isDisabled=action.custom_tag_enabled}}
+
+ {{input type='checkbox' checked=action.custom_tag_enabled}}
+
{{i18n 'admin.wizard.action.custom_tag.label'}}
+ {{#if action.custom_tag_enabled}}
+
+ {{combo-box value=action.custom_tag_field
+ content=tagFields
+ nameProperty="label"
+ none='admin.wizard.select_field'}}
+
+ {{/if}}
+
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 9372570c..c2c4ee6a 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -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"
diff --git a/lib/builder.rb b/lib/builder.rb
index ee29c549..05221e10 100644
--- a/lib/builder.rb
+++ b/lib/builder.rb
@@ -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