Loading template/app/Application.js +0 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ Ext.define('Docs.Application', { name: 'Docs', requires: [ 'Docs.Favorites', 'Docs.History', 'Docs.Settings' ], Loading @@ -26,7 +25,6 @@ Ext.define('Docs.Application', { 'Search', 'InlineExamples', 'Examples', 'Favorites', 'Guides', 'Videos', 'Tabs' Loading @@ -34,7 +32,6 @@ Ext.define('Docs.Application', { launch: function() { Docs.App = this; Docs.Favorites.init(); Docs.Settings.init(); Docs.contentState = {}; Loading template/app/Favorites.jsdeleted 100644 → 0 +0 −99 Original line number Diff line number Diff line /** * Favorites management. */ Ext.define("Docs.Favorites", { extend: 'Docs.LocalStore', storeName: 'Favorites', singleton: true, mixins: { observable: 'Ext.util.Observable' }, constructor: function() { this.callParent(arguments); this.addEvents( /** * Fired when favorite added. * @param {String} url The URL of the favorited page */ "add", /** * Fired when favorite removed. * @param {String} url The URL of the favorited page */ "remove" ); }, init: function() { this.callParent(arguments); // For backwards compatibility with old Favorites Model // convert the old-style records to new schema. if (this.store.first() && !this.store.first().get("url")) { this.store.each(function(r) { r.set("title", r.data.cls); r.set("url", "/api/"+r.get("cls")); r.set("cls", ""); }); this.syncStore(); } }, /** * Adds page to favorites * * @param {String} url the page to add * @param {String} title title for Favorites entry */ add: function(url, title) { if (!this.has(url)) { this.store.add({url: url, title: title}); this.syncStore(); this.fireEvent("add", url); } }, /** * Removes page from favorites. * * @param {String} url the page URL to remove */ remove: function(url) { if (this.has(url)) { this.store.removeAt(this.store.findExact('url', url)); this.syncStore(); this.fireEvent("remove", url); } }, /** * Checks if page exists in favorites * * @param {String} url the URL to check * @return {Boolean} true when present */ has: function(url) { return this.store.findExact('url', url) > -1; }, /** * Returns the number of favorites. * @return {Number} */ getCount: function() { return this.store.getCount(); }, /** * Save order of favorites in store. * * This needs to be called explicitly, because of a bug in * localStorage which prevents the order of items being saved when * they're changed. */ saveOrder: function() { this.store.getProxy().setIds(Ext.Array.map(this.store.data.items, function(i) { return i.data.id; })); } }); template/app/LocalStore.js +1 −1 Original line number Diff line number Diff line /** * Provides methods dealing with localStorage- and memory-store. * * Base class for Favorites and Settings. * Base class for Settings. */ Ext.define("Docs.LocalStore", { storeName: '', Loading template/app/controller/Classes.js +0 −7 Original line number Diff line number Diff line Loading @@ -10,12 +10,10 @@ Ext.define('Docs.controller.Classes', { ], stores: [ 'Favorites', 'Settings' ], models: [ 'Favorite', 'Setting' ], Loading Loading @@ -78,11 +76,6 @@ Ext.define('Docs.controller.Classes', { this.handleUrlClick(url, event, this.getTree()); } }, 'classgrid': { urlclick: function(url, event) { this.handleUrlClick(url, event, this.getFavoritesGrid()); } }, 'toolbar': { toggleExpanded: function(expanded) { Loading template/app/controller/Favorites.jsdeleted 100644 → 0 +0 −71 Original line number Diff line number Diff line /** * Controller for favorites. * * Syncronizes favorites store, grid and favorites markings in grid. */ Ext.define('Docs.controller.Favorites', { extend: 'Ext.app.Controller', refs: [ { ref: 'panel', selector: 'favoritespanel' }, { ref: 'tree', selector: 'classtree' } ], requires: [ 'Docs.Favorites', 'Docs.Settings' ], init: function() { this.control({ 'favoritespanel': { resize: function(cmp, w, h) { Docs.Settings.set('favorites-height', h); } }, 'favoritespanel > classgrid': { closeclick: function(url) { Docs.Favorites.remove(url); }, reorder: function() { Docs.Favorites.saveOrder(); } }, 'classtree': { addfavorite: function(url, title) { Docs.Favorites.add(url, title); }, removefavorite: function(url) { Docs.Favorites.remove(url); } } }); Docs.Favorites.on({ add: function(url) { // Show favorites when first favorite added if (Docs.Favorites.getCount() > 0) { // this.getPanel().show(); } // Add favorite marking to tree this.getTree().setFavorite(url, true); }, remove: function(url) { // Hide favorites when favorites list empty if (Docs.Favorites.getCount() === 0) { // this.getPanel().hide(); } // remove favorite marking from tree this.getTree().setFavorite(url, false); }, scope: this }); } }); No newline at end of file Loading
template/app/Application.js +0 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ Ext.define('Docs.Application', { name: 'Docs', requires: [ 'Docs.Favorites', 'Docs.History', 'Docs.Settings' ], Loading @@ -26,7 +25,6 @@ Ext.define('Docs.Application', { 'Search', 'InlineExamples', 'Examples', 'Favorites', 'Guides', 'Videos', 'Tabs' Loading @@ -34,7 +32,6 @@ Ext.define('Docs.Application', { launch: function() { Docs.App = this; Docs.Favorites.init(); Docs.Settings.init(); Docs.contentState = {}; Loading
template/app/Favorites.jsdeleted 100644 → 0 +0 −99 Original line number Diff line number Diff line /** * Favorites management. */ Ext.define("Docs.Favorites", { extend: 'Docs.LocalStore', storeName: 'Favorites', singleton: true, mixins: { observable: 'Ext.util.Observable' }, constructor: function() { this.callParent(arguments); this.addEvents( /** * Fired when favorite added. * @param {String} url The URL of the favorited page */ "add", /** * Fired when favorite removed. * @param {String} url The URL of the favorited page */ "remove" ); }, init: function() { this.callParent(arguments); // For backwards compatibility with old Favorites Model // convert the old-style records to new schema. if (this.store.first() && !this.store.first().get("url")) { this.store.each(function(r) { r.set("title", r.data.cls); r.set("url", "/api/"+r.get("cls")); r.set("cls", ""); }); this.syncStore(); } }, /** * Adds page to favorites * * @param {String} url the page to add * @param {String} title title for Favorites entry */ add: function(url, title) { if (!this.has(url)) { this.store.add({url: url, title: title}); this.syncStore(); this.fireEvent("add", url); } }, /** * Removes page from favorites. * * @param {String} url the page URL to remove */ remove: function(url) { if (this.has(url)) { this.store.removeAt(this.store.findExact('url', url)); this.syncStore(); this.fireEvent("remove", url); } }, /** * Checks if page exists in favorites * * @param {String} url the URL to check * @return {Boolean} true when present */ has: function(url) { return this.store.findExact('url', url) > -1; }, /** * Returns the number of favorites. * @return {Number} */ getCount: function() { return this.store.getCount(); }, /** * Save order of favorites in store. * * This needs to be called explicitly, because of a bug in * localStorage which prevents the order of items being saved when * they're changed. */ saveOrder: function() { this.store.getProxy().setIds(Ext.Array.map(this.store.data.items, function(i) { return i.data.id; })); } });
template/app/LocalStore.js +1 −1 Original line number Diff line number Diff line /** * Provides methods dealing with localStorage- and memory-store. * * Base class for Favorites and Settings. * Base class for Settings. */ Ext.define("Docs.LocalStore", { storeName: '', Loading
template/app/controller/Classes.js +0 −7 Original line number Diff line number Diff line Loading @@ -10,12 +10,10 @@ Ext.define('Docs.controller.Classes', { ], stores: [ 'Favorites', 'Settings' ], models: [ 'Favorite', 'Setting' ], Loading Loading @@ -78,11 +76,6 @@ Ext.define('Docs.controller.Classes', { this.handleUrlClick(url, event, this.getTree()); } }, 'classgrid': { urlclick: function(url, event) { this.handleUrlClick(url, event, this.getFavoritesGrid()); } }, 'toolbar': { toggleExpanded: function(expanded) { Loading
template/app/controller/Favorites.jsdeleted 100644 → 0 +0 −71 Original line number Diff line number Diff line /** * Controller for favorites. * * Syncronizes favorites store, grid and favorites markings in grid. */ Ext.define('Docs.controller.Favorites', { extend: 'Ext.app.Controller', refs: [ { ref: 'panel', selector: 'favoritespanel' }, { ref: 'tree', selector: 'classtree' } ], requires: [ 'Docs.Favorites', 'Docs.Settings' ], init: function() { this.control({ 'favoritespanel': { resize: function(cmp, w, h) { Docs.Settings.set('favorites-height', h); } }, 'favoritespanel > classgrid': { closeclick: function(url) { Docs.Favorites.remove(url); }, reorder: function() { Docs.Favorites.saveOrder(); } }, 'classtree': { addfavorite: function(url, title) { Docs.Favorites.add(url, title); }, removefavorite: function(url) { Docs.Favorites.remove(url); } } }); Docs.Favorites.on({ add: function(url) { // Show favorites when first favorite added if (Docs.Favorites.getCount() > 0) { // this.getPanel().show(); } // Add favorite marking to tree this.getTree().setFavorite(url, true); }, remove: function(url) { // Hide favorites when favorites list empty if (Docs.Favorites.getCount() === 0) { // this.getPanel().hide(); } // remove favorite marking from tree this.getTree().setFavorite(url, false); }, scope: this }); } }); No newline at end of file