From 1d84b09cbba514c4aa5e94877e79fa3af0408acc Mon Sep 17 00:00:00 2001 From: Nick Poulden Date: Wed, 25 May 2011 11:36:53 -0700 Subject: [PATCH] History and Favorite bug fixes and styling --- template/app/History.js | 6 +++--- template/app/controller/Classes.js | 10 ++++++++-- template/app/view/tree/Favorites.js | 3 ++- template/app/view/tree/History.js | 3 ++- template/index_production.html | 1 + template/resources/sass/viewport.scss | 15 +++++++-------- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/template/app/History.js b/template/app/History.js index 295ed432..1ec07746 100644 --- a/template/app/History.js +++ b/template/app/History.js @@ -71,9 +71,9 @@ Ext.define("Docs.History", { if (cls) { // When class already in history remove it and add again. // This way the most recently visited items will always be at the top. - var oldIndex = this.store.find('cls', cls); - if (oldIndex) { - this.store.removeAt(oldIndex); + var oldItem = this.store.findRecord('cls', cls); + if (oldItem) { + this.store.remove(oldItem); } // Add new item at the beginning diff --git a/template/app/controller/Classes.js b/template/app/controller/Classes.js index bc92fa2a..523984f7 100644 --- a/template/app/controller/Classes.js +++ b/template/app/controller/Classes.js @@ -168,8 +168,14 @@ Ext.define('Docs.controller.Classes', { if (clsName) { if (e.getTarget(".fav")) { - Docs.Favorites.add(clsName); - Ext.get(e.getTarget(".fav")).addCls("show"); + var favEl = Ext.get(e.getTarget(".fav")); + if (favEl.hasCls('show')) { + Docs.Favorites.remove(clsName); + favEl.removeCls("show"); + } else { + Docs.Favorites.add(clsName); + favEl.addCls("show"); + } } else { this.loadClass(clsName); diff --git a/template/app/view/tree/Favorites.js b/template/app/view/tree/Favorites.js index e928ffdb..8a4c3efd 100644 --- a/template/app/view/tree/Favorites.js +++ b/template/app/view/tree/Favorites.js @@ -52,7 +52,8 @@ Ext.define('Docs.view.tree.Favorites', { var p = this.getEl().getXY(); this.hoverMenu.getEl().setStyle({ - left: "35px", + left: "20px", + width: "220px", top: (p[1]+23)+"px" }); }, diff --git a/template/app/view/tree/History.js b/template/app/view/tree/History.js index 2a15b9bb..7a8ed3b5 100644 --- a/template/app/view/tree/History.js +++ b/template/app/view/tree/History.js @@ -52,7 +52,8 @@ Ext.define('Docs.view.tree.History', { var p = this.getEl().getXY(); this.hoverMenu.getEl().setStyle({ - left: "35px", + left: "20px", + width: "220px", top: (p[1]+23)+"px" }); }, diff --git a/template/index_production.html b/template/index_production.html index f6390c05..7e2789f3 100644 --- a/template/index_production.html +++ b/template/index_production.html @@ -21,6 +21,7 @@ + diff --git a/template/resources/sass/viewport.scss b/template/resources/sass/viewport.scss index fbc5838d..96e86b75 100644 --- a/template/resources/sass/viewport.scss +++ b/template/resources/sass/viewport.scss @@ -328,7 +328,6 @@ a:hover { height: 15px; position: absolute; right: 3px; - z-index: 20; top: 0; &.show { background: url(../images/favorite.png) no-repeat -2px -1px; } } @@ -661,13 +660,13 @@ a:hover { display: block; .item { position: relative; - padding: 2px 30px 2px 0; } - a { - display: inline; - padding: 0; } - a.close { - position: absolute; - right: 0; } } + padding: 2px 0 2px 0; + a.close { + position: absolute; + width: auto; + padding: 3px 0 0 0; + right: 0; top: 0; } } +} #favoritesBtn,#historyBtn { padding-left: 22px; -- GitLab