diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs index 0a1202cf..82729e49 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs @@ -102,6 +102,16 @@ {{/if}} +
+
+

{{i18n "admin.wizard.action.skip_redirect.label"}}

+
+
+ {{input type='checkbox' checked=action.skip_redirect}} + {{i18n 'admin.wizard.action.skip_redirect.description' type='topic'}} +
+
+
{{wizard-custom-inputs inputs=action.add_fields @@ -165,6 +175,16 @@
+
+
+

{{i18n "admin.wizard.action.skip_redirect.label"}}

+
+
+ {{input type='checkbox' checked=action.skip_redirect}} + {{i18n 'admin.wizard.action.skip_redirect.description' type='message'}} +
+
+
{{wizard-custom-inputs inputs=action.add_fields diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 5d06c32d..0542b95a 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -102,6 +102,9 @@ en: add_fields: "{{type}} Fields" available_fields: "* If 'Save wizard submissions' is disabled, only the fields of the current step are available to the current step's actions." topic_attr: "Topic Attribute" + skip_redirect: + label: "Skip Redirect" + description: "Don't redirect the user to this {{type}} after the wizard completes" send_message: label: "Send Message" recipient: "Recipient" diff --git a/lib/builder.rb b/lib/builder.rb index ca49e433..4006b8cb 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -325,7 +325,9 @@ class CustomWizard::Builder post.topic.save_custom_fields(true) end - data['redirect_to'] = post.topic.url + unless action['skip_redirect'] + data['redirect_to'] = post.topic.url + end end end end @@ -352,7 +354,9 @@ class CustomWizard::Builder if creator.errors.present? updater.errors.add(:send_message, creator.errors.full_messages.join(" ")) else - data['redirect_to'] = post.topic.url + unless action['skip_redirect'] + data['redirect_to'] = post.topic.url + end end end end