forked from benmccann/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files.app: Add sort menu to the toolbar.
This CL adds sort button on the toolbar. By the sort button, following sorting options will be displayed: - Sort by Name (always in ascending order) - Sort by Size (always in descending order) - Sort by Type (always in ascending order) - Sort by Date mofidied (always in descending order) Clicking column headers has the same effect as the options above. BUG=438915 TEST=run browser_tests --gtest_filter=*FileManager* TBR=yoshiki@chromium.org Review URL: https://codereview.chromium.org/1136523005 Cr-Commit-Position: refs/heads/master@{#329052}
- Loading branch information
fukino
authored and
Commit bot
committed
May 9, 2015
1 parent
bd7bc2f
commit e82d248
Showing
17 changed files
with
216 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+523 Bytes
ui/file_manager/file_manager/foreground/images/files/ui/2x/sorting_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+335 Bytes
ui/file_manager/file_manager/foreground/images/files/ui/sorting_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ui/file_manager/file_manager/foreground/js/sort_menu_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/** | ||
* @param {!cr.ui.MenuButton} sortButton | ||
* @param {!FileListModel} fileListModel | ||
* @constructor | ||
* @struct | ||
*/ | ||
function SortMenuController(sortButton, fileListModel) { | ||
/** @private {!FileListModel} */ | ||
this.fileListModel_ = fileListModel; | ||
|
||
/** @private {!HTMLElement} */ | ||
this.sortByNameButton_ = queryRequiredElement( | ||
sortButton.menu, '#sort-menu-sort-by-name'); | ||
/** @private {!HTMLElement} */ | ||
this.sortBySizeButton_ = queryRequiredElement( | ||
sortButton.menu, '#sort-menu-sort-by-size'); | ||
/** @private {!HTMLElement} */ | ||
this.sortByTypeButton_ = queryRequiredElement( | ||
sortButton.menu, '#sort-menu-sort-by-type'); | ||
/** @private {!HTMLElement} */ | ||
this.sortByDateButton_ = queryRequiredElement( | ||
sortButton.menu, '#sort-menu-sort-by-date'); | ||
|
||
sortButton.addEventListener('menushow', this.updateCheckmark_.bind(this)); | ||
}; | ||
|
||
/** | ||
* Update checkmarks for each sort options. | ||
* @private | ||
*/ | ||
SortMenuController.prototype.updateCheckmark_ = function() { | ||
var sortField = this.fileListModel_.sortStatus.field; | ||
|
||
this.setCheckStatus_(this.sortByNameButton_, sortField === 'name'); | ||
this.setCheckStatus_(this.sortBySizeButton_, sortField === 'size'); | ||
this.setCheckStatus_(this.sortByTypeButton_, sortField === 'type'); | ||
this.setCheckStatus_(this.sortByDateButton_, | ||
sortField === 'modificationTime'); | ||
}; | ||
|
||
/** | ||
* Set attribute 'checked' for the menu item. | ||
* @param {!HTMLElement} menuItem | ||
* @param {boolean} checked True if the item should have 'checked' attribute. | ||
* @private | ||
*/ | ||
SortMenuController.prototype.setCheckStatus_ = function(menuItem, checked) { | ||
if (checked) | ||
menuItem.setAttribute('checked', ''); | ||
else | ||
menuItem.removeAttribute('checked'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.