mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
FEATURE: accept category_id as new-topic param to better support subcategory
This commit is contained in:
parent
8521ee24b1
commit
480cea7284
@ -439,11 +439,8 @@ export default DiscourseController.extend({
|
||||
this.set('model.title', opts.topicTitle);
|
||||
}
|
||||
|
||||
if (opts.topicCategory) {
|
||||
var category = Discourse.Category.list().findProperty('name', opts.topicCategory);
|
||||
if (category && category.id) {
|
||||
this.set('model.categoryId', category.id);
|
||||
}
|
||||
if (opts.topicCategoryId) {
|
||||
this.set('model.categoryId', opts.topicCategoryId);
|
||||
}
|
||||
|
||||
if (opts.topicBody) {
|
||||
|
@ -17,12 +17,12 @@ Discourse.OpenComposer = Em.Mixin.create({
|
||||
});
|
||||
},
|
||||
|
||||
openComposerWithParams: function(controller, title, body, category) {
|
||||
openComposerWithParams: function(controller, title, body, category_id) {
|
||||
this.controllerFor('composer').open({
|
||||
action: Discourse.Composer.CREATE_TOPIC,
|
||||
topicTitle: title,
|
||||
topicBody: body,
|
||||
topicCategory: category,
|
||||
topicCategoryId: category_id,
|
||||
draftKey: controller.get('draft_key'),
|
||||
draftSequence: controller.get('draft_sequence')
|
||||
});
|
||||
|
@ -148,8 +148,8 @@ const ApplicationRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
||||
this.render(w, {into: 'modal/topic-bulk-actions', outlet: 'bulkOutlet', controller: factory ? controllerName : 'topic-bulk-actions'});
|
||||
},
|
||||
|
||||
createNewTopicViaParams: function(title, body, category) {
|
||||
this.openComposerWithParams(this.controllerFor('discovery/topics'), title, body, category);
|
||||
createNewTopicViaParams: function(title, body, category_id) {
|
||||
this.openComposerWithParams(this.controllerFor('discovery/topics'), title, body, category_id);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -7,7 +7,7 @@ export default Discourse.Route.extend({
|
||||
if (self.controllerFor('navigation/default').get('canCreateTopic')) {
|
||||
// User can create topic
|
||||
Ember.run.next(function() {
|
||||
e.send('createNewTopicViaParams', transition.queryParams.title, transition.queryParams.body, transition.queryParams.category);
|
||||
e.send('createNewTopicViaParams', transition.queryParams.title, transition.queryParams.body, transition.queryParams.category_id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user