0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Add conditionality to route_to url

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-29 11:47:08 +10:00
Ursprung 2844a75f30
Commit 857a159d0c
4 geänderte Dateien mit 27 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -157,7 +157,8 @@ const action = {
'required', 'required',
'recipient', 'recipient',
'profile_updates', 'profile_updates',
'group' 'group',
'url'
], ],
advanced: [ advanced: [
'code', 'code',

Datei anzeigen

@ -267,7 +267,18 @@
</div> </div>
<div class="setting-value"> <div class="setting-value">
{{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'
)}}
</div> </div>
</div> </div>
{{/if}} {{/if}}

Datei anzeigen

@ -113,7 +113,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
:type, :type,
:code, :code,
:skip_redirect, :skip_redirect,
:url,
:post, :post,
:post_builder, :post_builder,
:post_template, :post_template,
@ -124,7 +123,8 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
required: mapped_params, required: mapped_params,
recipient: mapped_params, recipient: mapped_params,
profile_updates: mapped_params, profile_updates: mapped_params,
group: mapped_params group: mapped_params,
url: mapped_params
] ]
) )
end end

Datei anzeigen

@ -221,7 +221,17 @@ class CustomWizard::Action
end end
def route_to 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'] if action['code']
data[action['code']] = SecureRandom.hex(8) data[action['code']] = SecureRandom.hex(8)