From f710d39567d00420d82513d68fc1921d7f0941d4 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 17 Feb 2014 11:44:16 +0000 Subject: [PATCH] fix #1998 (Keep documents view find element from disappearing if width gets too small) --- static/js/documentsPanel.js | 18 ++++++++++++++++++ static/js/rightPanel.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index 0eda6995f..7ca2c117b 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -396,6 +396,12 @@ pandora.ui.documentsPanel = function(options) { pandora.$ui.documentsList = $list; } + // to determine the width of the find input inside + // the documents dialog, that dialog has to be present + setTimeout(function() { + $findInput.options({width: getFindInputWidth()}); + }); + that.bindEvent( 'pandora_documentsselection.' + (isItemView ? ui.item.toLowerCase() : ''), selectDocuments @@ -453,6 +459,17 @@ pandora.ui.documentsPanel = function(options) { return Ox._(ui.documentsSort[0].operator == '+' ? 'Ascending' : 'Descending'); } + function getFindInputWidth() { + // 2 * 128px selects + 2 * 16px buttons + 4 * 4px margins = 304px + return Math.min(192, ( + isItemView + ? window.innerWidth - (ui.showSidebar * ui.sidebarSize) - 1 + - (ui.showDocument * ui.documentSize) + : pandora.$ui.documentsDialog.options('width') + - ui.documentSize - 1 + ) - 304); + } + function getPreviewSize() { var ratio = $list.value($list.options('selected')[0], 'ratio'), size = ui.documentSize - 16 - Ox.UI.SCROLLBAR_SIZE, @@ -895,6 +912,7 @@ pandora.ui.documentsPanel = function(options) { }; that.updateSize = function() { + $findInput.options({width: getFindInputWidth()}); $list.size(); }; diff --git a/static/js/rightPanel.js b/static/js/rightPanel.js index 67b6a59ab..60ffc9068 100644 --- a/static/js/rightPanel.js +++ b/static/js/rightPanel.js @@ -42,7 +42,7 @@ pandora.ui.rightPanel = function() { } else { pandora.$ui.browser.scrollToSelection(); if (pandora.user.ui.itemView == 'documents') { - pandora.$ui.documentsList.size(); + pandora.$ui.documents.updateSize(); } else if (pandora.user.ui.itemView == 'clips') { pandora.$ui.clipList.size(); } else if (pandora.user.ui.itemView == 'timeline') {