[DE] Refactoring document info: apply button is always visible

This commit is contained in:
Julia Radzhabova 2020-08-06 21:08:07 +03:00
parent 382fb528e6
commit 230f9d4d88
2 changed files with 54 additions and 8 deletions

View file

@ -846,7 +846,8 @@ define([
this.rendered = false; this.rendered = false;
this.template = _.template([ this.template = _.template([
'<table class="main">', '<div id="fms-flex-info">',
'<table class="main" style="margin: 30px 0 0;">',
'<tr>', '<tr>',
'<td class="left"><label>' + this.txtPlacement + '</label></td>', '<td class="left"><label>' + this.txtPlacement + '</label></td>',
'<td class="right"><label id="id-info-placement">-</label></td>', '<td class="right"><label id="id-info-placement">-</label></td>',
@ -929,12 +930,17 @@ define([
'</table>', '</table>',
'</div></td>', '</div></td>',
'</tr>', '</tr>',
'<tr class="divider"></tr>', '<tr style="height: 5px;"></tr>',
'</table>',
'</div>',
'<div>',
'<table class="main" style="margin: 10px 0;">',
'<tr>', '<tr>',
'<td class="left"></td>', '<td class="left"></td>',
'<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>', '<td class="right"><button id="fminfo-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',
'</tr>', '</tr>',
'</table>' '</table>',
'</div>'
].join('')); ].join(''));
this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0}; this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0};
@ -1011,6 +1017,7 @@ define([
idx = me.tblAuthor.find('tr').index(el); idx = me.tblAuthor.find('tr').index(el);
el.remove(); el.remove();
me.authors.splice(idx, 1); me.authors.splice(idx, 1);
me.updateScroller(true);
} }
}); });
@ -1032,6 +1039,7 @@ define([
if (!isFromApply) { if (!isFromApply) {
var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str))); var div = $(Common.Utils.String.format(me.authorTpl, Common.Utils.String.htmlEncode(str)));
me.trAuthor.before(div); me.trAuthor.before(div);
me.updateScroller();
} }
} }
}); });
@ -1044,6 +1052,8 @@ define([
}); });
this.btnApply.on('click', _.bind(this.applySettings, this)); this.btnApply.on('click', _.bind(this.applySettings, this));
this.pnlInfo = $markup.findById('#fms-flex-info');
this.rendered = true; this.rendered = true;
this.updateInfo(this.doc); this.updateInfo(this.doc);
@ -1051,11 +1061,18 @@ define([
this.$el = $(node).html($markup); this.$el = $(node).html($markup);
if (_.isUndefined(this.scroller)) { if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: this.$el, el: this.pnlInfo,
suppressScrollX: true, suppressScrollX: true,
alwaysVisibleY: true alwaysVisibleY: true
}); });
} }
Common.NotificationCenter.on({
'window:resize': function() {
me.isVisible() && me.updateScroller();
}
});
return this; return this;
}, },
@ -1064,7 +1081,8 @@ define([
this.updateStatisticInfo(); this.updateStatisticInfo();
this.updateFileInfo(); this.updateFileInfo();
this.scroller && this.scroller.update(); this.updateScroller();
this.scroller && this.scroller.scrollTop(0);
}, },
hide: function() { hide: function() {
@ -1073,6 +1091,16 @@ define([
this.stopUpdatingStatisticInfo(); this.stopUpdatingStatisticInfo();
}, },
updateScroller: function(destroy) {
if (this.scroller) {
this.scroller.update(destroy ? {
suppressScrollX: true,
alwaysVisibleY: true
} : undefined);
this.pnlInfo.toggleClass('bordered', this.scroller.isVisible());
}
},
updateInfo: function(doc) { updateInfo: function(doc) {
if (!this.doc && doc && doc.info) { if (!this.doc && doc && doc.info) {
doc.info.author && console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."); doc.info.author && console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead.");
@ -1322,7 +1350,7 @@ define([
this.rendered = false; this.rendered = false;
this.template = _.template([ this.template = _.template([
'<table class="main">', '<table class="main" style="margin: 30px 0;">',
'<tr class="rights">', '<tr class="rights">',
'<td class="left" style="vertical-align: top;"><label>' + this.txtRights + '</label></td>', '<td class="left" style="vertical-align: top;"><label>' + this.txtRights + '</label></td>',
'<td class="right"><div id="id-info-rights"></div></td>', '<td class="right"><div id="id-info-rights"></div></td>',

View file

@ -315,12 +315,31 @@
} }
} }
#panel-info, #panel-info {
#file-menu-panel & {
padding: 0;
display: flex;
flex-direction: column;
}
#fms-flex-info {
&.bordered {
border-bottom: 1px solid @gray;
}
overflow: hidden;
position: relative;
}
}
#panel-rights { #panel-rights {
#file-menu-panel & { #file-menu-panel & {
padding: 0 30px; padding: 0 30px;
} }
}
#panel-info,
#panel-rights {
table { table {
tr { tr {
td { td {
@ -349,7 +368,6 @@
&.main { &.main {
width: 100%; width: 100%;
margin: 30px 0;
} }
} }