mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
Never show preview pane in composer on mobile.
This commit is contained in:
parent
a215fc5bdc
commit
71571b9316
2 changed files with 18 additions and 2 deletions
|
@ -257,7 +257,7 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super();
|
this._super();
|
||||||
var val = Discourse.KeyValueStore.get('composer.showPreview') || 'true';
|
var val = (Discourse.Mobile.mobileView ? false : (Discourse.KeyValueStore.get('composer.showPreview') || 'true'));
|
||||||
this.set('showPreview', val === 'true');
|
this.set('showPreview', val === 'true');
|
||||||
this.set('archetypeId', Discourse.Site.currentProp('default_archetype'));
|
this.set('archetypeId', Discourse.Site.currentProp('default_archetype'));
|
||||||
},
|
},
|
||||||
|
|
|
@ -187,4 +187,20 @@ test('initial category when uncategorized is not allowed', function() {
|
||||||
Discourse.SiteSettings.allow_uncategorized_topics = false;
|
Discourse.SiteSettings.allow_uncategorized_topics = false;
|
||||||
var composer = Discourse.Composer.open({action: 'createTopic', draftKey: 'asfd', draftSequence: 1});
|
var composer = Discourse.Composer.open({action: 'createTopic', draftKey: 'asfd', draftSequence: 1});
|
||||||
ok(composer.get('categoryId') === undefined, "Uncategorized by default. Must choose a category.");
|
ok(composer.get('categoryId') === undefined, "Uncategorized by default. Must choose a category.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('showPreview', function() {
|
||||||
|
var new_composer = function() {
|
||||||
|
return Discourse.Composer.open({action: 'createTopic', draftKey: 'asfd', draftSequence: 1});
|
||||||
|
};
|
||||||
|
|
||||||
|
Discourse.Mobile.mobileView = true;
|
||||||
|
equal(new_composer().get('showPreview'), false, "Don't show preview in mobile view");
|
||||||
|
|
||||||
|
Discourse.KeyValueStore.set({ key: 'composer.showPreview', value: 'true' });
|
||||||
|
equal(new_composer().get('showPreview'), false, "Don't show preview in mobile view even if KeyValueStore wants to");
|
||||||
|
Discourse.KeyValueStore.remove('composer.showPreview');
|
||||||
|
|
||||||
|
Discourse.Mobile.mobileView = false;
|
||||||
|
equal(new_composer().get('showPreview'), true, "Show preview by default in desktop view");
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue