Loading template/app/view/cls/Header.js +50 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ Ext.define('Docs.view.cls.Header', { '<tpl if="private">', '<span class="private">Private</span>', '</tpl>', '<a href="#!/api/{name}" target="_blank">{name}</a>', '<a href="#" class="class-source-link">{name}</a>', '<span class="class-source-tip">View source...</span>', '{[this.renderXTypes(values.xtypes)]}', '</h1>', Docs.showPrintButton ? '<a class="print" href="?print=/api/{name}" target="_blank">Print</a>' : '', Loading Loading @@ -52,14 +53,62 @@ Ext.define('Docs.view.cls.Header', { } } ); this.on("render", this.initSourceLink, this); this.callParent(); }, initSourceLink: function() { // When class name clicked, open the source file directly or // pop up a menu if there's more than one source file. this.classLinkEvent("click", function() { var files = this.loadedCls.files; if (files.length === 1) { window.open("source/" + files[0].href); } else { var menu = this.createFileMenu(files); menu.showBy(this, undefined, [58,-20]); } }, this); // show "View source..." tip below class name on hover this.classLinkEvent("mouseover", function() { this.el.down(".class-source-tip").show(); }, this); this.classLinkEvent("mouseout", function() { this.el.down(".class-source-tip").hide(); }, this); }, // Helper for binding handlers to class name link classLinkEvent: function(eventName, fun, scope) { this.el.on(eventName, fun, scope, { preventDefault: true, delegate: 'a.class-source-link' }); }, createFileMenu: function(files) { return new Ext.menu.Menu({ items: Ext.Array.map(files, function(f) { return { text: f.filename, handler: function() { window.open("source/" + f.href); } }; }, this) }); }, /** * Loads class name and icon to header. * @param {Object} cls class config. */ load: function(cls) { this.loadedCls = cls; this.update(this.tpl.apply(cls)); } }); template/resources/sass/viewport.scss +6 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,12 @@ a { letter-spacing: 0; margin-left: 10px; font-size: 0.6em; } span.class-source-tip { font-size: 0.5em; position: absolute; top: 35px; left: 100px; display: none; } span.private { float: right; margin-right: 50px; Loading Loading
template/app/view/cls/Header.js +50 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ Ext.define('Docs.view.cls.Header', { '<tpl if="private">', '<span class="private">Private</span>', '</tpl>', '<a href="#!/api/{name}" target="_blank">{name}</a>', '<a href="#" class="class-source-link">{name}</a>', '<span class="class-source-tip">View source...</span>', '{[this.renderXTypes(values.xtypes)]}', '</h1>', Docs.showPrintButton ? '<a class="print" href="?print=/api/{name}" target="_blank">Print</a>' : '', Loading Loading @@ -52,14 +53,62 @@ Ext.define('Docs.view.cls.Header', { } } ); this.on("render", this.initSourceLink, this); this.callParent(); }, initSourceLink: function() { // When class name clicked, open the source file directly or // pop up a menu if there's more than one source file. this.classLinkEvent("click", function() { var files = this.loadedCls.files; if (files.length === 1) { window.open("source/" + files[0].href); } else { var menu = this.createFileMenu(files); menu.showBy(this, undefined, [58,-20]); } }, this); // show "View source..." tip below class name on hover this.classLinkEvent("mouseover", function() { this.el.down(".class-source-tip").show(); }, this); this.classLinkEvent("mouseout", function() { this.el.down(".class-source-tip").hide(); }, this); }, // Helper for binding handlers to class name link classLinkEvent: function(eventName, fun, scope) { this.el.on(eventName, fun, scope, { preventDefault: true, delegate: 'a.class-source-link' }); }, createFileMenu: function(files) { return new Ext.menu.Menu({ items: Ext.Array.map(files, function(f) { return { text: f.filename, handler: function() { window.open("source/" + f.href); } }; }, this) }); }, /** * Loads class name and icon to header. * @param {Object} cls class config. */ load: function(cls) { this.loadedCls = cls; this.update(this.tpl.apply(cls)); } });
template/resources/sass/viewport.scss +6 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,12 @@ a { letter-spacing: 0; margin-left: 10px; font-size: 0.6em; } span.class-source-tip { font-size: 0.5em; position: absolute; top: 35px; left: 100px; display: none; } span.private { float: right; margin-right: 50px; Loading