Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 638383002: Disable edit and print button when there is no selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved the disable/enable logic. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/slide_mode.js
diff --git a/ui/file_manager/gallery/js/slide_mode.js b/ui/file_manager/gallery/js/slide_mode.js
index 9de3d88111427ca2304ffe328d0bc8497e32b7f6..1f0edc237b6980498cd225bd703009f17389c376 100644
--- a/ui/file_manager/gallery/js/slide_mode.js
+++ b/ui/file_manager/gallery/js/slide_mode.js
@@ -197,12 +197,12 @@ SlideMode.prototype.initDom_ = function() {
this.editButton_ = this.toolbar_.querySelector('button.edit');
this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT');
- this.editButton_.setAttribute('disabled', ''); // Disabled by default.
+ this.editButton_.disabled = true; // Disabled by default.
this.editButton_.addEventListener('click', this.toggleEditor.bind(this));
this.printButton_ = this.toolbar_.querySelector('button.print');
this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT');
- this.printButton_.setAttribute('disabled', ''); // Disabled by default.
+ this.printButton_.disabled = true; // Disabled by default.
this.printButton_.addEventListener('click', this.print_.bind(this));
this.editBarSpacer_ = this.toolbar_.querySelector('.edit-bar-spacer');
@@ -354,8 +354,8 @@ SlideMode.prototype.leave = function(zoomToRect, callback) {
}
// Disable the slide-mode only buttons when leaving.
- this.editButton_.setAttribute('disabled', '');
- this.printButton_.setAttribute('disabled', '');
+ this.editButton_.disabled = true;
+ this.printButton_.disabled = true;
// Disable touch operation.
this.touchHandlers_.enabled = false;
@@ -435,7 +435,7 @@ SlideMode.prototype.toggleFullScreen_ = function() {
*/
SlideMode.prototype.onSelection_ = function() {
if (this.selectionModel_.selectedIndexes.length === 0)
- return; // Temporary empty selection.
+ return; // Ignore temporary empty selection.
// Forget the saved selection if the user changed the selection manually.
if (!this.isSlideshowOn_())
@@ -581,9 +581,12 @@ SlideMode.prototype.onSplice_ = function(event) {
// Removed item is the rightmost, but there are more items.
this.select(event.index - 1); // Select the new last index.
} else {
- // No items left. Unload the image and show the banner.
+ // No items left. Unload the image, disable edit and print button, and
+ // show the banner.
this.commitItem_(function() {
this.unloadImage_();
+ this.printButton_.disabled = true;
+ this.editButton_.disabled = true;
this.errorBanner_.show('GALLERY_NO_IMAGES');
}.bind(this));
}
@@ -717,11 +720,11 @@ SlideMode.prototype.loadItem_ = function(
// Enable or disable buttons for editing and printing.
if (error) {
- this.editButton_.setAttribute('disabled', '');
- this.printButton_.setAttribute('disabled', '');
+ this.editButton_.disabled = true;
+ this.printButton_.disabled = true;
} else {
- this.editButton_.removeAttribute('disabled');
- this.printButton_.removeAttribute('disabled');
+ this.editButton_.disabled = false;
+ this.printButton_.disabled = false;
}
// For once edited image, disallow the 'overwrite' setting change.
@@ -856,12 +859,12 @@ SlideMode.prototype.onKeyDown = function(event) {
switch (keyID) {
case 'Ctrl-U+0050': // Ctrl+'p' prints the current image.
- if (!this.printButton_.hasAttribute('disabled'))
+ if (!this.printButton_.disabled)
this.print_();
break;
case 'U+0045': // 'e' toggles the editor.
- if (!this.editButton_.hasAttribute('disabled'))
+ if (!this.editButton_.disabled)
this.toggleEditor(event);
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698