Chromium Code Reviews| 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); |