[DE] Signature refactoring.

This commit is contained in:
Julia Radzhabova 2017-11-17 16:11:40 +03:00
parent 9e48dbd68d
commit 565e0bd750
2 changed files with 12 additions and 16 deletions

View file

@ -2849,7 +2849,7 @@ define([
if (config.isDesktopApp && config.isOffline) { if (config.isDesktopApp && config.isOffline) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect}; tab = {action: 'protect', caption: me.toolbar.textTabProtect};
var $panel = this.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ( $panel ) if ( $panel )
me.toolbar.addTab(tab, $panel, 4); me.toolbar.addTab(tab, $panel, 4);

View file

@ -62,8 +62,6 @@ define([
}, },
initialize: function () { initialize: function () {
var me = this;
this._state = { this._state = {
requestedSignatures: undefined, requestedSignatures: undefined,
validSignatures: undefined, validSignatures: undefined,
@ -92,7 +90,6 @@ define([
'<div id="<%= id %>" class="signature-item requested">', '<div id="<%= id %>" class="signature-item requested">',
'<div class="caret img-commonctrl"></div>', '<div class="caret img-commonctrl"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>', '<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'</div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -105,7 +102,6 @@ define([
'<div class="caret img-commonctrl"></div>', '<div class="caret img-commonctrl"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>', '<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>', '<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -118,7 +114,6 @@ define([
'<div class="caret img-commonctrl"></div>', '<div class="caret img-commonctrl"></div>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>', '<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>',
'<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>', '<div class="date"><%= Common.Utils.String.htmlEncode(date) %></div>',
'</div>',
'</div>' '</div>'
].join('')) ].join(''))
}); });
@ -178,12 +173,12 @@ define([
me._state.requestedSignatures.push({name: item.asc_getSigner1(), guid: item.asc_getGuid(), requested: true}); me._state.requestedSignatures.push({name: item.asc_getSigner1(), guid: item.asc_getGuid(), requested: true});
}); });
_.each(valid, function(item, index){ _.each(valid, function(item, index){
var sign = {name: item.asc_getSigner1(), guid: item.asc_getId(), date: '18/05/2017'}; var sign = {name: item.asc_getSigner1(), guid: item.asc_getId(), date: '18/05/2017', invisible: !item.asc_getVisible()};
(item.asc_getValid()==0) ? me._state.validSignatures.push(sign) : me._state.invalidSignatures.push(sign); (item.asc_getValid()==0) ? me._state.validSignatures.push(sign) : me._state.invalidSignatures.push(sign);
}); });
// me._state.requestedSignatures = [{name: 'Hammish Mitchell', guid: '123', requested: true}, {name: 'Someone Somewhere', guid: '123', requested: true}, {name: 'Mary White', guid: '123', requested: true}, {name: 'John Black', guid: '123', requested: true}]; // me._state.requestedSignatures = [{name: 'Hammish Mitchell', guid: '123', requested: true}, {name: 'Someone Somewhere', guid: '123', requested: true}, {name: 'Mary White', guid: '123', requested: true}, {name: 'John Black', guid: '123', requested: true}];
// me._state.validSignatures = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017'}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}]; // me._state.validSignatures = [{name: 'Hammish Mitchell', guid: '123', date: '18/05/2017', invisible: true}, {name: 'Someone Somewhere', guid: '345', date: '18/05/2017'}];
// me._state.invalidSignatures = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}]; // me._state.invalidSignatures = [{name: 'Mary White', guid: '111', date: '18/05/2017'}, {name: 'John Black', guid: '456', date: '18/05/2017'}];
this.viewRequestedList.store.reset(me._state.requestedSignatures); this.viewRequestedList.store.reset(me._state.requestedSignatures);
@ -240,6 +235,7 @@ define([
signed = (this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0); signed = (this._state.validSignatures.length>0 || this._state.invalidSignatures.length>0);
menu.items[0].setVisible(requested); menu.items[0].setVisible(requested);
menu.items[1].setVisible(!requested); menu.items[1].setVisible(!requested);
menu.items[2].setVisible(requested || !record.get('invisible'));
menu.items[3].setVisible(!requested); menu.items[3].setVisible(!requested);
menu.items[0].setDisabled(this._locked); menu.items[0].setDisabled(this._locked);
menu.items[3].setDisabled(this._locked); menu.items[3].setDisabled(this._locked);