display inherited properties

This commit is contained in:
rolux 2012-06-02 11:21:16 +02:00
parent 55c76942f9
commit 0cefbe1997

View file

@ -80,7 +80,8 @@ Ox.DocPage = function(options, self) {
function getItem(item, level, name) { function getItem(item, level, name) {
Ox.Log('Core', 'getItem', item, level, name) Ox.Log('Core', 'getItem', item, level, name)
var $elements = [$('<div>') var $elements = [
$('<div>')
.css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'}) .css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'})
.html( .html(
'<code><b>' + (name || item.name) + '</b> ' '<code><b>' + (name || item.name) + '</b> '
@ -89,10 +90,22 @@ Ox.DocPage = function(options, self) {
+ (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '') + (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '')
+ Ox.sanitizeHTML(item.summary) + Ox.sanitizeHTML(item.summary)
) )
]; ],
['description'].concat( sections = ['description'].concat(
item.order || ['returns', 'arguments', 'properties', 'events'] item.order || ['returns', 'arguments', 'properties']
).concat(['tests', 'source']).forEach(function(section) { ).concat(['events', 'tests', 'source']),
index = sections.indexOf('properties') + 1 || 1;
if (item.inherited) {
Array.prototype.splice.apply(sections, [index, 0].concat(
item.inherited.map(function(v, i) {
var section = 'properties inherited from <code>'
+ v.name + '</code>';
item[section] = v.properties;
return section;
})
));
}
sections.forEach(function(section) {
var className = 'OxLine' + Ox.uid(); var className = 'OxLine' + Ox.uid();
if (item[section]) { if (item[section]) {
if (section == 'description') { if (section == 'description') {
@ -149,10 +162,13 @@ Ox.DocPage = function(options, self) {
}); });
}) })
) )
.append('<span class="OxSection">' + Ox.toTitleCase( .append('<span class="OxSection">' + (
Ox.startsWith('properties ', section) ? section
: Ox.toTitleCase(
section == 'returns' ? 'usage' section == 'returns' ? 'usage'
: section == 'tests' ? 'examples' : section == 'tests' ? 'examples'
: section : section
)
) + '</span>') ) + '</span>')
); );
if (section == 'tests') { if (section == 'tests') {