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