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

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 8720006: Moving file selection checkbox to the field name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index fc6e6e65522e1981c22fbc6cbc912caba7b8dd79..fff7b26fd555f18a8647cac94fdeea60673a726b 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -1156,10 +1156,8 @@ FileManager.prototype = {
columns[3].renderFunction = this.renderDate_.bind(this);
if (this.showCheckboxes_) {
- columns.unshift(new cr.ui.table.TableColumn('checkbox_', '', 3.6));
- columns[0].renderFunction = this.renderCheckbox_.bind(this);
columns[0].headerRenderFunction =
- this.renderCheckboxColumnHeader_.bind(this);
+ this.renderNameColumnHeader_.bind(this, columns[0].name);
}
this.table_ = this.dialogDom_.querySelector('.detail-table');
@@ -1545,7 +1543,7 @@ FileManager.prototype = {
return input;
};
- FileManager.prototype.renderCheckboxColumnHeader_ = function(table) {
+ FileManager.prototype.renderNameColumnHeader_ = function(name, table) {
var input = this.document_.createElement('input');
input.setAttribute('type', 'checkbox');
input.setAttribute('tabindex', -1);
@@ -1559,9 +1557,13 @@ FileManager.prototype = {
else
table.selectionModel.selectAll();
event.preventDefault();
+ event.stopPropagation();
});
- return input;
+ var fragment = this.document_.createDocumentFragment();
+ fragment.appendChild(input);
+ fragment.appendChild(this.document_.createTextNode(name));
+ return fragment;
};
/**
@@ -1569,7 +1571,7 @@ FileManager.prototype = {
* @return {boolean} True if all items are selected.
*/
FileManager.prototype.areAllItemsSelected = function() {
- return this.selection &&
+ return this.selection && this.dataModel_.length > 0 &&
this.dataModel_.length == this.selection.totalCount;
};
@@ -1668,16 +1670,11 @@ FileManager.prototype = {
* @param {cr.ui.Table} table The table doing the rendering.
*/
FileManager.prototype.renderIconType_ = function(entry, columnId, table) {
- var div = this.document_.createElement('div');
- div.className = 'detail-icon-container';
-
var icon = this.document_.createElement('div');
icon.className = 'detail-icon';
this.getIconType(entry);
icon.setAttribute('iconType', entry.cachedIconType_);
- div.appendChild(icon);
-
- return div;
+ return icon;
};
FileManager.prototype.getLabelForRootPath_ = function(path) {
@@ -1705,9 +1702,11 @@ FileManager.prototype = {
*/
FileManager.prototype.renderName_ = function(entry, columnId, table) {
var label = this.document_.createElement('div');
+ if (this.showCheckboxes_)
+ label.appendChild(this.renderCheckbox_(entry));
label.appendChild(this.renderIconType_(entry, columnId, table));
label.entry = entry;
- label.className = 'detail-name filename-label';
+ label.className = 'detail-name';
if (this.currentDirEntry_.name == '') {
label.appendChild(this.document_.createTextNode(
this.getLabelForRootPath_(entry.name)));
@@ -1727,7 +1726,6 @@ FileManager.prototype = {
*/
FileManager.prototype.renderSize_ = function(entry, columnId, table) {
var div = this.document_.createElement('div');
- div.className = 'detail-size';
div.textContent = '...';
cacheEntrySize(entry, function(entry) {
@@ -1750,7 +1748,6 @@ FileManager.prototype = {
*/
FileManager.prototype.renderType_ = function(entry, columnId, table) {
var div = this.document_.createElement('div');
- div.className = 'detail-type';
this.cacheEntryFileType(entry, function(entry) {
var info = entry.cachedFileType_;
@@ -1775,7 +1772,6 @@ FileManager.prototype = {
*/
FileManager.prototype.renderDate_ = function(entry, columnId, table) {
var div = this.document_.createElement('div');
- div.className = 'detail-date';
div.textContent = '...';

Powered by Google App Engine
This is Rietveld 408576698