|
1 | 1 | {% extends "ALSwaggerUIBundle::layout.html.twig" %} |
2 | | -{% block stylesheets %} |
3 | | - {{ parent() }} |
4 | | - <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/> |
| 2 | +{% block al_swagger_ui_stylesheets %} |
| 3 | + <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/> |
| 4 | + <link href="{{ asset('bundles/alswaggerui/css/reset.css') }}" |
| 5 | + type="text/css" |
| 6 | + rel="stylesheet" |
| 7 | + media="print" /> |
| 8 | + <link href="{{ asset('bundles/alswaggerui/css/screen.css') }}" |
| 9 | + type="text/css" |
| 10 | + rel="stylesheet" |
| 11 | + media="screen" /> |
| 12 | + <link href="{{ asset('bundles/alswaggerui/css/screen.css') }}" |
| 13 | + type="text/css" |
| 14 | + rel="stylesheet" |
| 15 | + media="print" /> |
5 | 16 | {% endblock %} |
6 | | -{% block javascripts %} |
7 | | - {{ parent() }} |
| 17 | +{% block al_swagger_ui_javascripts %} |
8 | 18 | <script src="{{ asset('bundles/alswaggerui/lib/shred.bundle.js') }}"></script> |
9 | 19 | <script src="{{ asset('bundles/alswaggerui/lib/jquery-1.8.0.min.js') }}"></script> |
10 | 20 | <script src="{{ asset('bundles/alswaggerui/lib/jquery.slideto.min.js') }}"></script> |
|
16 | 26 | <script src="{{ asset('bundles/alswaggerui/lib/swagger.js') }}"></script> |
17 | 27 | <script src="{{ asset('bundles/alswaggerui/js/swagger-ui.js') }}"></script> |
18 | 28 | <script src="{{ asset('bundles/alswaggerui/lib/highlight.7.3.pack.js') }}"></script> |
| 29 | + {% if auth_config.oauth.enable %} |
19 | 30 | <script src="{{ asset('bundles/alswaggerui/lib/swagger-oauth.js') }}"></script> |
20 | | - <script type="text/javascript"> |
21 | | - $(function () { |
22 | | - window.swaggerUi = new SwaggerUi({ |
23 | | - url: {{ resource_list_url|json_encode|raw }}, |
24 | | - dom_id: "swagger-ui-container", |
25 | | - supportedSubmitMethods: {{ js_config.supported_submit_methods|json_encode|raw }}, |
26 | | - onComplete: function(swaggerApi, swaggerUi){ |
27 | | - log("Loaded SwaggerUI"); |
| 31 | + {% endif %} |
| 32 | +<script type="text/javascript"> |
| 33 | + $(function () { |
| 34 | + window.swaggerUi = new SwaggerUi({ |
| 35 | + url: {{ resource_list_url|json_encode|raw }}, |
| 36 | + dom_id: "swagger-ui-container", |
| 37 | + supportedSubmitMethods: {{ js_config.supported_submit_methods|json_encode|raw }}, |
| 38 | + onComplete: function(swaggerApi, swaggerUi){ |
| 39 | + log("Loaded SwaggerUI"); |
28 | 40 |
|
29 | | - if(typeof initOAuth == "function") { |
30 | | - /* |
31 | | - initOAuth({ |
32 | | - clientId: "your-client-id", |
33 | | - realm: "your-realms", |
34 | | - appName: "your-app-name" |
35 | | - }); |
36 | | - */ |
37 | | - } |
38 | | - $('pre code').each(function(i, e) { |
39 | | - hljs.highlightBlock(e) |
40 | | - }); |
41 | | - }, |
42 | | - onFailure: function(data) { |
43 | | - log("Unable to Load SwaggerUI"); |
44 | | - }, |
45 | | - docExpansion: {{ js_config.expansion|json_encode|raw }}, |
46 | | - sorter: {{ js_config.sorter|json_encode|raw }}, |
47 | | - booleanValues: {{ js_config.boolean_values|json_encode|raw }}, |
48 | | - highlightSizeThreshold: {{ js_config.highlight_size_threshold|json_encode|raw }} |
49 | | - }); |
| 41 | + if(typeof initOAuth == "function") { |
50 | 42 |
|
51 | | - /* $('#input_apiKey').change(function() { |
52 | | - var key = $('#input_apiKey')[0].value; |
53 | | - log("key: " + key); |
54 | | - if(key && key.trim() != "") { |
55 | | - log("added key " + key); |
56 | | - window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query")); |
| 43 | + initOAuth({ |
| 44 | + clientId: {{ auth_config.oauth.client_id|json_encode|raw }}, |
| 45 | + realm: {{ auth_config.oauth.realm|json_encode|raw }}, |
| 46 | + appName: {{ auth_config.oauth.app_name|json_encode|raw }} |
| 47 | + }); |
57 | 48 | } |
58 | | - }) */ |
59 | | - window.swaggerUi.load(); |
| 49 | + $('pre code').each(function(i, e) { |
| 50 | + hljs.highlightBlock(e) |
| 51 | + }); |
| 52 | + }, |
| 53 | + onFailure: function(data) { |
| 54 | + log("Unable to Load SwaggerUI"); |
| 55 | + }, |
| 56 | + docExpansion: {{ js_config.expansion|json_encode|raw }}, |
| 57 | + sorter: {{ js_config.sorter|json_encode|raw }}, |
| 58 | + booleanValues: {{ js_config.boolean_values|json_encode|raw }}, |
| 59 | + highlightSizeThreshold: {{ js_config.highlight_size_threshold|json_encode|raw }} |
60 | 60 | }); |
61 | | - </script> |
| 61 | +
|
| 62 | + {% if auth_config.http.enable %} |
| 63 | + $('#input_apiKey').change(function() { |
| 64 | + var key = $('#input_apiKey')[0].value; |
| 65 | + log("key: " + key); |
| 66 | + if(key && key.trim() != "") { |
| 67 | + log("added key " + key); |
| 68 | + window.authorizations.add("key", new ApiKeyAuthorization({{ auth_config.http.key_name|json_encode|raw }}, key, {{ auth_config.http.delivery|json_encode|raw }})); |
| 69 | + } |
| 70 | + }); |
| 71 | + {% endif %} |
| 72 | + window.swaggerUi.load(); |
| 73 | + }); |
| 74 | +</script> |
62 | 75 | {% endblock %} |
63 | 76 | {% block al_swagger_ui_auth_form %} |
64 | 77 | {% endblock %} |
|
0 commit comments