diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index 1699c3f5..bd99ba7b 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -157,7 +157,8 @@ const action = { 'required', 'recipient', 'profile_updates', - 'group' + 'group', + 'url' ], advanced: [ 'code', diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs index 6de6a500..c27e56cd 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs @@ -267,7 +267,18 @@
- {{input value=action.url}} + {{wizard-mapper + inputs=action.url + property='url' + onUpdate=(action 'mappedFieldUpdated') + options=(hash + context='action' + wizardFieldSelection=true + userFieldSelection='key,value' + groupSelection='key,value' + categorySelection='key,value' + userSelection='key,value' + )}}
{{/if}} diff --git a/controllers/custom_wizard/admin/wizard.rb b/controllers/custom_wizard/admin/wizard.rb index 1802ca15..d7f87f9a 100644 --- a/controllers/custom_wizard/admin/wizard.rb +++ b/controllers/custom_wizard/admin/wizard.rb @@ -113,7 +113,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController :type, :code, :skip_redirect, - :url, :post, :post_builder, :post_template, @@ -124,7 +123,8 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController required: mapped_params, recipient: mapped_params, profile_updates: mapped_params, - group: mapped_params + group: mapped_params, + url: mapped_params ] ) end diff --git a/lib/custom_wizard/action.rb b/lib/custom_wizard/action.rb index 556b91bf..cd85ec21 100644 --- a/lib/custom_wizard/action.rb +++ b/lib/custom_wizard/action.rb @@ -221,7 +221,17 @@ class CustomWizard::Action end def route_to - url = mapper.interpolate(action['url']) + return unless (url_input = action['url']).present? + + if url_input.is_a?(String) + url = mapper.interpolate(url_input) + else + url = CustomWizard::Mapper.new( + inputs: url_input, + data: data, + user: user + ).perform + end if action['code'] data[action['code']] = SecureRandom.hex(8)