Make CSS preloadable, move some CSS out of header

This commit is contained in:
Katharina Bogad 2021-06-24 11:54:25 +02:00
parent 9dab8a502f
commit 77e365985f
5 changed files with 27 additions and 21 deletions

View File

@ -252,7 +252,7 @@ class GrocyClass
}
}
PreloadView(viewName, cb = () => { })
PreloadView(viewName, loadCSS = false, cb = () => { })
{
if (!Object.prototype.hasOwnProperty.call(window, viewName + "View"))
{
@ -262,6 +262,14 @@ class GrocyClass
url: this.FormatUrl('/viewjs/' + viewName + '.js'),
success: cb
});
if (loadCSS)
{
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: this.FormatUrl('/css/viewcss/' + viewName + '.cs')
}).appendTo("head");
}
}
else
{

View File

@ -11,4 +11,16 @@
}
#barcodescanner-livestream canvas {
width: 100%;
}
#barcodescanner-start-button {
position: absolute;
right: 0;
margin-top: 4px;
margin-right: 5px;
cursor: pointer;
}
.combobox-container #barcodescanner-start-button {
margin-right: 36px !important;
}

View File

@ -1,19 +0,0 @@
@if (!GROCY_DISABLE_BROWSER_BARCODE_CAMERA_SCANNING)
@push('pageStyles')
<style>
#barcodescanner-start-button {
position: absolute;
right: 0;
margin-top: 4px;
margin-right: 5px;
cursor: pointer;
}
.combobox-container #barcodescanner-start-button {
margin-right: 36px !important;
}
</style>
@endpush
@endif

View File

@ -0,0 +1,5 @@
@php
// this is a shoe-horned method to generate a "proper" subview as JSON.
@endphp

View File

@ -21,7 +21,7 @@
RecipePictureFileName: '{{ $recipe->picture_file_name }}',
@endif
@stop
@endsection
@section('content')
<div class="row">