FEATURE: support adding tags when creating new topic via link

This commit is contained in:
Arpit Jalan 2016-06-04 01:54:35 +05:30
parent eccfa1317a
commit 1e289d1443
4 changed files with 9 additions and 4 deletions

View File

@ -532,6 +532,10 @@ export default Ember.Controller.extend({
}
}
if (opts.topicTags && !this.site.mobileView && this.site.get('can_tag_topics')) {
this.set('model.tags', opts.topicTags.split(","));
}
if (opts.topicBody) {
this.set('model.reply', opts.topicBody);
}

View File

@ -12,13 +12,14 @@ export default Ember.Mixin.create({
});
},
openComposerWithTopicParams(controller, topicTitle, topicBody, topicCategoryId, topicCategory) {
openComposerWithTopicParams(controller, topicTitle, topicBody, topicCategoryId, topicCategory, topicTags) {
this.controllerFor('composer').open({
action: Composer.CREATE_TOPIC,
topicTitle,
topicBody,
topicCategoryId,
topicCategory,
topicTags,
draftKey: controller.get('model.draft_key'),
draftSequence: controller.get('model.draft_sequence')
});

View File

@ -166,8 +166,8 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
this.render(w, {into: 'modal/topic-bulk-actions', outlet: 'bulkOutlet', controller: factory ? controllerName : 'topic-bulk-actions'});
},
createNewTopicViaParams(title, body, category_id, category) {
this.openComposerWithTopicParams(this.controllerFor('discovery/topics'), title, body, category_id, category);
createNewTopicViaParams(title, body, category_id, category, tags) {
this.openComposerWithTopicParams(this.controllerFor('discovery/topics'), title, body, category_id, category, tags);
},
createNewMessageViaParams(username, title, body) {

View File

@ -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_id, transition.queryParams.category);
e.send('createNewTopicViaParams', transition.queryParams.title, transition.queryParams.body, transition.queryParams.category_id, transition.queryParams.category, transition.queryParams.tags);
});
}
});