[WIP] Refactor project

This commit is contained in:
Ludovic CANDELLIER
2021-05-21 00:21:05 +02:00
parent 4ce0fa942d
commit b50f50ea62
347 changed files with 14104 additions and 1608 deletions

View File

@@ -1,12 +1,12 @@
(function(window,$){
$(function(){
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} = window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} || {};
$.ajaxSetup({headers: {'X-CSRF-TOKEN': '{{csrf_token()}}'}});
window.LaravelDataTables = window.LaravelDataTables || {};
@foreach($editors as $editor)
var {{$editor->instance}} = window.LaravelDataTables["%1$s-{{$editor->instance}}"] = new $.fn.dataTable.Editor({!! $editor->toJson() !!});
var {{$editor->instance}} = window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}["%1$s-{{$editor->instance}}"] = new $.fn.dataTable.Editor({!! $editor->toJson() !!});
{!! $editor->scripts !!}
@foreach ((array) $editor->events as $event)
{{$editor->instance}}.on('{!! $event['event'] !!}', {!! $event['script'] !!});
@endforeach
@endforeach
window.LaravelDataTables["%1$s"] = $("#%1$s").DataTable(%2$s);
})(window,jQuery);
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}["%1$s"] = $("#%1$s").DataTable(%2$s);
});

View File

@@ -0,0 +1,14 @@
window.dtx = window.dtx || {};
window.dtx["%1$s"] = function(opts) {
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} = window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} || {};
@if(isset($editors))
@foreach($editors as $editor)
var {{$editor->instance}} = window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}["%1$s-{{$editor->instance}}"] = new $.fn.dataTable.Editor({!! $editor->toJson() !!});
{!! $editor->scripts !!}
@foreach ((array) $editor->events as $event)
{{$editor->instance}}.on('{!! $event['event'] !!}', {!! $event['script'] !!});
@endforeach
@endforeach
@endif
return window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}["%1$s"] = $("#%1$s").DataTable($.extend(%2$s, opts));
}

View File

@@ -1,6 +1,6 @@
window.LaravelDataTables = window.LaravelDataTables || {};
window.LaravelDataTables.options = %2$s
window.LaravelDataTables.editors = [];
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} = window.{{ config('datatables-html.namespace', 'LaravelDataTables') }} || {};
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}.options = %2$s
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}.editors = [];
@foreach($editors as $editor)
window.LaravelDataTables.editors["{{$editor->instance}}"] = {!! $editor->toJson() !!}
window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}.editors["{{$editor->instance}}"] = {!! $editor->toJson() !!}
@endforeach

View File

@@ -15,7 +15,7 @@
<body>
<table class="table table-bordered table-condensed table-striped">
@foreach($data as $row)
@if ($row == reset($data))
@if ($loop->first)
<tr>
@foreach($row as $key => $value)
<th>{!! $key !!}</th>

View File

@@ -1 +1 @@
(function(window,$){window.LaravelDataTables=window.LaravelDataTables||{};window.LaravelDataTables["%1$s"]=$("#%1$s").DataTable(%2$s);})(window,jQuery);
$(function(){window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}=window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}||{};window.{{ config('datatables-html.namespace', 'LaravelDataTables') }}["%1$s"]=$("#%1$s").DataTable(%2$s);});