1
0
Fork 0
Dieser Commit ist enthalten in:
Robert Barrow 2019-11-04 18:10:20 +00:00
Commit 2e1926fc8a
8 geänderte Dateien mit 44 neuen und 19 gelöschten Zeilen

Datei anzeigen

@ -57,6 +57,16 @@ export default Ember.Component.extend({
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() {
const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');

Datei anzeigen

@ -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);

Datei anzeigen

@ -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}}

Datei anzeigen

@ -1,3 +1,4 @@
(function() {
window.location.href = "/login";
})();
(function () {
document.cookie = 'destination_url=' + window.location.href + ';path=/';
window.location.href = '/login'
})()

Datei anzeigen

@ -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

Datei anzeigen

@ -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"

Datei anzeigen

@ -5,12 +5,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))
end

Datei anzeigen

@ -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