Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 18:50:27 +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',
|
'required',
|
||||||
'recipient',
|
'recipient',
|
||||||
'profile_updates',
|
'profile_updates',
|
||||||
'group'
|
'group',
|
||||||
|
'url'
|
||||||
],
|
],
|
||||||
advanced: [
|
advanced: [
|
||||||
'code',
|
'code',
|
||||||
|
|
|
@ -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}}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Laden …
In neuem Issue referenzieren