Browse Source

Theme fixes

shalvah 4 years ago
parent
commit
d79be99702

+ 3 - 1
camel/Camel.php

@@ -150,7 +150,9 @@ class Camel
                 'description' => Arr::first($endpointsInGroup, function (ExtractedEndpointData $endpointData) {
                         return !empty($endpointData->metadata->groupDescription);
                     })->metadata->groupDescription ?? '',
-                'endpoints' => $sortedEndpoints->map(fn(ExtractedEndpointData $endpointData) => $endpointData->forSerialisation()->toArray())->values()->all(),
+                'endpoints' => $sortedEndpoints->map(
+                    fn(ExtractedEndpointData $endpointData) => $endpointData->forSerialisation()->toArray()
+                )->values()->all(),
             ];
         })->values()->all();
     }

+ 3 - 4
resources/views/components/body-parameters.blade.php

@@ -3,7 +3,8 @@
     @if($name === '[]')
         <p>
             Body: <code>{{ $parameter['type'] }}</code> {!! Parsedown::instance()->text($parameter['description'] ?? '') !!}
-            @foreach($parameter['__fields'] as $subfieldName => $subfield)
+        </p>
+        @foreach($parameter['__fields'] as $subfieldName => $subfield)
                 @if(!empty($subfield['__fields']))
                     @component('scribe::components.body-parameters', ['parameters' => [$subfieldName => $subfield], 'endpointId' => $endpointId,])
                     @endcomponent
@@ -22,11 +23,10 @@
                     </p>
                 @endif
             @endforeach
-        </p>
     @elseif(!empty($parameter['__fields']))
         <p>
         <details>
-            <summary>
+            <summary style="padding-bottom: 10px;">
                 @component('scribe::components.field-details', [
                   'name' => $parameter['name'],
                   'type' => $parameter['type'] ?? 'string',
@@ -38,7 +38,6 @@
                 ])
                 @endcomponent
             </summary>
-            <br>
             @foreach($parameter['__fields'] as $subfieldName => $subfield)
                 @if(!empty($subfield['__fields']))
                     @component('scribe::components.body-parameters', ['parameters' => [$subfieldName => $subfield], 'endpointId' => $endpointId,])

+ 3 - 2
resources/views/partials/example-requests/bash.md.blade.php

@@ -23,6 +23,7 @@ curl --request {{$endpoint->httpMethods[0]}} \
 @endforeach
 @endforeach
 @elseif(count($endpoint->cleanBodyParameters))
-    --data "{!! addslashes(json_encode($endpoint->cleanBodyParameters, JSON_UNESCAPED_UNICODE)) !!}"
+    --data "{!! addslashes(json_encode($endpoint->cleanBodyParameters, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)) !!}"
 @endif
-```
+
+```

+ 1 - 1
resources/views/themes/default/index.blade.php

@@ -30,7 +30,7 @@
 
 </head>
 
-<body class="" data-languages="{{ json_encode($metadata['example_languages'] ?? []) }}">
+<body data-languages="{{ json_encode($metadata['example_languages'] ?? []) }}">
 <a href="#" id="nav-button">
       <span>
         MENU

+ 0 - 1
src/Extracting/ApiDetails.php

@@ -52,7 +52,6 @@ class ApiDetails
         ConsoleOutputUtils::info('Extracted intro and auth Markdown files to: ' . $this->markdownOutputPath);
     }
 
-
     public function writeIntroMarkdownFile(): void
     {
         $introMarkdownFile = $this->markdownOutputPath . '/intro.md';

+ 3 - 2
src/Writing/HtmlWriter.php

@@ -94,8 +94,9 @@ class HtmlWriter
 
     protected function getMetadata(): array
     {
-        // NB:These paths are wrong for laravel type but will be set correctly by the Writer class
         $links = [];
+
+        // NB:These paths are wrong for laravel type but will be set correctly by the Writer class
         if ($this->config->get('postman.enabled', true)) {
             $links[] = '<a href="../docs/collection.json">View Postman collection</a>';
         }
@@ -120,7 +121,7 @@ class HtmlWriter
             'last_updated' => date("F j Y"),
             'auth' => $auth,
             'try_it_out' => $this->config->get('try_it_out'),
-            'links' => $links + ['<a href="http://github.com/knuckleswtf/scribe">Documentation powered by Scribe ✍</a>'],
+            'links' => array_merge($links, ['<a href="http://github.com/knuckleswtf/scribe">Documentation powered by Scribe ✍</a>']),
         ];
     }
 }