]> _ Git - cubist_cms-back.git/commitdiff
wait #4592 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Jul 2021 12:48:18 +0000 (14:48 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Jul 2021 12:48:18 +0000 (14:48 +0200)
src/app/Magic/Models/CubistMagicAbstractModel.php
src/resources/views/edit.blade.php
src/resources/views/form/additional_edit_views.blade.php [new file with mode: 0644]
src/resources/views/form/shortcuts.blade.php

index dc096a98fdc059071609af63bd24cb92916c816f..f6be1afcc4fd0b74b5f9beada687b6de80e1b49b 100644 (file)
@@ -84,6 +84,8 @@ class CubistMagicAbstractModel extends Model implements HasMedia
      */
     protected $fakeColumns = [];
 
+    protected $additionalEditViews=[];
+
 
     /**
      * @var array
@@ -854,6 +856,18 @@ class CubistMagicAbstractModel extends Model implements HasMedia
 
     }
 
+    /**
+     * @return array
+     */
+    public function getAdditionalEditViews(): array
+    {
+        return $this->additionalEditViews;
+    }
+
+    public function addAdditionalEditView($view){
+        $this->additionalEditViews[]=$view;
+    }
+
     public function preCache()
     {
         foreach ($this->getFields() as $field) {
index 370fe7a14fca2d1e59c0d47fa2cba0f973918be0..218c041289cd809bf938c709547faba2af0fc041 100644 (file)
@@ -1,4 +1,5 @@
 @extends(backpack_view('blank'))
+@include('cubist_back::form.additional_edit_views')
 
 @push('crud_fields_scripts')
     <script>
@@ -7,7 +8,7 @@
             // When clicking on a locale link in the dropdown menu, it doesn't preserve
             // the current tab because this is stored in the hash and managed by JS.
             // To overcome this, we catch the locale links and append the hash to them...
-            $(document).on('click', '.dropdown-menu a[href*="?locale="]', function(event) {
+            $(document).on('click', '.dropdown-menu a[href*="?locale="]', function (event) {
                 event.preventDefault();
                 window.location.href = $(this).attr('href') + document.location.hash;
             });
@@ -16,6 +17,7 @@
     </script>
 @endpush
 
+
 @include('cubist_back::when')
 
 
@@ -37,7 +39,9 @@
             <small>{!! $crud->getSubheading() ?? trans('backpack::crud.edit').' '.$crud->entity_name !!}.</small>
 
             @if ($crud->hasAccess('list'))
-                <small><a href="{{ url($crud->route) }}" class="hidden-print font-sm"><i class="la la-angle-double-{{ config('backpack.base.html_direction') == 'rtl' ? 'right' : 'left' }}"></i> {{ trans('backpack::crud.back_to_all') }} <span>{{ $crud->entity_name_plural }}</span></a></small>
+                <small><a href="{{ url($crud->route) }}" class="hidden-print font-sm"><i
+                            class="la la-angle-double-{{ config('backpack.base.html_direction') == 'rtl' ? 'right' : 'left' }}"></i> {{ trans('backpack::crud.back_to_all') }}
+                        <span>{{ $crud->entity_name_plural }}</span></a></small>
             @endif
         </h2>
     </section>
                     <div class="mb-2 text-right">
                         <!-- Single button -->
                         <div class="btn-group">
-                            <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                {{trans('backpack::crud.language')}}: {{ $crud->model->getAvailableLocales()[request()->input('locale')?request()->input('locale'):App::getLocale()] }} &nbsp; <span class="caret"></span>
+                            <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown"
+                                    aria-haspopup="true" aria-expanded="false">
+                                {{trans('backpack::crud.language')}}
+                                : {{ $crud->model->getAvailableLocales()[request()->input('locale')?request()->input('locale'):App::getLocale()] }}
+                                &nbsp; <span class="caret"></span>
                             </button>
                             <ul class="dropdown-menu">
                                 @foreach ($crud->model->getAvailableLocales() as $key => $locale)
-                                    <a class="dropdown-item" href="{{ url($crud->route.'/'.$entry->getKey().'/edit') }}?locale={{ $key }}">{{ $locale }}</a>
+                                    <a class="dropdown-item"
+                                       href="{{ url($crud->route.'/'.$entry->getKey().'/edit') }}?locale={{ $key }}">{{ $locale }}</a>
                                 @endforeach
                             </ul>
                         </div>
diff --git a/src/resources/views/form/additional_edit_views.blade.php b/src/resources/views/form/additional_edit_views.blade.php
new file mode 100644 (file)
index 0000000..8a479de
--- /dev/null
@@ -0,0 +1,3 @@
+@foreach($crud->entry->getAdditionalEditViews() as $v)
+    @include($v)
+@endforeach
index 1c47a258a79cf225ec23b078d0ff7e0b152a74a4..8b9406a5f476fd10b5bdf62ce6a59e0ac0b05c82 100644 (file)
@@ -1,25 +1,26 @@
 @section('form_shortcut_m')
     @stack('form_shortcuts')
 @endsection
+<div class="col-md-4">
+    <div id="form_sidebar">
+    @hasSection('form_shortcut_m')
+        <style type="text/css">
+            #form_sidebar {
+                position: sticky;
+                top: 30px;
+            }
 
-@hasSection('form_shortcut_m')
-    <style type="text/css">
-        #form_shortcuts {
-            position: sticky;
-            top: 30px;
-        }
+            #form_shortcuts .card {
+                padding: 30px;
+            }
 
-        #form_shortcuts .card {
-            padding: 30px;
-        }
+            #form_shortcuts a {
+                display: block;
+                font-size: 120%;
+                font-weight: 500;
+            }
+        </style>
 
-        #form_shortcuts a {
-            display: block;
-            font-size: 120%;
-            font-weight: 500;
-        }
-    </style>
-    <div class="col-md-4">
         <aside id="form_shortcuts">
             <div class="card">
                 <nav>
                 </nav>
             </div>
         </aside>
+
+    @endif
+
+    @hasSection('form_below_shortcuts')
+        @yield('form_below_shortcuts')
+    @endif
     </div>
-@endif
+</div>