changed header layout for view mode

This commit is contained in:
Maxim Kadushkin 2017-07-13 12:43:40 +03:00
parent 2f54b983a2
commit 86c3493c1c
5 changed files with 51 additions and 5 deletions

View file

@ -72,6 +72,10 @@ define([
var templateRightBox = '<section>' + var templateRightBox = '<section>' +
'<label id="rib-doc-name" class="status-label"></label>' + '<label id="rib-doc-name" class="status-label"></label>' +
'<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' + '<a id="rib-save-status" class="status-label locked"><%= textSaveEnd %></a>' +
'<div class="hedset">' +
'<div class="btn-slot" id="slot-hbtn-print"></div>' +
'<div class="btn-slot" id="slot-hbtn-download"></div>' +
'</div>' +
'<div class="hedset">' + '<div class="hedset">' +
// '<span class="btn-slot text" id="slot-btn-users"></span>' + // '<span class="btn-slot text" id="slot-btn-users"></span>' +
'<section id="tlb-box-users" class="box-cousers dropdown"">' + '<section id="tlb-box-users" class="box-cousers dropdown"">' +
@ -170,7 +174,6 @@ define([
$btnUsers.find('.caption') $btnUsers.find('.caption')
.css({'font-size': (count > 1 ? '12px' : '14px'), .css({'font-size': (count > 1 ? '12px' : '14px'),
'font-weight': (count > 1 ? 'bold' : 'normal'),
'margin-top': (count > 1 ? '0' : '-1px')}) 'margin-top': (count > 1 ? '0' : '-1px')})
.html(count > 1 ? count : '&plus;'); .html(count > 1 ? count : '&plus;');
@ -249,6 +252,22 @@ define([
$saveStatus.addClass('locked'); $saveStatus.addClass('locked');
} }
} }
if ( !mode.isEdit ) {
if ( me.btnDownload ) {
me.btnDownload.updateHint('Download document');
me.btnDownload.on('click', function (e) {
me.fireEvent('downloadas', ['original']);
});
}
if ( me.btnPrint ) {
me.btnDownload.updateHint('Print');
me.btnPrint.on('click', function (e) {
me.fireEvent('print', me);
});
}
}
} }
return { return {
@ -293,7 +312,6 @@ define([
reset : onResetUsers reset : onResetUsers
}); });
Common.NotificationCenter.on('app:ready', function(mode) { Common.NotificationCenter.on('app:ready', function(mode) {
Common.Utils.asyncCall(onAppReady, me, mode); Common.Utils.asyncCall(onAppReady, me, mode);
}); });
@ -337,6 +355,28 @@ define([
} }
} }
if ( !config.isEdit ) {
if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline ) {
this.btnDownload = new Common.UI.Button({
id: 'btn-download',
cls: 'btn-header',
iconCls: 'svgicon svg-btn-download'
});
this.btnDownload.render($html.find('#slot-hbtn-download'));
}
if ( config.canPrint ) {
this.btnPrint = new Common.UI.Button({
id: 'btn-goback',
cls: 'btn-header',
iconCls: 'svgicon svg-btn-print'
});
this.btnPrint.render($html.find('#slot-hbtn-print'));
}
}
if ( this.documentCaption ) { if ( this.documentCaption ) {
$html.find('#rib-doc-name').text( $html.find('#rib-doc-name').text(
Common.Utils.String.htmlEncode(this.documentCaption) ); Common.Utils.String.htmlEncode(this.documentCaption) );

View file

@ -112,6 +112,12 @@ define([
'FileMenu': { 'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'), 'menu:hide': this.onFileMenu.bind(this, 'hide'),
'menu:show': this.onFileMenu.bind(this, 'show') 'menu:show': this.onFileMenu.bind(this, 'show')
},
'Common.Views.Header': {
'print': this.onPrint.bind(this),
'downloadas': function (opts) {
this.api.asc_DownloadOrigin();
}.bind(this)
} }
}); });

View file

@ -80,7 +80,7 @@ define([
Common.UI.Mixtbar.prototype.initialize.call(this, { Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template), template: _.template(template),
tabs: [ tabs: [
{ caption: me.textTabFile, action: 'file'}, { caption: me.textTabFile, action: 'file', extcls: 'canedit'},
{ caption: me.textTabHome, action: 'home', extcls: 'canedit'}, { caption: me.textTabHome, action: 'home', extcls: 'canedit'},
{ caption: me.textTabInsert, action: 'ins', extcls: 'canedit'}, { caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
{ caption: me.textTabLayout, action: 'layout', extcls: 'canedit'} { caption: me.textTabLayout, action: 'layout', extcls: 'canedit'}

View file

@ -138,7 +138,7 @@ define([
Common.UI.Mixtbar.prototype.initialize.call(this, { Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template), template: _.template(template),
tabs: [ tabs: [
{ caption: 'File', action: 'file'}, { caption: 'File', action: 'file', extcls: 'canedit'},
{ caption: 'Home', action: 'home', extcls: 'canedit'}, { caption: 'Home', action: 'home', extcls: 'canedit'},
{ caption: 'Insert', action: 'ins', extcls: 'canedit'} { caption: 'Insert', action: 'ins', extcls: 'canedit'}
]} ]}

View file

@ -318,7 +318,7 @@ define([
Common.UI.Mixtbar.prototype.initialize.call(this, { Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template), template: _.template(template),
tabs: [ tabs: [
{ caption: 'File'/*me.textTabFile*/, action: 'file'}, { caption: 'File'/*me.textTabFile*/, action: 'file', extcls: 'canedit'},
{ caption: 'Home'/*me.textTabHome*/, action: 'home', extcls: 'canedit'}, { caption: 'Home'/*me.textTabHome*/, action: 'home', extcls: 'canedit'},
{ caption: 'Insert'/*me.textTabInsert*/, action: 'ins', extcls: 'canedit'} { caption: 'Insert'/*me.textTabInsert*/, action: 'ins', extcls: 'canedit'}
]} ]}