Skip to content

Commit

Permalink
Updated scalar view to support configuration using html_attributes co…
Browse files Browse the repository at this point in the history
…nfig
  • Loading branch information
TS1997 committed Feb 19, 2025
1 parent c5e5677 commit f4665c3
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions resources/views/external/scalar.blade.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
<!doctype html>
<html>

<head>
<title>{!! $metadata['title'] !!}</title>
<meta charset="utf-8"/>
<meta
name="viewport"
content="width=device-width, initial-scale=1"/>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
margin: 0;
}
</style>
</head>

<body>

<script
id="api-reference"
@foreach($htmlAttributes as $attribute => $value)
{{-- Attributes specified first override later ones --}}
{!! $attribute !!}="{!! $value !!}"
@endforeach
data-url="{!! $metadata['openapi_spec_url'] !!}">
</script>
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
<script id="api-reference" data-url="{!! $metadata['openapi_spec_url'] !!}"></script>
<script>
document.getElementById('api-reference').dataset.configuration = JSON.stringify({!! json_encode($htmlAttributes) !!});
</script>
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
</body>

</html>

0 comments on commit f4665c3

Please sign in to comment.