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

Side by Side Diff: chrome/browser/resources/md_bookmarks/edit_dialog.js

Issue 2742583003: MD Bookmarks: Extract bookmark editing into a <bookmark-edit-dialog> element (Closed)
Patch Set: Rename event handlers Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 Polymer({
6 is: 'bookmarks-edit-dialog',
7
8 properties: {
9 /** @private {BookmarkNode} */
10 editItem_: Object,
11
12 /** @private */
13 isFolder_: Boolean,
14
15 /** @private */
16 titleValue_: String,
17
18 /** @private */
19 urlValue_: String,
20 },
21
22 /** @param {BookmarkNode} editItem */
23 showEditDialog: function(editItem) {
24 this.editItem_ = editItem;
25 this.isFolder_ = !editItem.url;
26
27 this.titleValue_ = editItem.title;
28 if (!this.isFolder_)
29 this.urlValue_ = assert(editItem.url);
30
31 this.$.dialog.showModal();
32 },
33
34 /**
35 * @param {boolean} isFolder
36 * @return {string}
37 * @private
38 */
39 getDialogTitle_: function(isFolder) {
40 return loadTimeData.getString(
41 isFolder ? 'renameFolderTitle' : 'editBookmarkTitle');
42 },
43
44 /** @private */
45 onSaveButtonTap_: function() {
46 // TODO(tsergeant): Save changes when enter is pressed.
47 // TODO(tsergeant): Verify values.
48 var edit = {'title': this.titleValue_};
49 if (!this.isFolder_)
50 edit['url'] = this.urlValue_;
51
52 chrome.bookmarks.update(this.editItem_.id, edit);
53 this.$.dialog.close();
54 },
55
56 /** @private */
57 onCancelButtonTap_: function() {
58 this.$.dialog.cancel();
59 },
60 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/edit_dialog.html ('k') | chrome/browser/resources/md_bookmarks/list.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698