From acaf54b28ffd31d9606d5d153a669d532e164804 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 31 Aug 2016 20:41:13 +0300 Subject: [PATCH] Fix code samples are not shown for operations without body param (#93) --- lib/components/Method/method.html | 5 ++--- lib/components/Method/method.scss | 1 + lib/components/RequestSamples/request-samples.html | 4 ++-- lib/components/RequestSamples/request-samples.ts | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/components/Method/method.html b/lib/components/Method/method.html index d4347097..20d908a5 100644 --- a/lib/components/Method/method.html +++ b/lib/components/Method/method.html @@ -22,9 +22,8 @@ --> -
-
- +
+
diff --git a/lib/components/Method/method.scss b/lib/components/Method/method.scss index 2fcadd4b..af11795f 100644 --- a/lib/components/Method/method.scss +++ b/lib/components/Method/method.scss @@ -5,6 +5,7 @@ padding-bottom: 100px; display: block; border-bottom: 1px solid rgba(127, 127, 127, 0.25); + margin-top: 1em; } :host:last-of-type { diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html index ea370552..8f4956cd 100644 --- a/lib/components/RequestSamples/request-samples.html +++ b/lib/components/RequestSamples/request-samples.html @@ -1,7 +1,7 @@
Request samples
- + - + diff --git a/lib/components/RequestSamples/request-samples.ts b/lib/components/RequestSamples/request-samples.ts index 159d291d..14651d54 100644 --- a/lib/components/RequestSamples/request-samples.ts +++ b/lib/components/RequestSamples/request-samples.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, ViewChildren, QueryList, EventEmitter, Input, - ChangeDetectionStrategy, OnInit } from '@angular/core'; + ChangeDetectionStrategy, OnInit, HostBinding } from '@angular/core'; import { BaseComponent, SpecManager } from '../base'; import JsonPointer from '../../utils/JsonPointer'; @@ -18,6 +18,7 @@ export class RequestSamples extends BaseComponent implements OnInit { @Input() pointer:string; @Input() schemaPointer:string; @ViewChildren(Tabs) childQuery:QueryList; + @HostBinding('attr.hidden') hidden; childTabs: Tabs; selectedLang: EventEmitter; @@ -35,8 +36,9 @@ export class RequestSamples extends BaseComponent implements OnInit { } init() { - this.schemaPointer = JsonPointer.join(this.schemaPointer, 'schema');; + this.schemaPointer = this.schemaPointer ? JsonPointer.join(this.schemaPointer, 'schema') : null; this.samples = this.componentSchema['x-code-samples'] || []; + if (!this.schemaPointer && !this.samples.length) this.hidden = true; } ngOnInit() {