From 35d9027b64e583ee1ae862aabc6e829a66e18b77 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Fri, 12 Feb 2016 20:03:53 +0300 Subject: [PATCH 01/10] Full width --- package.json | 4 ++-- templates/index.jade | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 809c667f..db18bc5d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "aglio-theme-olio", + "name": "aglio-theme-kaiten", "version": "1.6.2", - "description": "Default theme for the Aglio API Blueprint renderer", + "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { "build": "coffeelint src/*.coffee && coffee -o lib -c src", diff --git a/templates/index.jade b/templates/index.jade index b6c2fe9f..74fcb1e4 100644 --- a/templates/index.jade +++ b/templates/index.jade @@ -12,7 +12,7 @@ html a.text-muted.back-to-top(href='#top') i.fa.fa-toggle-up |  Back to top - div(class=self.fullWidth ? 'container-fluid' : 'container') + div(class='container-fluid') .row block nav +Nav(false) From 48db836ae6e47bb27d4e6947fbe3be6b17e60054 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Fri, 12 Feb 2016 20:21:39 +0300 Subject: [PATCH 02/10] Fix --- .npmignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.npmignore b/.npmignore index 8f32cd36..aee8224c 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,5 @@ coverage node_modules -src test npm-debug.log .travis.yml From 3f1dd6e373041c15849c52269f701ba9257f91ce Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Sun, 14 Feb 2016 13:17:35 +0300 Subject: [PATCH 03/10] No schema, request expanded by default --- templates/mixins.jade | 12 ++++++------ templates/scripts.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/mixins.jade b/templates/mixins.jade index 888811a9..f2303a29 100644 --- a/templates/mixins.jade +++ b/templates/mixins.jade @@ -131,11 +131,11 @@ mixin RequestResponseBody(request, collapse, showBlank) pre: code != self.highlight(request.body, null, ['json', 'yaml', 'xml', 'javascript']) div(style="height: 1px;") - if request.schema - h5 Schema - pre: code - != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) - div(style="height: 1px;") + //if request.schema + // h5 Schema + // pre: code + // != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) + // div(style="height: 1px;") if !request.hasContent .description.text-muted This response has no content. div(style="height: 1px;") @@ -143,7 +143,7 @@ mixin RequestResponseBody(request, collapse, showBlank) mixin Examples(resourceGroup, resource, action) each example in action.examples each request in example.requests - +RequestResponse('Request', request, true) + +RequestResponse('Request', request, false) each response in example.responses +RequestResponse('Response', response, true) diff --git a/templates/scripts.js b/templates/scripts.js index d105df6c..f4613ef3 100644 --- a/templates/scripts.js +++ b/templates/scripts.js @@ -217,7 +217,7 @@ function init() { init(); window.onload = function () { - autoCollapse(); + // autoCollapse(); // Remove the `preload` class to enable animations document.querySelector('body').className = ''; }; From cba54a67d8652432555b5224e0882bea367f175a Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Sun, 14 Feb 2016 13:27:53 +0300 Subject: [PATCH 04/10] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index db18bc5d..e8809b12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aglio-theme-kaiten", - "version": "1.6.2", + "version": "1.6.3", "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { From 6c6147f7d4b7fbe5f92a6d077ef287d0308637e0 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Thu, 25 Feb 2016 18:16:52 +0300 Subject: [PATCH 05/10] npm build in postinstall --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8809b12..914e8f70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aglio-theme-kaiten", - "version": "1.6.3", + "version": "1.6.4", "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { @@ -12,7 +12,7 @@ "pretest": "npm run build", "test": "mocha --compilers coffee:coffee-script/register", "prepublish": "npm run build", - "postinstall": "node scripts/setup-cache.js" + "postinstall": "npm run build && node scripts/setup-cache.js" }, "repository": { "type": "git", From 76c9030ffaea42435e79ec7ec31d4351b90f35ec Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Thu, 25 Feb 2016 18:24:39 +0300 Subject: [PATCH 06/10] coffeelint in dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 914e8f70..756ef136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aglio-theme-kaiten", - "version": "1.6.4", + "version": "1.6.5", "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { @@ -35,6 +35,7 @@ "homepage": "https://github.com/danielgtaylor/aglio/tree/olio-theme", "dependencies": { "coffee-script": "^1.8.0", + "coffeelint": "^1.7.1", "highlight.js": "^8.4.0", "jade": "^1.8.2", "less": "^2.1.2", @@ -48,7 +49,6 @@ }, "devDependencies": { "chai": "^3.0.0", - "coffeelint": "^1.7.1", "coveralls": "^2.11.2", "istanbul": "^0.3.6", "mocha": "^2.0.1", From 11e311b90cb560f9c0895bdf316f1f2f7020c6c3 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Mon, 21 Mar 2016 21:00:46 +0300 Subject: [PATCH 07/10] Attributes rendering --- templates/mixins.jade | 160 +++++++++++++++++++++++------------------- 1 file changed, 89 insertions(+), 71 deletions(-) diff --git a/templates/mixins.jade b/templates/mixins.jade index f2303a29..16df1ffb 100644 --- a/templates/mixins.jade +++ b/templates/mixins.jade @@ -1,4 +1,3 @@ - mixin Badge(method) //- Draw a badge for a given HTTP method case method @@ -26,37 +25,37 @@ mixin Nav() if self.api.navItems && self.api.navItems.length .resource-group .heading - .chevron - i.open.fa.fa-angle-down - a(href='#top') Overview + .chevron + i.open.fa.fa-angle-down + a(href='#top') Overview .collapse-content - ul: each item in self.api.navItems - li - a(href=item[1])!= item[0] + ul: each item in self.api.navItems + li + a(href=item[1])!= item[0] each resourceGroup in self.api.resourceGroups || [] .resource-group .heading - .chevron - i.open.fa.fa-angle-down - a(href=resourceGroup.elementLink)!= resourceGroup.name || 'Resource Group' + .chevron + i.open.fa.fa-angle-down + a(href=resourceGroup.elementLink)!= resourceGroup.name || 'Resource Group' .collapse-content - ul - each item in resourceGroup.navItems || [] - li - a(href=item[1])!= item[0] - each resource in resourceGroup.resources || [] - li - if !self.condenseNav || (resource.actions.length != 1) - a(href=resource.elementLink)!= resource.name || 'Resource' - ul: each action in resource.actions || [] - li: a(href=action.elementLink) - +Badge(action.method) - != action.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) - else - - var action = resource.actions[0] - a(href=action.elementLink) - +Badge(action.method) - != action.name || resource.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) + ul + each item in resourceGroup.navItems || [] + li + a(href=item[1])!= item[0] + each resource in resourceGroup.resources || [] + li + if !self.condenseNav || (resource.actions.length != 1) + a(href=resource.elementLink)!= resource.name || 'Resource' + ul: each action in resource.actions || [] + li: a(href=action.elementLink) + +Badge(action.method) + != action.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) + else + - var action = resource.actions[0] + a(href=action.elementLink) + +Badge(action.method) + != action.name || resource.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) //- Link to the API hostname, e.g. api.yourcompany.com each meta in self.api.metadata || {} if meta.name == 'HOST' @@ -124,18 +123,37 @@ mixin RequestResponseBody(request, collapse, showBlank) each item, index in request.headers != self.highlight(item.name + ': ' + item.value, 'http') if index < request.headers.length - 1 - br + br div(style="height: 1px;") if request.body h5 Body pre: code != self.highlight(request.body, null, ['json', 'yaml', 'xml', 'javascript']) div(style="height: 1px;") - //if request.schema - // h5 Schema - // pre: code - // != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) - // div(style="height: 1px;") + if request.schema + - var schema = JSON.parse(request.schema) + table(style="width: 100%;") + thead + tr + th Attribute name + th Type + th Required + th Description + each description, name in schema.properties || [] + tr + td #{name} + td #{description.type} + td #{schema.required && schema.required.indexOf(name) >= 0 ? 'true' : ''} + td #{description.description} + div.title + .collapse-button + span.close Hide + span.open Show + strong Schema + div.collapse-content: .inner + pre: code + != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) + div(style="height: 1px;") if !request.hasContent .description.text-muted This response has no content. div(style="height: 1px;") @@ -190,8 +208,8 @@ mixin Content() span.method(class=action.methodLower)= action.method |   span.uri - span.hostname= self.api.host - != action.colorizedUriTemplate + span.hostname= self.api.host + != action.colorizedUriTemplate //- A list of sub-sections for parameters, requests //- and responses. @@ -238,43 +256,43 @@ mixin ContentTriple() each action in resource.actions || [] if action.examples .right - .definition - span.method(class=action.methodLower)= action.method - |   - span.uri - span.hostname= self.api.host - != action.colorizedUriTemplate - .tabs - if action.hasRequest - .example-names - span Requests - - var requestCount = 0 - each example in action.examples - each request in example.requests - - requestCount++ - span.tab-button= request.name || 'example ' + requestCount - each example in action.examples - each request in example.requests - .tab - +RequestResponseBody(request, false, true) - .tabs - .example-names - span Responses - each response in example.responses - span.tab-button= response.name - each response in example.responses - .tab - +RequestResponseBody(response, false, true) - else - each example in action.examples - .tabs - .example-names - span Responses - each response in example.responses - span.tab-button= response.name - each response in example.responses + .definition + span.method(class=action.methodLower)= action.method + |   + span.uri + span.hostname= self.api.host + != action.colorizedUriTemplate + .tabs + if action.hasRequest + .example-names + span Requests + - var requestCount = 0 + each example in action.examples + each request in example.requests + - requestCount++ + span.tab-button= request.name || 'example ' + requestCount + each example in action.examples + each request in example.requests .tab - +RequestResponseBody(response, false, true) + +RequestResponseBody(request, false, true) + .tabs + .example-names + span Responses + each response in example.responses + span.tab-button= response.name + each response in example.responses + .tab + +RequestResponseBody(response, false, true) + else + each example in action.examples + .tabs + .example-names + span Responses + each response in example.responses + span.tab-button= response.name + each response in example.responses + .tab + +RequestResponseBody(response, false, true) .middle .action(class=action.methodLower, id=action.elementId) h4.action-heading From 655991b9bb8cc2f67bb188ffa55749f1f524cb7f Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Mon, 21 Mar 2016 21:54:14 +0300 Subject: [PATCH 08/10] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 756ef136..4bd48f6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aglio-theme-kaiten", - "version": "1.6.5", + "version": "1.6.6", "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { From a69a5b17c002bed2a983353b93dfc9201c2084ef Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Tue, 22 Mar 2016 11:49:32 +0300 Subject: [PATCH 09/10] Constraints, v1.6.7 --- package.json | 2 +- templates/mixins.jade | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4bd48f6a..e582fd52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aglio-theme-kaiten", - "version": "1.6.6", + "version": "1.6.7", "description": "Kaiten theme for the Aglio API Blueprint renderer", "main": "lib/main.js", "scripts": { diff --git a/templates/mixins.jade b/templates/mixins.jade index 16df1ffb..d4cf88ba 100644 --- a/templates/mixins.jade +++ b/templates/mixins.jade @@ -98,7 +98,13 @@ mixin Parameters(params) code= self.urldec(value.value) = ' ' -mixin RequestResponse(title, request, collapse) +mixin Constraints(name, schema) + each constraint in ['minLength', 'maxLength', 'pattern'] + if schema.properties[name][constraint] + div #{constraint}: #{schema.properties[name][constraint]} + + +mixin RequestResponse(title, request, collapse, showSchema) .title strong = title @@ -109,9 +115,9 @@ mixin RequestResponse(title, request, collapse) .collapse-button span.close Hide span.open Show - +RequestResponseBody(request, collapse) + +RequestResponseBody(request, collapse, false, showSchema) -mixin RequestResponseBody(request, collapse, showBlank) +mixin RequestResponseBody(request, collapse, showBlank, showSchema) if request.hasContent || showBlank div(class=collapse ? 'collapse-content' : ''): .inner if request.description @@ -130,7 +136,7 @@ mixin RequestResponseBody(request, collapse, showBlank) pre: code != self.highlight(request.body, null, ['json', 'yaml', 'xml', 'javascript']) div(style="height: 1px;") - if request.schema + if showSchema && request.schema - var schema = JSON.parse(request.schema) table(style="width: 100%;") thead @@ -139,17 +145,20 @@ mixin RequestResponseBody(request, collapse, showBlank) th Type th Required th Description + th Constraints each description, name in schema.properties || [] tr td #{name} td #{description.type} td #{schema.required && schema.required.indexOf(name) >= 0 ? 'true' : ''} td #{description.description} + td + +Constraints(name, schema) div.title .collapse-button span.close Hide span.open Show - strong Schema + span Schema div.collapse-content: .inner pre: code != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) @@ -161,7 +170,7 @@ mixin RequestResponseBody(request, collapse, showBlank) mixin Examples(resourceGroup, resource, action) each example in action.examples each request in example.requests - +RequestResponse('Request', request, false) + +RequestResponse('Request', request, false, true) each response in example.responses +RequestResponse('Response', response, true) From 1c20fa3d0abad7d556f449998c1bdfed5f85d799 Mon Sep 17 00:00:00 2001 From: Igor Lobanov Date: Fri, 17 Mar 2017 09:11:00 +0300 Subject: [PATCH 10/10] https://github.com/danielgtaylor/aglio/pull/299 comments --- .npmignore | 1 + templates/index.jade | 2 +- templates/scripts.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index aee8224c..8f32cd36 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ coverage node_modules +src test npm-debug.log .travis.yml diff --git a/templates/index.jade b/templates/index.jade index 74fcb1e4..b6c2fe9f 100644 --- a/templates/index.jade +++ b/templates/index.jade @@ -12,7 +12,7 @@ html a.text-muted.back-to-top(href='#top') i.fa.fa-toggle-up |  Back to top - div(class='container-fluid') + div(class=self.fullWidth ? 'container-fluid' : 'container') .row block nav +Nav(false) diff --git a/templates/scripts.js b/templates/scripts.js index f4613ef3..d105df6c 100644 --- a/templates/scripts.js +++ b/templates/scripts.js @@ -217,7 +217,7 @@ function init() { init(); window.onload = function () { - // autoCollapse(); + autoCollapse(); // Remove the `preload` class to enable animations document.querySelector('body').className = ''; };