File tree Expand file tree Collapse file tree 3 files changed +77
-2
lines changed Expand file tree Collapse file tree 3 files changed +77
-2
lines changed Original file line number Diff line number Diff line change 1+ @extends (' webfactor::modal.modal_layout' )
2+
3+ @section (' header' )
4+ <h3 class =" box-title" >{{ trans (' backpack::crud.add_a_new' ) } } {{ $crud -> entity_name } } </h3 >
5+ @endsection
6+
7+ @section (' content' )
8+ <div class =" row" >
9+ <div class =" col-md-10 col-md-offset-1" >
10+ @include (' crud::inc.grouped_errors' )
11+
12+ <!-- load the view from the application if it exists, otherwise load the one in the package -->
13+ @if (view ()-> exists (' vendor.backpack.crud.form_content' ) )
14+ @include (' vendor.backpack.crud.form_content' , [' fields' => $crud -> getFields (' create' )] )
15+ @else
16+ @include (' crud::form_content' , [' fields' => $crud -> getFields (' create' )] )
17+ @endif
18+ </div >
19+ </div >
20+ @endsection
21+
22+ @section (' footer' )
23+ @include (' webfactor::modal.inc.form_save_buttons' )
24+ @endsection
25+
26+ @push (' crud_fields_scripts' )
27+ <script >
28+ $ (" #create_{{ $entity } }" ).submit (function (e ) {
29+
30+ $ .ajax ({
31+ type: " POST" ,
32+ url: " /{{ $crud -> route . ' /ajax' } }" ,
33+ data: $ (" #create_{{ $entity } }" ).serialize (), // serializes the form's elements.
34+ success : function (data ) {
35+ new PNotify ({
36+ type: " success" ,
37+ title: " Erfolg" ,
38+ text: " gespeichert"
39+ });
40+
41+ $ (" #{{ $entity } } _modal" ).modal (' toggle' );
42+ },
43+ error : function (data ) {
44+ new PNotify ({
45+ type: " error" ,
46+ title: " Fehler" ,
47+ text: " Nicht gespeichert: " + data .responseText
48+ });
49+ }
50+ });
51+
52+ e .preventDefault (); // avoid to execute the actual submit of the form.
53+ });
54+ </script >
55+
56+ @endpush
Original file line number Diff line number Diff line change 1+ @stack (' crud_fields_styles' )
2+ {!! Form:: open ([' id' => ' create_' . $entity , ' files' => $crud -> hasUploadFields (' create' )]) ! !}
3+ <div class =" modal-header" >
4+ <button type =" button" class =" close" data-dismiss =" modal" aria-label =" Close" >
5+ <span aria-hidden =" true" >× ; </span >
6+ </button >
7+ @yield (' header' )
8+ </div >
9+ <div class =" modal-body" id =" modal-body" >
10+ @yield (' content' )
11+ </div >
12+
13+ <div class =" modal-footer" >
14+ @yield (' footer' )
15+ </div >
16+ {!! Form:: close () ! !}
17+ @stack (' crud_fields_scripts' )
Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ class InstantFieldsServiceProvider extends ServiceProvider
1717 */
1818 public function boot ()
1919 {
20- // publish views
21- $ this ->publishes ([__DIR__ . '/../resources/views ' => resource_path ('views/vendor/backpack/crud ' )], 'views ' );
20+ $ this ->loadViewsFrom (realpath (__DIR__ . '/../resources/views ' ), 'webfactor ' );
21+
22+ // publish fields
23+ $ this ->publishes ([__DIR__ . '/../resources/views/fields ' => resource_path ('views/vendor/backpack/crud/fields ' )], 'fields ' );
2224 }
2325
2426 /**
You can’t perform that action at this time.
0 commit comments