Commit 379d61e7 authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Version history: add "Show/Hide detailed changes" to history panel. Don't...

[DE] Version history: add "Show/Hide detailed changes" to history panel. Don't reload editor, when press Back to Document (= Close Menu) in the File menu.
parent 9f3d70bb
...@@ -57,6 +57,14 @@ define([ ...@@ -57,6 +57,14 @@ define([
findRevisions: function(revision) { findRevisions: function(revision) {
return this.where({revision: revision}); return this.where({revision: revision});
},
hasChanges: function() {
return !!this.findWhere({isRevision: false});
},
hasCollapsed: function() {
return !!this.findWhere({isRevision: true, hasChanges: true, isExpanded: false});
} }
}); });
}); });
...@@ -66,6 +66,7 @@ define([ ...@@ -66,6 +66,7 @@ define([
this.panelHistory= this.createView('Common.Views.History', { this.panelHistory= this.createView('Common.Views.History', {
storeHistory: this.getApplication().getCollection('Common.Collections.HistoryVersions') storeHistory: this.getApplication().getCollection('Common.Collections.HistoryVersions')
}); });
this.panelHistory.storeHistory.on('reset', _.bind(this.onResetStore, this));
this.panelHistory.on('render:after', _.bind(this.onAfterRender, this)); this.panelHistory.on('render:after', _.bind(this.onAfterRender, this));
Common.Gateway.on('sethistorydata', _.bind(this.onSetHistoryData, this)); Common.Gateway.on('sethistorydata', _.bind(this.onSetHistoryData, this));
}, },
...@@ -86,6 +87,13 @@ define([ ...@@ -86,6 +87,13 @@ define([
onAfterRender: function(historyView) { onAfterRender: function(historyView) {
historyView.viewHistoryList.on('item:click', _.bind(this.onSelectRevision, this)); historyView.viewHistoryList.on('item:click', _.bind(this.onSelectRevision, this));
historyView.btnBackToDocument.on('click', _.bind(this.onClickBackToDocument, this)); historyView.btnBackToDocument.on('click', _.bind(this.onClickBackToDocument, this));
historyView.btnExpand.on('click', _.bind(this.onClickExpand, this));
},
onResetStore: function() {
var hasChanges = this.panelHistory.storeHistory.hasChanges();
this.panelHistory.$el.find('#history-expand-changes')[hasChanges ? 'show' : 'hide']();
this.panelHistory.$el.find('#history-list').css('padding-bottom', hasChanges ? '45px' : 0);
}, },
onDownloadUrl: function(url) { onDownloadUrl: function(url) {
...@@ -183,6 +191,20 @@ define([ ...@@ -183,6 +191,20 @@ define([
Common.Gateway.requestHistoryClose(); Common.Gateway.requestHistoryClose();
}, },
onClickExpand: function () {
var store = this.panelHistory.storeHistory,
needExpand = store.hasCollapsed();
store.where({isRevision: true, hasChanges: true, isExpanded: !needExpand}).forEach(function(item){
item.set('isExpanded', needExpand);
});
store.where({isRevision: false}).forEach(function(item){
item.set('isVisible', needExpand);
});
this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength: 40});
this.panelHistory.btnExpand.cmpEl.text(needExpand ? this.panelHistory.textHideAll : this.panelHistory.textShowAll);
},
notcriticalErrorTitle: 'Warning' notcriticalErrorTitle: 'Warning'
}, Common.Controllers.History || {})); }, Common.Controllers.History || {}));
......
...@@ -55,10 +55,13 @@ define([ ...@@ -55,10 +55,13 @@ define([
template: _.template([ template: _.template([
'<div id="history-box" class="layout-ct vbox">', '<div id="history-box" class="layout-ct vbox">',
'<div id="history-header" class="">', '<div id="history-header" class="">',
'<div id="history-btn-back"><%=scope.textHistoryHeader%></div>', '<div id="history-btn-back"><%=scope.textCloseHistory%></div>',
'</div>', '</div>',
'<div id="history-list" class="">', '<div id="history-list" class="">',
'</div>', '</div>',
'<div id="history-expand-changes" class="">',
'<div id="history-btn-expand"><%=scope.textHideAll%></div>',
'</div>',
'</div>' '</div>'
].join('')), ].join('')),
...@@ -110,6 +113,7 @@ define([ ...@@ -110,6 +113,7 @@ define([
this.scroller.update({minScrollbarLength: 40}); this.scroller.update({minScrollbarLength: 40});
} else } else
Common.UI.DataView.prototype.onClickItem.call(this, view, record, e); Common.UI.DataView.prototype.onClickItem.call(this, view, record, e);
me.btnExpand.cmpEl.text(me.storeHistory.hasCollapsed() ? me.textShowAll : me.textHideAll);
}; };
var changetooltip = function (dataview, view, record) { var changetooltip = function (dataview, view, record) {
...@@ -132,14 +136,22 @@ define([ ...@@ -132,14 +136,22 @@ define([
enableToggle: false enableToggle: false
}); });
this.btnExpand = new Common.UI.Button({
el: $('#history-btn-expand'),
enableToggle: false
});
this.trigger('render:after', this); this.trigger('render:after', this);
return this; return this;
}, },
textHistoryHeader: 'Back to Document', textHistoryHeader: 'Back to Document',
textRestore: 'Restore', textRestore: 'Restore',
textShow: 'Show Changes', textShow: 'Expand',
textHide: 'Hide Changes' textHide: 'Collapse',
textCloseHistory: 'Close History',
textHideAll: 'Hide detailed changes',
textShowAll: 'Show detailed changes'
}, Common.Views.History || {})) }, Common.Views.History || {}))
}); });
\ No newline at end of file
...@@ -26,10 +26,33 @@ ...@@ -26,10 +26,33 @@
} }
} }
#history-expand-changes {
position: absolute;
height: 45px;
left: 0;
bottom: 0;
right: 0;
overflow: hidden;
border-top: 1px solid @gray-dark;
#history-btn-expand {
height: 27px;
margin-top: 8px;
padding-top: 4px;
padding-left: 20px;
font-size: 13px;
cursor: pointer;
&:hover {
background-color: @secondary;
}
}
}
#history-list { #history-list {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
padding-top: 45px; padding: 45px 0;
.item { .item {
display: block; display: block;
......
...@@ -190,10 +190,6 @@ define([ ...@@ -190,10 +190,6 @@ define([
var close_menu = true; var close_menu = true;
switch (action) { switch (action) {
case 'back': case 'back':
if (this.mode.canUseHistory && this.leftMenu.panelHistory.isVisible()) {
// reload editor
Common.Gateway.requestHistoryClose();
}
break; break;
case 'save': this.api.asc_Save(); break; case 'save': this.api.asc_Save(); break;
case 'save-desktop': this.api.asc_DownloadAs(); break; case 'save-desktop': this.api.asc_DownloadAs(); break;
......
...@@ -143,8 +143,13 @@ ...@@ -143,8 +143,13 @@
"Common.Views.Header.textBack": "Go to Documents", "Common.Views.Header.textBack": "Go to Documents",
"Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE", "Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"Common.Views.Header.txtRename": "Rename", "Common.Views.Header.txtRename": "Rename",
"Common.Views.History.textHistoryHeader": "Back to Document", "Common.Views.History.textCloseHistory": "Close History",
"del_Common.Views.History.textHistoryHeader": "Back to Document",
"Common.Views.History.textRestore": "Restore", "Common.Views.History.textRestore": "Restore",
"Common.Views.History.textShow": "Expand",
"Common.Views.History.textHide": "Collapse",
"Common.Views.History.textHideAll": "Hide detailed changes",
"Common.Views.History.textShowAll": "Show detailed changes",
"Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel", "Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel",
"Common.Views.ImageFromUrlDialog.okButtonText": "OK", "Common.Views.ImageFromUrlDialog.okButtonText": "OK",
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:", "Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
...@@ -868,6 +873,7 @@ ...@@ -868,6 +873,7 @@
"DE.Views.DropcapSettingsAdvanced.tipFontName": "Font Name", "DE.Views.DropcapSettingsAdvanced.tipFontName": "Font Name",
"DE.Views.DropcapSettingsAdvanced.txtNoBorders": "No borders", "DE.Views.DropcapSettingsAdvanced.txtNoBorders": "No borders",
"DE.Views.FileMenu.btnBackCaption": "Go to Documents", "DE.Views.FileMenu.btnBackCaption": "Go to Documents",
"DE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
"DE.Views.FileMenu.btnCreateNewCaption": "Create New", "DE.Views.FileMenu.btnCreateNewCaption": "Create New",
"DE.Views.FileMenu.btnDownloadCaption": "Download as...", "DE.Views.FileMenu.btnDownloadCaption": "Download as...",
"DE.Views.FileMenu.btnHelpCaption": "Help...", "DE.Views.FileMenu.btnHelpCaption": "Help...",
......
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