display inherited properties

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

View file

@ -80,19 +80,32 @@ Ox.DocPage = function(options, self) {
function getItem(item, level, name) {
Ox.Log('Core', 'getItem', item, level, name)
var $elements = [$('<div>')
.css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'})
.html(
'<code><b>' + (name || item.name) + '</b> '
+ '&lt;' + item.types.join('&gt;</code> or <code>&lt;') + '&gt; </code>'
+ (item['class'] ? '(class: <code>' + item['class'] + '</code>) ' : '')
+ (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '')
+ Ox.sanitizeHTML(item.summary)
)
];
['description'].concat(
item.order || ['returns', 'arguments', 'properties', 'events']
).concat(['tests', 'source']).forEach(function(section) {
var $elements = [
$('<div>')
.css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'})
.html(
'<code><b>' + (name || item.name) + '</b> '
+ '&lt;' + item.types.join('&gt;</code> or <code>&lt;') + '&gt; </code>'
+ (item['class'] ? '(class: <code>' + item['class'] + '</code>) ' : '')
+ (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '')
+ Ox.sanitizeHTML(item.summary)
)
],
sections = ['description'].concat(
item.order || ['returns', 'arguments', 'properties']
).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();
if (item[section]) {
if (section == 'description') {
@ -149,10 +162,13 @@ Ox.DocPage = function(options, self) {
});
})
)
.append('<span class="OxSection">' + Ox.toTitleCase(
section == 'returns' ? 'usage'
: section == 'tests' ? 'examples'
: section
.append('<span class="OxSection">' + (
Ox.startsWith('properties ', section) ? section
: Ox.toTitleCase(
section == 'returns' ? 'usage'
: section == 'tests' ? 'examples'
: section
)
) + '</span>')
);
if (section == 'tests') {