FIX: sloppy topic draft handling
Will open in categories page and category drill down
This commit is contained in:
parent
ef5b18779e
commit
1958b0205e
|
@ -73,6 +73,7 @@ Discourse.CategoryList.reopenClass({
|
||||||
can_create_category: result.category_list.can_create_category,
|
can_create_category: result.category_list.can_create_category,
|
||||||
can_create_topic: result.category_list.can_create_topic,
|
can_create_topic: result.category_list.can_create_topic,
|
||||||
draft_key: result.category_list.draft_key,
|
draft_key: result.category_list.draft_key,
|
||||||
|
draft: result.category_list.draft,
|
||||||
draft_sequence: result.category_list.draft_sequence
|
draft_sequence: result.category_list.draft_sequence
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -85,6 +85,8 @@ export default function(filter, params) {
|
||||||
|
|
||||||
this.controllerFor('search').set('searchContext', model.get('searchContext'));
|
this.controllerFor('search').set('searchContext', model.get('searchContext'));
|
||||||
this.set('topics', null);
|
this.set('topics', null);
|
||||||
|
|
||||||
|
this.openTopicDraft(topics);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
|
|
|
@ -59,18 +59,7 @@ export default function(filter) {
|
||||||
selected: []
|
selected: []
|
||||||
});
|
});
|
||||||
|
|
||||||
// If there's a draft, open the create topic composer
|
this.openTopicDraft(model);
|
||||||
if (model.draft) {
|
|
||||||
var composer = this.controllerFor('composer');
|
|
||||||
if (!composer.get('model.viewOpen')) {
|
|
||||||
composer.open({
|
|
||||||
action: Discourse.Composer.CREATE_TOPIC,
|
|
||||||
draft: model.draft,
|
|
||||||
draftKey: model.draft_key,
|
|
||||||
draftSequence: model.draft_sequence
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
|
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,6 +19,21 @@ Discourse.Route = Em.Route.extend({
|
||||||
activate: function() {
|
activate: function() {
|
||||||
this._super();
|
this._super();
|
||||||
Em.run.scheduleOnce('afterRender', Discourse.Route, 'cleanDOM');
|
Em.run.scheduleOnce('afterRender', Discourse.Route, 'cleanDOM');
|
||||||
|
},
|
||||||
|
|
||||||
|
openTopicDraft: function(model){
|
||||||
|
// If there's a draft, open the create topic composer
|
||||||
|
if (model.draft) {
|
||||||
|
var composer = this.controllerFor('composer');
|
||||||
|
if (!composer.get('model.viewOpen')) {
|
||||||
|
composer.open({
|
||||||
|
action: Discourse.Composer.CREATE_TOPIC,
|
||||||
|
draft: model.draft,
|
||||||
|
draftKey: model.draft_key,
|
||||||
|
draftSequence: model.draft_sequence
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,9 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos
|
||||||
// Only show either the Create Category or Create Topic button
|
// Only show either the Create Category or Create Topic button
|
||||||
this.controllerFor('navigation/categories').set('canCreateCategory', model.get('can_create_category'));
|
this.controllerFor('navigation/categories').set('canCreateCategory', model.get('can_create_category'));
|
||||||
this.controllerFor('navigation/categories').set('canCreateTopic', model.get('can_create_topic') && !model.get('can_create_category'));
|
this.controllerFor('navigation/categories').set('canCreateTopic', model.get('can_create_topic') && !model.get('can_create_category'));
|
||||||
|
|
||||||
|
this.openTopicDraft(model);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -21,15 +21,7 @@ Discourse.DiscoveryTopRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
||||||
this.controllerFor('discovery/top').setProperties({ model: model, category: null });
|
this.controllerFor('discovery/top').setProperties({ model: model, category: null });
|
||||||
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
|
this.controllerFor('navigation/default').set('canCreateTopic', model.get('can_create_topic'));
|
||||||
|
|
||||||
// If there's a draft, open the create topic composer
|
this.openTopicDraft(model);
|
||||||
if (model.draft) {
|
|
||||||
this.controllerFor('composer').open({
|
|
||||||
action: Discourse.Composer.CREATE_TOPIC,
|
|
||||||
draft: model.draft,
|
|
||||||
draftKey: model.draft_key,
|
|
||||||
draftSequence: model.draft_sequence
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
|
|
Loading…
Reference in New Issue