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

Unified Diff: chrome/browser/resources/ntp4/bookmarks_page.js

Issue 7838019: [ntp4] Include a helper link for importing bookmarks if the user doesn't have any. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code review improvements. Created 9 years, 3 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
« no previous file with comments | « chrome/browser/resources/ntp4/bookmarks_page.css ('k') | chrome/browser/resources/ntp4/new_tab.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/bookmarks_page.js
===================================================================
--- chrome/browser/resources/ntp4/bookmarks_page.js (revision 99893)
+++ chrome/browser/resources/ntp4/bookmarks_page.js (working copy)
@@ -300,6 +300,9 @@
} else {
wrapper.hidden = true;
}
+
+ if (this.id === ROOT_NODE_ID && !tile_count)
+ this.showImportPromo_();
},
/**
@@ -368,6 +371,8 @@
bookmarkNodeAdded: function(id, bookmark, fromCurrentPage) {
if (this.importing) return;
if (this.currentlyInFolder_(bookmark.parentId)) {
+ // Hide the import promo if it exists.
+ this.hideImportPromo_();
// If source of the add came from this page, show an animated insertion,
// otherwise just quietly do it.
this.addTileAt(new Bookmark(bookmark), bookmark.index, fromCurrentPage);
@@ -543,6 +548,28 @@
},
/**
+ * Show the 'Import bookmarks' promo
Evan Stade 2011/09/07 19:16:18 .
csilv 2011/09/07 19:29:59 Done.
+ * @private
+ */
+ showImportPromo_: function() {
+ var importTemplate = $('bookmarks-import-data-link-template');
+ var importWrapper = importTemplate.cloneNode(true);
+ importWrapper.id = '';
+ importWrapper.hidden = false;
+ this.querySelector('.tile-page-content').appendChild(importWrapper);
+ },
+
+ /**
+ * Hide the 'Import bookmarks' promo
Evan Stade 2011/09/07 19:16:18 .
csilv 2011/09/07 19:29:59 Done.
+ * @private
+ */
+ hideImportPromo_: function() {
+ var wrapper = this.querySelector('.bookmarks-import-data-link-wrapper');
+ if (wrapper)
+ wrapper.parentNode.removeChild(wrapper);
+ },
+
+ /**
* Create a bookmark from a title/url.
* @param {!string} parentId Stringified int64 of the parent node's ID.
* @param {number} index Sibling relative index, i.e. 3rd on this level.
« no previous file with comments | « chrome/browser/resources/ntp4/bookmarks_page.css ('k') | chrome/browser/resources/ntp4/new_tab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698