UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

112 lines (103 loc) 3.8 kB
<!doctype html> <!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> <title>raml-body-editor-panel demo</title> <script src="../../webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="../../arc-demo-helpers/raml-demo-page.html"> <link rel="import" href="../../font-roboto/roboto.html"> <link rel="import" href="../raml-body-editor-panel.html"> <style is="custom-style"> :root { --icon-button: { color: rgba(0, 0, 0, 0.54); transition: color 0.3s linear; } --icon-button-hover: { color: var(--accent-color); } } html, body { margin: 0; padding: 0; font-family: 'Roboto', 'Noto', sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-size: 14px; font-weight: 400; line-height: 20px; } raml-body-editor-panel { margin-bottom: 40px; } output { display: block; white-space: pre-wrap; word-break: break-all; } </style> </head> <body unresolved> <template is="dom-bind" id="app"> <raml-demo-page raml="{{raml}}" selected-object="{{selected}}" is-method="{{isMethod}}" path="{{path}}"> <paper-item data-url$="[[demoRaml]]">RAML 1.0 demo</paper-item> <paper-item data-url$="[[testCaseRaml]]">RAML 1.0 test case</paper-item> <paper-item data-url$="[[issue515Raml]]">Issue 515</paper-item> <h1>The raml-body-editor-panel element</h1> <div main> <template is="dom-if" if="[[isMethod]]"> <template is="dom-if" if="[[hasPayload]]"> <raml-body-editor-panel value="{{body}}" body="[[selected.body]]" content-type="{{contentType}}"></raml-body-editor-panel> <h4>Produced output</h4> <output>{{body}}</output> <h4>Content type</h4> <output>[[contentType]]</output> </template> <template is="dom-if" if="[[!hasPayload]]"> <p>Select method that can carry a body</p> </template> </template> <p hidden$="[[isMethod]]">Select a method</p> </div> </raml-demo-page> <paper-toast text="Methods are not supported in this demo." id="noMethods"></paper-toast> </template> <script> (function(scope) { scope.observers = ['_isMethodChanged(isMethod, selected)']; scope.hasPayload = false; scope._isMethodChanged = function(isMethod, selected) { if (isMethod && selected && selected.method) { if (['get', 'head'].indexOf(selected.method.toLowerCase()) === -1) { scope.hasPayload = true; } else { scope.hasPayload = false; } return; } scope.hasPayload = false; }; var path = location.pathname; if (~path.indexOf('.html')) { path = path.substr(0, path.lastIndexOf('/') + 1); } var ramlRoot = location.protocol + '//' + location.host + path.replace('demo', 'test'); scope.demoRaml = ramlRoot + 'demo.raml'; scope.testCaseRaml = ramlRoot + 'test.raml'; scope.issue515Raml = ramlRoot + 'issue-515/api.raml'; })(document.getElementById('app')); </script> </body> </html>