From d3511f1f82d2c18738933cc8981129bdd4bb2c2e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 20 May 2017 05:28:19 +0300 Subject: [PATCH] bugfix... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 2 ++ ui (gen4)/features/marks.js | 10 ++++++++-- ui (gen4)/features/ui-widgets.js | 4 ++++ ui (gen4)/lib/widget/browse.js | 9 ++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index d8ee47a7..b145db84 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -1559,6 +1559,8 @@ module.CropActions = actions.Actions({ // XXX not sure if we actually need this... cropFlatten: ['Crop/Flatten', + {browseMode: function(){ + return this.data.ribbon_order.length <= 1 && 'disabled' }}, function(list){ this.data.length > 0 && this.crop(list, true) }], cropRibbon: ['Crop/Crop ribbon', function(ribbon, flatten){ diff --git a/ui (gen4)/features/marks.js b/ui (gen4)/features/marks.js index 803e0d9b..7b8383c2 100755 --- a/ui (gen4)/features/marks.js +++ b/ui (gen4)/features/marks.js @@ -213,7 +213,8 @@ var ImageMarkActions = actions.Actions({ || !('selected' in this.data.tags)){ return [] } - return this.data.tags['selected'].slice() + //return this.data.tags['selected'].slice() + return this.data.getImages(this.data.tags['selected']) }, markedInRibbon: ['- Mark|Ribbon/', @@ -232,6 +233,8 @@ var ImageMarkActions = actions.Actions({ function(mode){ this.nextTagged('selected', mode) }], cropMarked: ['Mark|Crop/Crop $marked images', + {browseMode: function(target){ + return this.marked.length == 0 && 'disabled' }}, function(flatten){ this.cropTagged('selected', 'any', flatten) }], }) @@ -402,7 +405,8 @@ var ImageBookmarkActions = actions.Actions({ || !('bookmark' in this.data.tags)){ return [] } - return this.data.tags['bookmark'].slice() + //return this.data.tags['bookmark'].slice() + return this.data.getImages(this.data.tags['bookmark']) }, prevBookmarked: ['Bookmark|Navigate/Previous bookmarked image', @@ -411,6 +415,8 @@ var ImageBookmarkActions = actions.Actions({ function(mode){ this.nextTagged('bookmark', mode) }], cropBookmarked: ['Bookmark|Crop/Crop $bookmarked images', + {browseMode: function(target){ + return this.bookmarked.length == 0 && 'disabled' }}, function(flatten){ this.cropTagged('bookmark', 'any', flatten) }], }) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index c27a34c8..e50fef41 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1548,6 +1548,10 @@ var WidgetTestActions = actions.Actions({ return function(){ console.log('<<<', [].slice.call(arguments)) }}], + testActionDisabled: ['Test/$Disabled test action', + {browseMode: function(){ return 'disabled' }}, + function(){}], + // Usage Examples: // .testDrawer() - show html in base drawer... // .testDrawer('Header', 'paragraph') - show html with custom text... diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index b6a318da..09ff8c93 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -2982,6 +2982,7 @@ var BrowserPrototype = { // NOTE: 'none' will always return an empty jQuery object, to get // the selection state before deselecting use .select('!') // NOTE: this uses .filter(..) for string and regexp matching... + // NOTE: this will not select disabled elements (XXX) select: function(elem, filtering){ var browser = this.dom var pattern = '.list .item' @@ -3037,6 +3038,11 @@ var BrowserPrototype = { browser.find('.path .dir.cur').text(elem.find('.text').text()) } + // XXX not sure if this is correct... + if(elem.hasClass('disabled')){ + return $() + } + // handle scroll position... var p = elem.scrollParent() var S = p.scrollTop() @@ -3455,7 +3461,8 @@ var BrowserPrototype = { // if text is empty, skip action... if(txt != ''){ - path.push(elem.find('.text').text()) + //path.push(elem.find('.text').text()) + path.push(txt) var res = this.open(path) }