]> BookStack Code Mirror - bookstack/blob - resources/views/api-docs/index.blade.php
Refined docs view, Added example requests
[bookstack] / resources / views / api-docs / index.blade.php
1 @extends('simple-layout')
2
3 @section('body')
4
5     <div class="container pt-xl">
6
7         <div class="grid right-focus reverse-collapse">
8
9             <div>
10                 @foreach($docs as $model => $endpoints)
11                     <p class="text-uppercase text-muted mb-xm mt-l"><strong>{{ $model }}</strong></p>
12
13                     @foreach($endpoints as $endpoint)
14                         <div class="mb-xs">
15                             <a href="#{{ $endpoint['name'] }}" class="text-mono inline block mr-s">
16                                 <span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span>
17                             </a>
18                             <a href="#{{ $endpoint['name'] }}" class="text-mono">
19                                 {{ $endpoint['controller_method'] }}
20                             </a>
21                         </div>
22                     @endforeach
23                 @endforeach
24             </div>
25
26             <div style="overflow: auto;">
27                 @foreach($docs as $model => $endpoints)
28                     <section class="card content-wrap auto-height">
29                         <h1 class="list-heading text-capitals">{{ $model }}</h1>
30
31                         @foreach($endpoints as $endpoint)
32                             <h6 class="text-uppercase text-muted float right">{{ $endpoint['controller_method'] }}</h6>
33                             <h5 id="{{ $endpoint['name'] }}" class="text-mono mb-m">
34                                 <span class="api-method" data-method="{{ $endpoint['method'] }}">{{ $endpoint['method'] }}</span>
35                                 {{ url($endpoint['uri']) }}
36                             </h5>
37                             <p class="mb-m">{{ $endpoint['description'] ?? '' }}</p>
38                             @if($endpoint['body_params'] ?? false)
39                                 <details class="mb-m">
40                                     <summary class="text-muted">Body Parameters</summary>
41                                     <table class="table">
42                                         <tr>
43                                             <th>Param Name</th>
44                                             <th>Value Rules</th>
45                                         </tr>
46                                         @foreach($endpoint['body_params'] as $paramName => $rules)
47                                         <tr>
48                                             <td>{{ $paramName }}</td>
49                                             <td>
50                                                 @foreach($rules as $rule)
51                                                     <code class="mr-xs">{{ $rule }}</code>
52                                                 @endforeach
53                                             </td>
54                                         </tr>
55                                         @endforeach
56                                     </table>
57                                 </details>
58                             @endif
59                             @if($endpoint['example_request'] ?? false)
60                                 <details details-highlighter class="mb-m">
61                                     <summary class="text-muted">Example Request</summary>
62                                     <pre><code class="language-json">{{ $endpoint['example_request'] }}</code></pre>
63                                 </details>
64                             @endif
65                             @if($endpoint['example_response'] ?? false)
66                                 <details details-highlighter class="mb-m">
67                                     <summary class="text-muted">Example Response</summary>
68                                     <pre><code class="language-json">{{ $endpoint['example_response'] }}</code></pre>
69                                 </details>
70                             @endif
71                             @if(!$loop->last)
72                             <hr>
73                             @endif
74                         @endforeach
75                     </section>
76                 @endforeach
77             </div>
78
79         </div>
80
81
82     </div>
83 @stop