Loading template/app/History.js +3 −3 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ Ext.define("Docs.History", { else if (url.type === "api") { Docs.App.getController('Classes').loadClass(url.url, true); } else if (url.url === "/guides") { else if (url.url === "/guide") { Docs.App.getController('Guides').loadIndex(true); } else if (url.type === "guide") { Docs.App.getController('Classes').loadGuide(url.url, true); Docs.App.getController('Guides').loadGuide(url.url, true); } else if (url.url === "/videos") { Docs.App.getController('Videos').loadIndex(true); Loading @@ -48,7 +48,7 @@ Ext.define("Docs.History", { // Parses current browser location parseToken: function(token) { var matches = token && token.match(/\/(api|guides|examples|videos)(\/(.*))?/); var matches = token && token.match(/\/(api|guide|examples|videos)(\/(.*))?/); return matches ? {type: matches[1], url: matches[0]} : {}; }, Loading template/app/controller/Classes.js +11 −81 Original line number Diff line number Diff line Loading @@ -63,13 +63,7 @@ Ext.define('Docs.controller.Classes', { * @param {String} cls name of the class. * @param {String} anchor name of the member in form type-name like "method-bind". */ "showMember", /** * @event showGuide * Fired after guide shown. Used for analytics event tracking. * @param {String} guide name of the guide. */ "showGuide" "showMember" ); Ext.getBody().addListener('click', function(event, el) { Loading @@ -91,17 +85,6 @@ Ext.define('Docs.controller.Classes', { } }, 'indexcontainer': { afterrender: function(cmp) { cmp.el.addListener('click', function(event, el) { this.handleUrlClick(el.href, event); }, this, { preventDefault: true, delegate: '.guide' }); } }, 'toolbar': { toggleExpanded: function(expanded) { Ext.Array.forEach(Ext.query('.side.expandable'), function(el) { Loading Loading @@ -162,13 +145,8 @@ Ext.define('Docs.controller.Classes', { view && view.selectUrl(this.activeUrl ? this.activeUrl : ""); } else { if (/^\/api\//.test(url)) { this.loadClass(url); } else { this.loadGuide(url); } } }, // Code for the middle mouse button Loading Loading @@ -206,6 +184,11 @@ Ext.define('Docs.controller.Classes', { * @param {Boolean} noHistory true to disable adding entry to browser history */ loadClass: function(url, noHistory) { Ext.getCmp('card-panel').layout.setActiveItem('classcontainer'); Ext.getCmp('tree-container').show(); Ext.getCmp('tree-container').layout.setActiveItem(0); if (this.activeUrl === url) return; this.activeUrl = url; Loading @@ -213,9 +196,6 @@ Ext.define('Docs.controller.Classes', { Docs.History.push(url); } Ext.getCmp('card-panel').layout.setActiveItem('classcontainer'); Ext.getCmp('tree-container').layout.setActiveItem(0); // separate class and member name var matches = url.match(/^\/api\/(.*?)(?:-(.*))?$/); var cls = matches[1]; Loading @@ -237,7 +217,7 @@ Ext.define('Docs.controller.Classes', { this.showClass(json, member); }, failure: function(response, opts) { this.showFailure("Class <b>"+cls+"</b> was not found."); this.getController('Index').showFailure("Class <b>"+cls+"</b> was not found."); }, scope: this }); Loading @@ -245,11 +225,13 @@ Ext.define('Docs.controller.Classes', { }, showClass: function(cls, anchor) { this.getOverview().setLoading(false); if (this.currentCls !== cls) { this.getViewport().setPageTitle(cls.name); this.getHeader().load(cls); this.getOverview().load(cls); this.getOverview().setLoading(false); this.getTree().selectUrl("/api/"+cls.name); this.fireEvent('showClass', cls.name); Loading @@ -267,58 +249,6 @@ Ext.define('Docs.controller.Classes', { this.currentCls = cls; }, /** * Loads guide. * * @param {String} url URL of the guide * @param {Boolean} noHistory true to disable adding entry to browser history */ loadGuide: function(url, noHistory) { if (this.activeUrl === url) return; this.activeUrl = url; noHistory || Docs.History.push(url); var name = url.match(/^\/guide\/(.*)$/); if (name) { Ext.data.JsonP.request({ url: this.getBaseUrl() + "/guides/" + name[1] + "/README.js", callbackName: name[1], success: function(json) { this.getViewport().setPageTitle(json.guide.match(/<h1>(.*)<\/h1>/)[1]); Ext.getCmp("guide").update(json.guide); Ext.getCmp('card-panel').layout.setActiveItem(2); Docs.Syntax.highlight(Ext.get("guide")); this.fireEvent('showGuide', name[1]); this.getTree().selectUrl(url); }, failure: function(response, opts) { this.showFailure("Guide <b>"+name[1]+"</b> was not found."); }, scope: this }); } }, /** * Displays page with 404 error message. * @param {String} msg * @private */ showFailure: function(msg) { this.getOverview().setLoading(false); var tpl = new Ext.XTemplate( "<h1>Oops...</h1>", "<p>{msg}</p>", "<p>Maybe it was renamed to something else? Or maybe it has passed away permanently to the 404 land? ", "This would be sad. Hopefully it's just a bug in our side. ", "Report it to <a href='http://www.sencha.com/forum/showthread.php?135036'>Sencha Forum</a> if you feel so.</p>", "<p>Sorry for all this :(</p>" ); Ext.getCmp("failure").update(tpl.apply({msg: msg})); Ext.getCmp('card-panel').layout.setActiveItem("failure"); }, /** * Returns base URL used for making AJAX requests. * @return {String} URL Loading template/app/controller/Guides.js +67 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,75 @@ Ext.define('Docs.controller.Guides', { extend: 'Ext.app.Controller', init: function() { this.addEvents( /** * @event showGuide * Fired after guide shown. Used for analytics event tracking. * @param {String} guide name of the guide. */ "showGuide" ); this.control({ 'indexcontainer': { afterrender: function(cmp) { cmp.el.addListener('click', function(event, el) { this.handleUrlClick(el.href, event); }, this, { preventDefault: true, delegate: '.guide' }); } } }) }, loadIndex: function() { Ext.getCmp('doctabs').activateTab('#/guides'); Ext.getCmp('doctabs').activateTab('#/guide'); Ext.getCmp('card-panel').layout.setActiveItem('guides'); Ext.getCmp('tree-container').hide(); }, /** * Loads guide. * * @param {String} url URL of the guide * @param {Boolean} noHistory true to disable adding entry to browser history */ loadGuide: function(url, noHistory) { if (this.activeUrl === url) return; this.activeUrl = url; noHistory || Docs.History.push(url); var name = url.match(/^\/guide\/(.*)$/); if (name) { Ext.data.JsonP.request({ url: this.getBaseUrl() + "/guides/" + name[1] + "/README.js", callbackName: name[1], success: function(json) { this.getViewport().setPageTitle(json.guide.match(/<h1>(.*)<\/h1>/)[1]); Ext.getCmp("guide").update(json.guide); Ext.getCmp('card-panel').layout.setActiveItem(2); Docs.Syntax.highlight(Ext.get("guide")); this.fireEvent('showGuide', name[1]); this.getTree().selectUrl(url); }, failure: function(response, opts) { this.getController('Index').showFailure("Guide <b>"+name[1]+"</b> was not found."); }, scope: this }); } }, /** * Returns base URL used for making AJAX requests. * @return {String} URL */ getBaseUrl: function() { return document.location.href.replace(/#.*/, "").replace(/index.html/, ""); } }); template/app/controller/Index.js +19 −0 Original line number Diff line number Diff line Loading @@ -8,5 +8,24 @@ Ext.define('Docs.controller.Index', { Ext.getCmp('doctabs').activateTab('#'); Ext.getCmp('card-panel').layout.setActiveItem('welcome'); Ext.getCmp('tree-container').hide(); }, /** * Displays page with 404 error message. * @param {String} msg * @private */ showFailure: function(msg) { this.getOverview().setLoading(false); var tpl = new Ext.XTemplate( "<h1>Oops...</h1>", "<p>{msg}</p>", "<p>Maybe it was renamed to something else? Or maybe it has passed away permanently to the 404 land? ", "This would be sad. Hopefully it's just a bug in our side. ", "Report it to <a href='http://www.sencha.com/forum/showthread.php?135036'>Sencha Forum</a> if you feel so.</p>", "<p>Sorry for all this :(</p>" ); Ext.getCmp("failure").update(tpl.apply({msg: msg})); Ext.getCmp('card-panel').layout.setActiveItem("failure"); } }); template/app/controller/Tabs.js +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ Ext.define('Docs.controller.Tabs', { cmp.el.addListener('click', function(event, el) { cmp.justClosed = true; var docTab = Ext.get(el).up('.doctab'); Ext.getCmp('doctabs').removeTab(docTab.down('.docClass').getAttribute('href')); Ext.getCmp('doctabs').removeTab(docTab.down('.tabUrl').getAttribute('href')); docTab.animate({ to: { top: 30 } }).animate({ Loading Loading
template/app/History.js +3 −3 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ Ext.define("Docs.History", { else if (url.type === "api") { Docs.App.getController('Classes').loadClass(url.url, true); } else if (url.url === "/guides") { else if (url.url === "/guide") { Docs.App.getController('Guides').loadIndex(true); } else if (url.type === "guide") { Docs.App.getController('Classes').loadGuide(url.url, true); Docs.App.getController('Guides').loadGuide(url.url, true); } else if (url.url === "/videos") { Docs.App.getController('Videos').loadIndex(true); Loading @@ -48,7 +48,7 @@ Ext.define("Docs.History", { // Parses current browser location parseToken: function(token) { var matches = token && token.match(/\/(api|guides|examples|videos)(\/(.*))?/); var matches = token && token.match(/\/(api|guide|examples|videos)(\/(.*))?/); return matches ? {type: matches[1], url: matches[0]} : {}; }, Loading
template/app/controller/Classes.js +11 −81 Original line number Diff line number Diff line Loading @@ -63,13 +63,7 @@ Ext.define('Docs.controller.Classes', { * @param {String} cls name of the class. * @param {String} anchor name of the member in form type-name like "method-bind". */ "showMember", /** * @event showGuide * Fired after guide shown. Used for analytics event tracking. * @param {String} guide name of the guide. */ "showGuide" "showMember" ); Ext.getBody().addListener('click', function(event, el) { Loading @@ -91,17 +85,6 @@ Ext.define('Docs.controller.Classes', { } }, 'indexcontainer': { afterrender: function(cmp) { cmp.el.addListener('click', function(event, el) { this.handleUrlClick(el.href, event); }, this, { preventDefault: true, delegate: '.guide' }); } }, 'toolbar': { toggleExpanded: function(expanded) { Ext.Array.forEach(Ext.query('.side.expandable'), function(el) { Loading Loading @@ -162,13 +145,8 @@ Ext.define('Docs.controller.Classes', { view && view.selectUrl(this.activeUrl ? this.activeUrl : ""); } else { if (/^\/api\//.test(url)) { this.loadClass(url); } else { this.loadGuide(url); } } }, // Code for the middle mouse button Loading Loading @@ -206,6 +184,11 @@ Ext.define('Docs.controller.Classes', { * @param {Boolean} noHistory true to disable adding entry to browser history */ loadClass: function(url, noHistory) { Ext.getCmp('card-panel').layout.setActiveItem('classcontainer'); Ext.getCmp('tree-container').show(); Ext.getCmp('tree-container').layout.setActiveItem(0); if (this.activeUrl === url) return; this.activeUrl = url; Loading @@ -213,9 +196,6 @@ Ext.define('Docs.controller.Classes', { Docs.History.push(url); } Ext.getCmp('card-panel').layout.setActiveItem('classcontainer'); Ext.getCmp('tree-container').layout.setActiveItem(0); // separate class and member name var matches = url.match(/^\/api\/(.*?)(?:-(.*))?$/); var cls = matches[1]; Loading @@ -237,7 +217,7 @@ Ext.define('Docs.controller.Classes', { this.showClass(json, member); }, failure: function(response, opts) { this.showFailure("Class <b>"+cls+"</b> was not found."); this.getController('Index').showFailure("Class <b>"+cls+"</b> was not found."); }, scope: this }); Loading @@ -245,11 +225,13 @@ Ext.define('Docs.controller.Classes', { }, showClass: function(cls, anchor) { this.getOverview().setLoading(false); if (this.currentCls !== cls) { this.getViewport().setPageTitle(cls.name); this.getHeader().load(cls); this.getOverview().load(cls); this.getOverview().setLoading(false); this.getTree().selectUrl("/api/"+cls.name); this.fireEvent('showClass', cls.name); Loading @@ -267,58 +249,6 @@ Ext.define('Docs.controller.Classes', { this.currentCls = cls; }, /** * Loads guide. * * @param {String} url URL of the guide * @param {Boolean} noHistory true to disable adding entry to browser history */ loadGuide: function(url, noHistory) { if (this.activeUrl === url) return; this.activeUrl = url; noHistory || Docs.History.push(url); var name = url.match(/^\/guide\/(.*)$/); if (name) { Ext.data.JsonP.request({ url: this.getBaseUrl() + "/guides/" + name[1] + "/README.js", callbackName: name[1], success: function(json) { this.getViewport().setPageTitle(json.guide.match(/<h1>(.*)<\/h1>/)[1]); Ext.getCmp("guide").update(json.guide); Ext.getCmp('card-panel').layout.setActiveItem(2); Docs.Syntax.highlight(Ext.get("guide")); this.fireEvent('showGuide', name[1]); this.getTree().selectUrl(url); }, failure: function(response, opts) { this.showFailure("Guide <b>"+name[1]+"</b> was not found."); }, scope: this }); } }, /** * Displays page with 404 error message. * @param {String} msg * @private */ showFailure: function(msg) { this.getOverview().setLoading(false); var tpl = new Ext.XTemplate( "<h1>Oops...</h1>", "<p>{msg}</p>", "<p>Maybe it was renamed to something else? Or maybe it has passed away permanently to the 404 land? ", "This would be sad. Hopefully it's just a bug in our side. ", "Report it to <a href='http://www.sencha.com/forum/showthread.php?135036'>Sencha Forum</a> if you feel so.</p>", "<p>Sorry for all this :(</p>" ); Ext.getCmp("failure").update(tpl.apply({msg: msg})); Ext.getCmp('card-panel').layout.setActiveItem("failure"); }, /** * Returns base URL used for making AJAX requests. * @return {String} URL Loading
template/app/controller/Guides.js +67 −1 Original line number Diff line number Diff line Loading @@ -4,9 +4,75 @@ Ext.define('Docs.controller.Guides', { extend: 'Ext.app.Controller', init: function() { this.addEvents( /** * @event showGuide * Fired after guide shown. Used for analytics event tracking. * @param {String} guide name of the guide. */ "showGuide" ); this.control({ 'indexcontainer': { afterrender: function(cmp) { cmp.el.addListener('click', function(event, el) { this.handleUrlClick(el.href, event); }, this, { preventDefault: true, delegate: '.guide' }); } } }) }, loadIndex: function() { Ext.getCmp('doctabs').activateTab('#/guides'); Ext.getCmp('doctabs').activateTab('#/guide'); Ext.getCmp('card-panel').layout.setActiveItem('guides'); Ext.getCmp('tree-container').hide(); }, /** * Loads guide. * * @param {String} url URL of the guide * @param {Boolean} noHistory true to disable adding entry to browser history */ loadGuide: function(url, noHistory) { if (this.activeUrl === url) return; this.activeUrl = url; noHistory || Docs.History.push(url); var name = url.match(/^\/guide\/(.*)$/); if (name) { Ext.data.JsonP.request({ url: this.getBaseUrl() + "/guides/" + name[1] + "/README.js", callbackName: name[1], success: function(json) { this.getViewport().setPageTitle(json.guide.match(/<h1>(.*)<\/h1>/)[1]); Ext.getCmp("guide").update(json.guide); Ext.getCmp('card-panel').layout.setActiveItem(2); Docs.Syntax.highlight(Ext.get("guide")); this.fireEvent('showGuide', name[1]); this.getTree().selectUrl(url); }, failure: function(response, opts) { this.getController('Index').showFailure("Guide <b>"+name[1]+"</b> was not found."); }, scope: this }); } }, /** * Returns base URL used for making AJAX requests. * @return {String} URL */ getBaseUrl: function() { return document.location.href.replace(/#.*/, "").replace(/index.html/, ""); } });
template/app/controller/Index.js +19 −0 Original line number Diff line number Diff line Loading @@ -8,5 +8,24 @@ Ext.define('Docs.controller.Index', { Ext.getCmp('doctabs').activateTab('#'); Ext.getCmp('card-panel').layout.setActiveItem('welcome'); Ext.getCmp('tree-container').hide(); }, /** * Displays page with 404 error message. * @param {String} msg * @private */ showFailure: function(msg) { this.getOverview().setLoading(false); var tpl = new Ext.XTemplate( "<h1>Oops...</h1>", "<p>{msg}</p>", "<p>Maybe it was renamed to something else? Or maybe it has passed away permanently to the 404 land? ", "This would be sad. Hopefully it's just a bug in our side. ", "Report it to <a href='http://www.sencha.com/forum/showthread.php?135036'>Sencha Forum</a> if you feel so.</p>", "<p>Sorry for all this :(</p>" ); Ext.getCmp("failure").update(tpl.apply({msg: msg})); Ext.getCmp('card-panel').layout.setActiveItem("failure"); } });
template/app/controller/Tabs.js +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ Ext.define('Docs.controller.Tabs', { cmp.el.addListener('click', function(event, el) { cmp.justClosed = true; var docTab = Ext.get(el).up('.doctab'); Ext.getCmp('doctabs').removeTab(docTab.down('.docClass').getAttribute('href')); Ext.getCmp('doctabs').removeTab(docTab.down('.tabUrl').getAttribute('href')); docTab.animate({ to: { top: 30 } }).animate({ Loading