Add own JsonSchema to responses

This commit is contained in:
Roman Hotsiy 2015-11-24 00:08:11 +02:00
parent f9382ea9b5
commit a0b66655bf
5 changed files with 16 additions and 7 deletions

View File

@ -3,7 +3,7 @@
{{title}}
<span class="zippy-indicator"> {{ visible ? '&blacktriangledown;' : '&blacktriangleright;' }} </span>
</div>
<div class="zippy-content" [hidden]="!visible">
<div class="zippy-content" [ng-class]="{'zippy-hidden': !visible}">
<ng-content></ng-content>
</div>
</div>

View File

@ -47,6 +47,10 @@ span.zippy-indicator {
}
.zippy-empty {
.zippy-title {
cursor: default;
}
.zippy-indicator {
display: none;
}
@ -55,3 +59,9 @@ span.zippy-indicator {
display: none;
}
}
.zippy-hidden {
visibility: hidden;
height: 0;
padding: 0;
}

View File

@ -35,8 +35,6 @@ export default class JsonSchema extends BaseComponent {
return propData;
});
this.data.properties = props;
}
adjustNameColumnWidth() {
@ -44,6 +42,7 @@ export default class JsonSchema extends BaseComponent {
let names = [].slice.call(this.element.querySelectorAll('.param-name'));
let widths = names.map(el => el.offsetWidth);
let maxWidth = Math.max(...widths);
if (!maxWidth) return;
names.forEach(el => {
el.style.minWidth = maxWidth + 'px';
});

View File

@ -1,6 +1,6 @@
<h2 class="responses-list-header" *ng-if="data.responses.length"> Responses </h2>
<zippy *ng-for="#response of data.responses" title="{{response.code}} {{response.description}}"
[type]="response.type" [empty]="!response.schema">
<schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
</schema>
<json-schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
</json-schema>
</zippy>

View File

@ -2,7 +2,7 @@
import {RedocComponent, BaseComponent} from '../base';
import JsonPointer from '../../utils/JsonPointer';
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
import JsonSchema from '../JsonSchema/json-schema';
import {Zippy} from '../../common/components/Zippy/zippy';
import {statusCodeType} from '../../utils/helpers';
@ -14,7 +14,7 @@ function isNumeric(n) {
selector: 'responses-list',
templateUrl: './lib/components/ResponsesList/responses-list.html',
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
directives: [JsonSchemaView, Zippy]
directives: [JsonSchema, Zippy]
})
export default class ResponsesList extends BaseComponent {
constructor(schemaMgr) {