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

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

Issue 2666033002: [MD Bookmarks] Add edit folder. (Closed)
Patch Set: Add menu for folder items. 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..26e987a80fc186321209a047d018dd615b0ee625 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,
},
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,16 @@ Polymer({
/** @private */
onSaveEditTap_: function() {
tsergeant 2017/02/01 23:46:48 You can do this with a single call to chrome.bookm
angelayang 2017/02/02 00:57:07 perfect thanks
- chrome.bookmarks.update(this.menuItem_.id, {
- 'title': this.menuItem_.title,
- 'url': this.menuItem_.url,
- });
+ if (this.menuItem_.url) {
+ chrome.bookmarks.update(this.menuItem_.id, {
+ 'title': this.menuItem_.title,
+ 'url': this.menuItem_.url,
+ });
+ } else {
+ chrome.bookmarks.update(this.menuItem_.id, {
+ 'title': this.menuItem_.title,
+ });
+ }
this.$.editBookmark.close();
},
@@ -83,6 +90,18 @@ Polymer({
},
/** @private */
+ getMenuActionLabel_: function() {
tsergeant 2017/02/01 23:46:48 Should have 'edit' in the function name since it's
angelayang 2017/02/02 00:57:07 Done.
+ 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