Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Merge branch 'master' of https://github.com/merefield/discourse-custom-wizard into reset_wizard
Dieser Commit ist enthalten in:
Commit
2e1926fc8a
8 geänderte Dateien mit 44 neuen und 19 gelöschten Zeilen
|
@ -56,6 +56,16 @@ export default Ember.Component.extend({
|
|||
builderWizardFields(fields) {
|
||||
return fields.map((f) => ` w{${f.id}}`);
|
||||
},
|
||||
|
||||
@computed('availableFields')
|
||||
categoryFields(fields) {
|
||||
return fields.filter(f => f.type == 'category');
|
||||
},
|
||||
|
||||
@computed('availableFields')
|
||||
tagFields(fields) {
|
||||
return fields.filter(f => f.type == 'tag');
|
||||
},
|
||||
|
||||
@computed()
|
||||
builderUserFields() {
|
||||
|
|
|
@ -63,7 +63,8 @@ export default Ember.Component.extend({
|
|||
let stepFields = s.fields.map((f) => {
|
||||
return Ember.Object.create({
|
||||
id: f.id,
|
||||
label: `${f.id} (${s.id})`
|
||||
label: `${f.id} (${s.id})`,
|
||||
type: f.type
|
||||
});
|
||||
});
|
||||
fields.push(...stepFields);
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<span>{{i18n 'admin.wizard.action.custom_category.wizard_field'}}</span>
|
||||
{{#if action.custom_category_wizard_field}}
|
||||
{{combo-box value=action.category_id
|
||||
content=availableFields
|
||||
content=categoryFields
|
||||
nameProperty="label"
|
||||
none='admin.wizard.select_field'}}
|
||||
{{/if}}
|
||||
|
@ -114,7 +114,19 @@
|
|||
{{tag-chooser tags=action.tags
|
||||
filterable=true
|
||||
allowCreate=true
|
||||
isDisabled=action.custom_category_enabled}}
|
||||
isDisabled=action.custom_tag_enabled}}
|
||||
<div class="setting-gutter">
|
||||
{{input type='checkbox' checked=action.custom_tag_enabled}}
|
||||
<span>{{i18n 'admin.wizard.action.custom_tag.label'}}</span>
|
||||
{{#if action.custom_tag_enabled}}
|
||||
<div class="custom-tag">
|
||||
{{combo-box value=action.custom_tag_field
|
||||
content=tagFields
|
||||
nameProperty="label"
|
||||
none='admin.wizard.select_field'}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -264,7 +276,3 @@
|
|||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if openComposer}}
|
||||
|
||||
{{/if}}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
(function() {
|
||||
window.location.href = "/login";
|
||||
})();
|
||||
(function () {
|
||||
document.cookie = 'destination_url=' + window.location.href + ';path=/';
|
||||
window.location.href = '/login'
|
||||
})()
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
//= require discourse/lib/page-visible
|
||||
//= require discourse/lib/logout
|
||||
//= require discourse/lib/render-tag
|
||||
//= require discourse/lib/notification-levels
|
||||
|
||||
//= require markdown-it-bundle
|
||||
//= require pretty-text/engines/discourse-markdown-it
|
||||
|
|
|
@ -160,6 +160,8 @@ en:
|
|||
label: "Custom Category"
|
||||
wizard_field: "Wizard Field"
|
||||
user_field: "User Field"
|
||||
custom_tag:
|
||||
label: "Custom Tag"
|
||||
send_to_api:
|
||||
label: "Send to API"
|
||||
api: "API"
|
||||
|
|
|
@ -4,12 +4,6 @@ class CustomWizard::WizardController < ::ApplicationController
|
|||
|
||||
helper_method :wizard_page_title
|
||||
helper_method :theme_ids
|
||||
|
||||
before_action :handle_login_redirect, unless: :current_user
|
||||
|
||||
def handle_login_redirect
|
||||
cookies[:destination_url] = "/w/#{params[:wizard_id]}"
|
||||
end
|
||||
|
||||
def wizard
|
||||
CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore))
|
||||
|
|
|
@ -560,8 +560,8 @@ class CustomWizard::Builder
|
|||
end
|
||||
end
|
||||
|
||||
if action['tags'].present?
|
||||
url += "&tags=#{action['tags'].join(',')}"
|
||||
if tags = action_tags(action, data)
|
||||
url += "&tags=#{tags.join(',')}"
|
||||
end
|
||||
|
||||
data['redirect_on_complete'] = Discourse.base_uri + URI.encode(url)
|
||||
|
@ -605,7 +605,7 @@ class CustomWizard::Builder
|
|||
def action_category_id(action, data)
|
||||
if action['custom_category_enabled']
|
||||
if action['custom_category_wizard_field']
|
||||
category_id = data[action['category_id']]
|
||||
data[action['category_id']]
|
||||
elsif action['custom_category_user_field_key']
|
||||
if action['custom_category_user_field_key'].include?('custom_fields')
|
||||
field = action['custom_category_user_field_key'].split('.').last
|
||||
|
@ -618,4 +618,12 @@ class CustomWizard::Builder
|
|||
action['category_id']
|
||||
end
|
||||
end
|
||||
|
||||
def action_tags(action, data)
|
||||
if action['custom_tag_enabled']
|
||||
data[action['custom_tag_field']]
|
||||
else
|
||||
action['tags']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren