Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Add automatic integration
Dieser Commit ist enthalten in:
Ursprung
b2714b524c
Commit
bfd4e30d36
8 geänderte Dateien mit 41 neuen und 7 gelöschten Zeilen
|
@ -163,7 +163,8 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
mentionable_level: mapped_params,
|
mentionable_level: mapped_params,
|
||||||
messageable_level: mapped_params,
|
messageable_level: mapped_params,
|
||||||
visibility_level: mapped_params,
|
visibility_level: mapped_params,
|
||||||
members_visibility_level: mapped_params
|
members_visibility_level: mapped_params,
|
||||||
|
add_event: mapped_params
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,4 +101,9 @@ export default Component.extend(UndoChanges, {
|
||||||
}
|
}
|
||||||
return apis.find((a) => a.name === api).endpoints;
|
return apis.find((a) => a.name === api).endpoints;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@discourseComputed("fieldTypes")
|
||||||
|
hasEventsField(fieldTypes) {
|
||||||
|
return fieldTypes.map((ft) => ft.id).includes("event");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,6 +102,7 @@ const action = {
|
||||||
custom_fields: null,
|
custom_fields: null,
|
||||||
skip_redirect: null,
|
skip_redirect: null,
|
||||||
suppress_notifications: null,
|
suppress_notifications: null,
|
||||||
|
add_event: null,
|
||||||
},
|
},
|
||||||
send_message: {
|
send_message: {
|
||||||
title: null,
|
title: null,
|
||||||
|
@ -198,6 +199,7 @@ const action = {
|
||||||
"messageable_level",
|
"messageable_level",
|
||||||
"visibility_level",
|
"visibility_level",
|
||||||
"members_visibility_level",
|
"members_visibility_level",
|
||||||
|
"add_event",
|
||||||
],
|
],
|
||||||
advanced: [
|
advanced: [
|
||||||
"code",
|
"code",
|
||||||
|
|
|
@ -192,7 +192,8 @@
|
||||||
wizard=wizard
|
wizard=wizard
|
||||||
apis=apis
|
apis=apis
|
||||||
removeAction="removeAction"
|
removeAction="removeAction"
|
||||||
wizardFields=wizardFields}}
|
wizardFields=wizardFields
|
||||||
|
fieldTypes=fieldTypes}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<div class="admin-wizard-buttons">
|
<div class="admin-wizard-buttons">
|
||||||
|
|
|
@ -158,6 +158,25 @@
|
||||||
)}}
|
)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if hasEventsField}}
|
||||||
|
<div class="setting full">
|
||||||
|
<div class="setting-label">
|
||||||
|
<label>{{i18n "admin.wizard.action.create_topic.add_event"}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="setting-value">
|
||||||
|
{{wizard-mapper
|
||||||
|
inputs=action.add_event
|
||||||
|
property="add_event"
|
||||||
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
|
options=(hash
|
||||||
|
wizardFieldSelection=true
|
||||||
|
context="action"
|
||||||
|
)}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if sendMessage}}
|
{{#if sendMessage}}
|
||||||
|
|
|
@ -293,6 +293,7 @@ en:
|
||||||
date: Date
|
date: Date
|
||||||
time: Time
|
time: Time
|
||||||
date_time: Date & Time
|
date_time: Date & Time
|
||||||
|
event: Event (Events Plugin)
|
||||||
|
|
||||||
connector:
|
connector:
|
||||||
and: "and"
|
and: "and"
|
||||||
|
@ -336,6 +337,7 @@ en:
|
||||||
category: "Category"
|
category: "Category"
|
||||||
tags: "Tags"
|
tags: "Tags"
|
||||||
visible: "Visible"
|
visible: "Visible"
|
||||||
|
add_event: "Add Event (Events Plugin)"
|
||||||
open_composer:
|
open_composer:
|
||||||
label: "Open Composer"
|
label: "Open Composer"
|
||||||
update_profile:
|
update_profile:
|
||||||
|
|
|
@ -46,6 +46,10 @@ class CustomWizard::Action
|
||||||
def create_topic
|
def create_topic
|
||||||
params = basic_topic_params.merge(public_topic_params)
|
params = basic_topic_params.merge(public_topic_params)
|
||||||
|
|
||||||
|
CustomWizard::Field.action_callbacks.each do |acb|
|
||||||
|
params = acb.call(params, @wizard, @action, @submission)
|
||||||
|
end
|
||||||
|
|
||||||
if params[:title].present? && params[:raw].present?
|
if params[:title].present? && params[:raw].present?
|
||||||
creator = PostCreator.new(user, params)
|
creator = PostCreator.new(user, params)
|
||||||
post = creator.create
|
post = creator.create
|
||||||
|
|
|
@ -131,18 +131,18 @@ class CustomWizard::Field
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.require_assets
|
def self.action_callbacks
|
||||||
@require_assets ||= {}
|
@acbs ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.register(type, plugin = nil, asset_paths = [], opts = {})
|
def self.register(type, plugin = nil, opts = {})
|
||||||
if type
|
if type
|
||||||
types[type.to_sym] ||= {}
|
types[type.to_sym] ||= {}
|
||||||
types[type.to_sym] = opts[:type_opts] if opts[:type_opts].present?
|
types[type.to_sym] = opts[:type_opts] if opts[:type_opts].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
if plugin && asset_paths
|
if opts[:action_callback].present? && opts[:action_callback].is_a?(Proc)
|
||||||
require_assets[plugin] = asset_paths
|
action_callbacks << opts[:action_callback]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren