From 685c3073f16b3cd06fd7dbc10195a5c7568a7361 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 28 Mar 2018 15:50:41 +0300 Subject: [PATCH] [DE] Add hidden bookmarks --- .../main/app/view/BookmarksDialog.js | 93 +++++++++++++------ 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 1f9ce9b0f..1b8def99e 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -51,7 +51,7 @@ define([ DE.Views.BookmarksDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 300, - height: 340 + height: 360 }, initialize : function(options) { @@ -88,11 +88,16 @@ define([ '', '', '', - '', + '', '', '', '', '', + '', + '', + '
', + '', + '', '', '', '', @@ -120,9 +125,9 @@ define([ validateOnChange: true, validateOnBlur: false, style : 'width: 195px;', - value : '' - }).on ('changing', function (input, value) { - }); + value : '', + maxLength: 40 + }).on('changing', _.bind(this.onNameChanging, this)); this.radioName = new Common.UI.RadioBox({ el: $('#bookmarks-radio-name'), @@ -141,14 +146,15 @@ define([ this.bookmarksList = new Common.UI.ListView({ el: $('#bookmarks-list', this.$window), - store: new Common.UI.DataViewStore() + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
<%= value %>
') }); this.bookmarksList.store.comparator = function(rec) { return (me.radioName.getValue() ? rec.get("value") : rec.get("location")); }; - // this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickFunction, this)); - // this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); - // this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); + this.bookmarksList.on('item:dblclick', _.bind(this.onDblClickBookmark, this)); + this.bookmarksList.on('entervalue', _.bind(this.onPrimary, this)); + this.bookmarksList.on('item:select', _.bind(this.onSelectBookmark, this)); this.btnAdd = new Common.UI.Button({ el: $('#bookmarks-btn-add') @@ -165,6 +171,12 @@ define([ }); this.btnDelete.on('click', _.bind(this.deleteBookmark, this)); + this.chHidden = new Common.UI.CheckBox({ + el: $('#bookmarks-checkbox-hidden'), + labelText: this.textHidden + }); + this.chHidden.on('change', _.bind(this.onChangeHidden, this)); + this.afterRender(); }, @@ -177,21 +189,8 @@ define([ }, _setDefaults: function (props) { - if (props) { - var store = this.bookmarksList.store, - count = props.asc_GetCount(), - arr = []; - for (var i=0; i0) { @@ -218,6 +244,10 @@ define([ } }, + onDblClickBookmark: function(listView, itemView, record) { + this.props.asc_GoToBookmark(record.get('value')); + }, + deleteBookmark: function(btn, eOpts){ var rec = this.bookmarksList.getSelectedRec(); if (rec.length>0) { @@ -235,6 +265,16 @@ define([ } }, + onChangeHidden: function(field, newValue, oldValue, eOpts){ + this.refreshBookmarks(); + }, + + onNameChanging: function (input, value) { + this.bookmarksList.deselectAll(); + // this.btnGoto.setDisabled(true); + // this.btnDelete.setDisabled(true); + }, + textTitle: 'Bookmarks', textLocation: 'Location', textBookmarkName: 'Bookmark name', @@ -243,7 +283,8 @@ define([ textAdd: 'Add', textGoto: 'Go to', textDelete: 'Delete', - textClose: 'Close' + textClose: 'Close', + textHidden: 'Hidden bookmarks' }, DE.Views.BookmarksDialog || {})) }); \ No newline at end of file