Loading template/app/Application.js +16 −3 Original line number Diff line number Diff line Loading @@ -19,14 +19,27 @@ Ext.define('Docs.Application', { 'Search' ], autoCreateViewport: true, launch: function() { Docs.App = this; Docs.Favorites.init(); Docs.History.init(); Docs.Settings.init(); Ext.create('Docs.view.Viewport'); Ext.getStore('Settings').on('load', function(store) { var favHeight = Docs.Settings.get('favorites-height'); if (favHeight) { var tabPanel = Ext.getCmp('classes-tab-panel'); tabPanel.suspendEvents(); tabPanel.setHeight(favHeight); tabPanel.resumeEvents(); } }); Docs.History.init(); // When google analytics event tracking script present on page if (Docs.initEventTracking) { Docs.initEventTracking(); Loading template/app/Settings.js +3 −4 Original line number Diff line number Diff line Loading @@ -15,11 +15,10 @@ Ext.define("Docs.Settings", { set: function(key, value) { var index = this.store.findExact("key", key); if (index > -1) { this.store.getAt(index).set({key: key, value: value}); this.store.removeAt(index); } else { this.store.add({key: key, value: value}); } this.syncStore(); }, Loading template/app/controller/Classes.js +7 −7 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ Ext.define('Docs.controller.Classes', { ); Ext.getBody().addListener('click', function(event, el) { (event.button === this.MIDDLE) ? window.open(el.href) : this.loadClass(el.rel); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open(el.href) : this.loadClass(el.rel); }, this, { preventDefault: true, delegate: '.docClass' Loading @@ -83,12 +83,12 @@ Ext.define('Docs.controller.Classes', { this.control({ 'classtree': { classclick: function(cls, event) { (event.button === this.MIDDLE) ? window.open("#/api/" + cls) : this.loadClass(cls); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open("#/api/" + cls) : this.loadClass(cls); } }, 'classgrid': { classclick: function(cls, event) { (event.button === this.MIDDLE) ? window.open("#/api/" + cls) : this.loadClass(cls); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open("#/api/" + cls) : this.loadClass(cls); } }, Loading Loading @@ -135,6 +135,10 @@ Ext.define('Docs.controller.Classes', { var cls = clsUrl; var member; if (!noHistory) { Docs.History.push("/api/" + clsUrl); } Ext.getCmp('card-panel').layout.setActiveItem(1); // separate class and member name Loading @@ -144,10 +148,6 @@ Ext.define('Docs.controller.Classes', { member = matches[2]; } if (!noHistory) { Docs.History.push("/api/" + clsUrl); } if (this.cache[cls]) { this.showClass(this.cache[cls], member); } else { Loading template/app/view/ClassGrid.js +3 −3 Original line number Diff line number Diff line Loading @@ -75,9 +75,9 @@ Ext.define('Docs.view.ClassGrid', { // of the clicked-on item should not happen. When it needs to // be selected, the #showClass method in Class controller will // explicitly call #selectClass. this.on("beforeselect", function() { return false; }, this); // this.on("beforeselect", function() { // return false; // }, this); this.on("itemclick", function(view, record, item, index, event) { // Don't fire classclick when close button clicked Loading template/app/view/Viewport.js +31 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,14 @@ Ext.define('Docs.view.Viewport', { afterRender: function() { // Add 7px padding at left side of tab-bar this.tabBar.insert(0, {width: 7, xtype: 'container'}); this.on('resize', function(cls, w, h) { Docs.Settings.set('favorites-height', h) }); var favHeight = Docs.Settings.get('favorites-height'); if (favHeight) { this.setHeight(favHeight); } } }, items: [ Loading @@ -104,8 +112,18 @@ Ext.define('Docs.view.Viewport', { title: 'Favorites', iconCls: 'icon-fav', viewConfig: { plugins: { ptype: 'gridviewdragdrop' plugins: [{ pluginId: 'favGridDD', ptype: 'gridviewdragdrop', dragText: 'Drag and drop to reorganize' }], listeners: { drop: function() { // Hack to fix a bug in localStorage which prevents the order of // items being saved when they're changed var store = Ext.getStore('Favorites'); store.getProxy().setIds(Ext.Array.map(store.data.items, function(i) { return i.data.id})) } } }, store: Ext.getStore('Favorites'), Loading @@ -113,6 +131,17 @@ Ext.define('Docs.view.Viewport', { listeners: { closeclick: function(cls) { Docs.Favorites.remove(cls); }, afterrender: function() { var ddPlugin = this.getView().getPlugin('favGridDD'); ddPlugin.dragZone.onInitDrag = function() { Ext.getCmp('favorites-grid').addCls('drag'); Ext.view.DragZone.prototype.onInitDrag.apply(this, arguments); } ddPlugin.dragZone.afterValidDrop = ddPlugin.dragZone.afterInvalidDrop = function() { Ext.getCmp('favorites-grid').removeCls('drag'); } } } } Loading Loading
template/app/Application.js +16 −3 Original line number Diff line number Diff line Loading @@ -19,14 +19,27 @@ Ext.define('Docs.Application', { 'Search' ], autoCreateViewport: true, launch: function() { Docs.App = this; Docs.Favorites.init(); Docs.History.init(); Docs.Settings.init(); Ext.create('Docs.view.Viewport'); Ext.getStore('Settings').on('load', function(store) { var favHeight = Docs.Settings.get('favorites-height'); if (favHeight) { var tabPanel = Ext.getCmp('classes-tab-panel'); tabPanel.suspendEvents(); tabPanel.setHeight(favHeight); tabPanel.resumeEvents(); } }); Docs.History.init(); // When google analytics event tracking script present on page if (Docs.initEventTracking) { Docs.initEventTracking(); Loading
template/app/Settings.js +3 −4 Original line number Diff line number Diff line Loading @@ -15,11 +15,10 @@ Ext.define("Docs.Settings", { set: function(key, value) { var index = this.store.findExact("key", key); if (index > -1) { this.store.getAt(index).set({key: key, value: value}); this.store.removeAt(index); } else { this.store.add({key: key, value: value}); } this.syncStore(); }, Loading
template/app/controller/Classes.js +7 −7 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ Ext.define('Docs.controller.Classes', { ); Ext.getBody().addListener('click', function(event, el) { (event.button === this.MIDDLE) ? window.open(el.href) : this.loadClass(el.rel); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open(el.href) : this.loadClass(el.rel); }, this, { preventDefault: true, delegate: '.docClass' Loading @@ -83,12 +83,12 @@ Ext.define('Docs.controller.Classes', { this.control({ 'classtree': { classclick: function(cls, event) { (event.button === this.MIDDLE) ? window.open("#/api/" + cls) : this.loadClass(cls); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open("#/api/" + cls) : this.loadClass(cls); } }, 'classgrid': { classclick: function(cls, event) { (event.button === this.MIDDLE) ? window.open("#/api/" + cls) : this.loadClass(cls); (event.button === this.MIDDLE || event.shiftKey || event.ctrlKey) ? window.open("#/api/" + cls) : this.loadClass(cls); } }, Loading Loading @@ -135,6 +135,10 @@ Ext.define('Docs.controller.Classes', { var cls = clsUrl; var member; if (!noHistory) { Docs.History.push("/api/" + clsUrl); } Ext.getCmp('card-panel').layout.setActiveItem(1); // separate class and member name Loading @@ -144,10 +148,6 @@ Ext.define('Docs.controller.Classes', { member = matches[2]; } if (!noHistory) { Docs.History.push("/api/" + clsUrl); } if (this.cache[cls]) { this.showClass(this.cache[cls], member); } else { Loading
template/app/view/ClassGrid.js +3 −3 Original line number Diff line number Diff line Loading @@ -75,9 +75,9 @@ Ext.define('Docs.view.ClassGrid', { // of the clicked-on item should not happen. When it needs to // be selected, the #showClass method in Class controller will // explicitly call #selectClass. this.on("beforeselect", function() { return false; }, this); // this.on("beforeselect", function() { // return false; // }, this); this.on("itemclick", function(view, record, item, index, event) { // Don't fire classclick when close button clicked Loading
template/app/view/Viewport.js +31 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,14 @@ Ext.define('Docs.view.Viewport', { afterRender: function() { // Add 7px padding at left side of tab-bar this.tabBar.insert(0, {width: 7, xtype: 'container'}); this.on('resize', function(cls, w, h) { Docs.Settings.set('favorites-height', h) }); var favHeight = Docs.Settings.get('favorites-height'); if (favHeight) { this.setHeight(favHeight); } } }, items: [ Loading @@ -104,8 +112,18 @@ Ext.define('Docs.view.Viewport', { title: 'Favorites', iconCls: 'icon-fav', viewConfig: { plugins: { ptype: 'gridviewdragdrop' plugins: [{ pluginId: 'favGridDD', ptype: 'gridviewdragdrop', dragText: 'Drag and drop to reorganize' }], listeners: { drop: function() { // Hack to fix a bug in localStorage which prevents the order of // items being saved when they're changed var store = Ext.getStore('Favorites'); store.getProxy().setIds(Ext.Array.map(store.data.items, function(i) { return i.data.id})) } } }, store: Ext.getStore('Favorites'), Loading @@ -113,6 +131,17 @@ Ext.define('Docs.view.Viewport', { listeners: { closeclick: function(cls) { Docs.Favorites.remove(cls); }, afterrender: function() { var ddPlugin = this.getView().getPlugin('favGridDD'); ddPlugin.dragZone.onInitDrag = function() { Ext.getCmp('favorites-grid').addCls('drag'); Ext.view.DragZone.prototype.onInitDrag.apply(this, arguments); } ddPlugin.dragZone.afterValidDrop = ddPlugin.dragZone.afterInvalidDrop = function() { Ext.getCmp('favorites-grid').removeCls('drag'); } } } } Loading