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

Unified Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2666033002: [MD Bookmarks] Add edit folder. (Closed)
Patch Set: Sort string resource. Created 3 years, 11 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
Index: chrome/browser/resources/md_bookmarks/list.js
diff --git a/chrome/browser/resources/md_bookmarks/list.js b/chrome/browser/resources/md_bookmarks/list.js
index 018b9c6d6114c0a618318ee5477fce73d9a6634b..e8a9497688f2c9825fc1c449426973edd2864fdc 100644
--- a/chrome/browser/resources/md_bookmarks/list.js
+++ b/chrome/browser/resources/md_bookmarks/list.js
@@ -13,6 +13,8 @@ Polymer({
displayedList: Array,
searchTerm: String,
+
+ hideUrlInput_: Boolean,
calamity 2017/02/02 04:40:53 Can we get rid of this property? Or at least chang
angelayang 2017/02/02 05:33:52 Done.
},
listeners: {
@@ -27,15 +29,14 @@ Polymer({
this.menuItem_ = e.detail.item;
var menu = /** @type {!CrActionMenuElement} */ (
this.$.dropdown);
+ this.hideUrlInput_ = !this.menuItem_.url;
menu.showAt(/** @type {!Element} */ (e.detail.target));
},
- // TODO(jiaxi): change these dummy click event handlers later.
/** @private */
onEditTap_: function() {
this.closeDropdownMenu_();
- if (this.menuItem_.url)
- this.$.editBookmark.showModal();
+ this.$.editBookmark.showModal();
},
/** @private */
@@ -63,10 +64,11 @@ Polymer({
/** @private */
onSaveEditTap_: function() {
- chrome.bookmarks.update(this.menuItem_.id, {
- 'title': this.menuItem_.title,
- 'url': this.menuItem_.url,
- });
+ var edit = {'title': this.menuItem_.title};
+ if (this.menuItem_.url)
+ edit['url'] = this.menuItem_.url;
+
+ chrome.bookmarks.update(this.menuItem_.id, edit);
this.$.editBookmark.close();
},
@@ -83,6 +85,18 @@ Polymer({
},
/** @private */
+ getEditActionLabel_: function() {
+ var label = this.menuItem_.url ? 'menuEdit' : 'menuRename';
+ return loadTimeData.getString(label);
+ },
+
+ /** @private */
+ getEditorTitle_: function() {
+ var title = this.menuItem_.url ? 'editBookmarkTitle' : 'renameFolderTitle';
+ return loadTimeData.getString(title);
+ },
+
+ /** @private */
emptyListMessage_: function() {
var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList';
return loadTimeData.getString(emptyListMessage);
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.html ('k') | chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698