Skip to content

Commit 81e2317

Browse files
authored
Merge pull request #5828 from Laravel-Backpack/fix-crud-fields-script-issue
fix crud field javacript issue
2 parents 10e333a + a6118f7 commit 81e2317

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/resources/views/crud/create.blade.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141
enctype="multipart/form-data"
4242
@endif
4343
>
44-
{!! csrf_field() !!}
45-
{{-- load the view from the application if it exists, otherwise load the one in the package --}}
46-
@if(view()->exists('vendor.backpack.crud.form_content'))
47-
@include('vendor.backpack.crud.form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ])
48-
@else
49-
@include('crud::form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ])
50-
@endif
51-
{{-- This makes sure that all field assets are loaded. --}}
52-
<div class="d-none" id="parentLoadedAssets">{{ json_encode(Basset::loaded()) }}</div>
53-
@include('crud::inc.form_save_buttons')
44+
{!! csrf_field() !!}
45+
{{-- load the view from the application if it exists, otherwise load the one in the package --}}
46+
@if(view()->exists('vendor.backpack.crud.form_content'))
47+
@include('vendor.backpack.crud.form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ])
48+
@else
49+
@include('crud::form_content', [ 'fields' => $crud->fields(), 'action' => 'create' ])
50+
@endif
51+
{{-- This makes sure that all field assets are loaded. --}}
52+
<div class="d-none" id="parentLoadedAssets">{{ json_encode(Basset::loaded()) }}</div>
53+
@include('crud::inc.form_save_buttons')
5454
</form>
5555
</div>
5656
</div>

src/resources/views/crud/form_content.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
@endpush
2424

25+
@push('before_scripts')
26+
@include('crud::inc.form_fields_script')
27+
@endpush
28+
2529
@push('after_scripts')
2630

2731
{{-- CRUD FORM CONTENT - crud_fields_scripts stack --}}
@@ -287,6 +291,4 @@ function preventUnload(event) {
287291
}
288292
});
289293
</script>
290-
291-
@include('crud::inc.form_fields_script')
292294
@endpush

src/resources/views/crud/inc/form_fields_script.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class CrudField {
187187
window.crud = {
188188
...window.crud,
189189
190-
action: "{{ $action ?? "" }}",
190+
action: "{{ $action ?? '' }}",
191191
192192
// Subfields callbacks holder
193193
subfieldsCallbacks: [],

0 commit comments

Comments
 (0)