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:
Ursprung
2844a75f30
Commit
857a159d0c
4 geänderte Dateien mit 27 neuen und 5 gelöschten Zeilen
|
@ -157,7 +157,8 @@ const action = {
|
|||
'required',
|
||||
'recipient',
|
||||
'profile_updates',
|
||||
'group'
|
||||
'group',
|
||||
'url'
|
||||
],
|
||||
advanced: [
|
||||
'code',
|
||||
|
|
|
@ -267,7 +267,18 @@
|
|||
</div>
|
||||
|
||||
<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>
|
||||
{{/if}}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Laden …
In neuem Issue referenzieren