From 0a86dd84e91271c2e9526123179c673aa92f7d69 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Wed, 3 Aug 2022 10:51:02 -0500 Subject: [PATCH 1/2] Move clearing of search suggestions --- .../node/frontend/public/js/app/manuscript-detail/DivaView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js b/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js index 0bc67dca..1bad14bc 100644 --- a/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js +++ b/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js @@ -188,7 +188,6 @@ export default Marionette.ItemView.extend({ showPageSuggestions: function showPageSuggestions(event){ var inputSuggestions = this.toolbarParentObject.find(this.divaInstance.getInstanceSelector() + 'input-suggestions'); - inputSuggestions.empty(); var manuscript = manuscriptChannel.request('manuscript'); var pageInput = this.toolbarParentObject.find(this.divaInstance.getInstanceSelector() + 'goto-page-input'); @@ -196,6 +195,7 @@ export default Marionette.ItemView.extend({ var queryUrl = '/folio-set/manuscript/' + manuscript + '/?q=' + pageInput.val(); $.get(queryUrl, function (data){ + inputSuggestions.empty(); for (const queryResult of data){ var newInputSuggestion = document.createElement('div'); newInputSuggestion.setAttribute('class','diva-input-suggestion'); From 34c5d1252683fde43874b09edeeb770ab980fbf9 Mon Sep 17 00:00:00 2001 From: Dylan Hillerbrand Date: Wed, 3 Aug 2022 12:05:51 -0500 Subject: [PATCH 2/2] Go to top suggestion on page nav input --- .../frontend/public/js/app/manuscript-detail/DivaView.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js b/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js index 1bad14bc..45a2c936 100644 --- a/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js +++ b/nginx/public/node/frontend/public/js/app/manuscript-detail/DivaView.js @@ -163,9 +163,10 @@ export default Marionette.ItemView.extend({ gotoInputPage: function (event) { event.preventDefault(); - - var pageInput = this.toolbarParentObject.find(this.divaInstance.getInstanceSelector() + 'goto-page-input'); - var pageAlias = pageInput.val(); + + var inputSuggestions = this.toolbarParentObject.find(this.divaInstance.getInstanceSelector() + 'input-suggestions'); + var pageInput = $('.diva-input-suggestion:first', inputSuggestions) + var pageAlias = pageInput.text(); if (!pageAlias) return;