Commit 7d1e47a4 authored by Julia Radzhabova's avatar Julia Radzhabova

[Mobile] Using app mode options for hiding items in the Settings menu (download, edit).

parent d8a334a3
......@@ -92,7 +92,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
// When our application is ready, lets get started
......
......@@ -230,11 +230,11 @@ define([
setMode: function(mode){
var me = this;
Common.SharedSettings.set('mode', mode);
Common.SharedSettings.set('mode', mode.isEdit ? 'edit' : 'view');
if (me.api) {
me.api.asc_enableKeyEvents(mode == 'edit');
me.api.asc_setViewMode(mode != 'edit');
me.api.asc_enableKeyEvents(mode.isEdit);
me.api.asc_setViewMode(!mode.isEdit);
}
},
......@@ -639,7 +639,7 @@ define([
_.each(me.getApplication().controllers, function(controller) {
if (controller && _.isFunction(controller.setMode)) {
controller.setMode(me.editorConfig.mode);
controller.setMode(me.appOptions);
}
});
......
......@@ -84,7 +84,7 @@ define([
},
setMode: function (mode) {
_isEdit = (mode === 'edit');
_isEdit = mode.isEdit;
this.render();
},
......
......@@ -50,7 +50,9 @@ define([
DE.Views.Settings = Backbone.View.extend(_.extend((function() {
// private
var _isEdit = false;
var _isEdit = false,
_canEdit = false,
_canDownload = false;
return {
// el: '.view-main',
......@@ -86,7 +88,9 @@ define([
},
setMode: function (mode) {
_isEdit = (mode === 'edit')
_isEdit = mode.isEdit;
_canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
_canDownload = mode.canDownload || mode.canDownloadOrigin;
},
rootLayout: function () {
......@@ -99,10 +103,12 @@ define([
$layour.find('#settings-readermode').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!_canEdit) $layour.find('#settings-edit-document').hide();
$layour.find('#settings-document').hide();
$layour.find('#settings-readermode input:checkbox')
.prop('checked', Common.SharedSettings.get('readerMode'));
}
if (!_canDownload) $layour.find('#settings-download').hide();
return $layour.html();
}
......
......@@ -97,9 +97,7 @@ define([
},
setMode: function (mode) {
var isEdit = (mode === 'edit');
if (isEdit) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
}
},
......
......@@ -84,7 +84,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
// When our application is ready, lets get started
......
......@@ -226,11 +226,11 @@ define([
setMode: function(mode){
var me = this;
Common.SharedSettings.set('mode', mode);
Common.SharedSettings.set('mode', mode.isEdit ? 'edit' : 'view');
if (me.api) {
me.api.asc_enableKeyEvents(mode == 'edit');
me.api.asc_setViewMode(mode != 'edit');
me.api.asc_enableKeyEvents(mode.isEdit);
me.api.asc_setViewMode(!mode.isEdit);
}
},
......@@ -594,7 +594,7 @@ define([
_.each(me.getApplication().controllers, function(controller) {
if (controller && _.isFunction(controller.setMode)) {
controller.setMode(me.editorConfig.mode);
controller.setMode(me.appOptions);
}
});
......
......@@ -84,7 +84,7 @@ define([
},
setMode: function (mode) {
_isEdit = (mode === 'edit');
_isEdit = mode.isEdit;
this.render();
},
......
......@@ -50,7 +50,9 @@ define([
PE.Views.Settings = Backbone.View.extend(_.extend((function() {
// private
var isEdit;
var isEdit,
canEdit = false,
canDownload = false;
return {
// el: '.view-main',
......@@ -91,7 +93,9 @@ define([
},
setMode: function (mode) {
isEdit = (mode === 'edit')
isEdit = mode.isEdit;
canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
canDownload = mode.canDownload || mode.canDownloadOrigin;
},
rootLayout: function () {
......@@ -104,11 +108,13 @@ define([
$layour.find('#settings-readermode').hide();
$layour.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!canEdit) $layour.find('#settings-edit-presentation').hide();
$layour.find('#settings-presentation-setup').hide();
$layour.find('#settings-readermode input:checkbox')
.attr('checked', Common.SharedSettings.get('readerMode'))
.prop('checked', Common.SharedSettings.get('readerMode'));
}
if (!canDownload) $layour.find('#settings-download').hide();
return $layour.html();
}
......
......@@ -98,9 +98,7 @@ define([
},
setMode: function (mode) {
var isEdit = (mode === 'edit');
if (isEdit) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
}
},
......
......@@ -177,7 +177,7 @@ define([
},
onInsertFunction: function() {
if (this.mode == 'edit') {
if (this.mode.isEdit) {
SSE.getController('AddContainer').showModal({
panel: 'function',
button: '#ce-function'
......
......@@ -85,7 +85,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
// When our application is ready, lets get started
......
......@@ -228,11 +228,11 @@ define([
setMode: function(mode){
var me = this;
Common.SharedSettings.set('mode', mode);
Common.SharedSettings.set('mode', mode.isEdit ? 'edit' : 'view');
if ( me.api ) {
me.api.asc_enableKeyEvents(mode == 'edit');
me.api.asc_setViewMode(mode != 'edit');
me.api.asc_enableKeyEvents(mode.isEdit);
me.api.asc_setViewMode(!mode.isEdit);
}
},
......@@ -614,7 +614,7 @@ define([
_.each(me.getApplication().controllers, function(controller) {
if (controller && _.isFunction(controller.setMode)) {
controller.setMode(me.editorConfig.mode);
controller.setMode(me.appOptions);
}
});
......
......@@ -112,7 +112,7 @@ define([
setMode: function(mode) {
this.statusbar.setMode(mode);
this.isEdit = mode == 'edit';
this.isEdit = mode.isEdit;
},
/*
......
......@@ -107,7 +107,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
onLaunch: function () {
......
......@@ -117,7 +117,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
onLaunch: function () {
......
......@@ -81,7 +81,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
onPageShow: function (view, pageId) {
......
......@@ -110,7 +110,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
onPageShow: function (view, pageId) {
......
......@@ -85,7 +85,7 @@ define([
},
setMode: function (mode) {
_isEdit = ('edit' === mode);
_isEdit = mode.isEdit;
},
onPageShow: function (view, pageId) {
......
......@@ -84,7 +84,7 @@ define([
},
setMode: function (mode) {
_isEdit = (mode === 'edit');
_isEdit = mode.isEdit;
this.render();
},
......
......@@ -49,7 +49,9 @@ define([
SSE.Views.Settings = Backbone.View.extend(_.extend((function() {
// private
var isEdit;
var isEdit,
canEdit = false,
canDownload = false;
return {
// el: '.view-main',
......@@ -96,7 +98,9 @@ define([
},
setMode: function (mode) {
isEdit = (mode === 'edit')
isEdit = mode.isEdit;
canEdit = !mode.isEdit && mode.canEdit && mode.canRequestEditRights;
canDownload = mode.canDownload || mode.canDownloadOrigin;
},
rootLayout: function () {
......@@ -108,7 +112,9 @@ define([
$layout.find('#settings-edit-document').hide();
$layout.find('#settings-search .item-title').text(this.textFindAndReplace)
} else {
if (!canEdit) $layout.find('#settings-edit-document').hide();
}
if (!canDownload) $layout.find('#settings-download').hide();
return $layout.html();
}
......
......@@ -205,11 +205,10 @@ define([
},
setMode: function(mode) {
if ('edit' == mode) {
this.$btnAddTab.show();
} else
if ('disconnect' == mode) {
this.$btnAddTab.toggleClass('disabled', true);
} else if (mode.isEdit) {
this.$btnAddTab.show();
}
},
......
......@@ -90,9 +90,7 @@ define([
},
setMode: function (mode) {
var isEdit = (mode === 'edit');
if (isEdit) {
if (mode.isEdit) {
$('#toolbar-edit, #toolbar-add, #toolbar-undo, #toolbar-redo').show();
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment