]> _ Git - pmi.git/commitdiff
wip #2843 @14
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Jun 2019 19:19:37 +0000 (21:19 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Jun 2019 19:19:37 +0000 (21:19 +0200)
15 files changed:
app/Http/Controllers/Admin/PageCrudController.php [new file with mode: 0644]
app/Http/Controllers/Admin/ProductCrudController.php
app/Http/Controllers/Admin/ProductTypeCrudController.php
app/Http/Controllers/Admin/SettingsCrudController.php [new file with mode: 0644]
app/Http/Controllers/Admin/SpecificationCrudController.php
app/Models/Category.php [deleted file]
app/Models/Producttype.php
app/Models/Settings.php [new file with mode: 0644]
app/SubForms/HomeSolution.php [new file with mode: 0644]
app/SubForms/Logo.php [new file with mode: 0644]
app/Templates/Base.php
app/Templates/Home.php
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php
routes/backpack/custom.php
update

diff --git a/app/Http/Controllers/Admin/PageCrudController.php b/app/Http/Controllers/Admin/PageCrudController.php
new file mode 100644 (file)
index 0000000..cdee2ba
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
+
+class PageCrudController extends CubistMagicController
+{
+    protected $_modelNamespace = 'App\Models\Page';
+    protected $_routeURL = 'page';
+    protected $_singular = 'page';
+    protected $_plural = 'pages';
+    protected $_clonable = true;
+    protected $_bulk = true;
+    protected $_oneInstance= false;
+}
index cae233a4ed99eb9d05a2641e95f49f4019b4e980..3ed321eb15bd63630e1f17481c7ba160cb06d730 100644 (file)
@@ -12,4 +12,5 @@ class ProductCrudController extends CubistMagicController
     protected $_plural = 'produits';
     protected $_clonable = true;
     protected $_bulk = true;
+    protected $_oneInstance= false;
 }
index 883dfeed340ea951eee6e2b93662f3fdeea4e89e..bc190302da1de0bc2c5f81885d6166be64620e02 100644 (file)
@@ -12,4 +12,5 @@ class ProductTypeCrudController extends CubistMagicController
     protected $_plural = 'types de produit';
     protected $_clonable = true;
     protected $_bulk = true;
+    protected $_oneInstance= false;
 }
diff --git a/app/Http/Controllers/Admin/SettingsCrudController.php b/app/Http/Controllers/Admin/SettingsCrudController.php
new file mode 100644 (file)
index 0000000..3853d0b
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
+
+class SettingsCrudController extends CubistMagicController
+{
+    protected $_modelNamespace = 'App\Models\Settings';
+    protected $_routeURL = 'settings';
+    protected $_singular = 'paramètre';
+    protected $_plural = 'paramètres';
+    protected $_clonable = true;
+    protected $_bulk = true;
+    protected $_oneInstance= true;
+}
index 0eddf875319159026a0632fb119436188c36a3d9..9dbac29ab2279c4bc45acf9d451c0e8ad5bd255a 100644 (file)
@@ -12,4 +12,5 @@ class SpecificationCrudController extends CubistMagicController
     protected $_plural = 'spécifications';
     protected $_clonable = true;
     protected $_bulk = true;
+    protected $_oneInstance= false;
 }
diff --git a/app/Models/Category.php b/app/Models/Category.php
deleted file mode 100644 (file)
index 99b94ae..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Cubist\Backpack\app\Magic\Models\CubistMagicNestedModel;
-
-class Category extends CubistMagicNestedModel
-{
-    protected $table = 'catalog_categories';
-
-    protected $_options = ['name' => 'category',
-        'singular' => 'catégorie',
-        'plural' => 'catégories',
-        'route' => 'catalog_category'];
-
-    public function setFields()
-    {
-        parent::setFields();
-
-        $this->addField(['name' => 'name',
-            'label' => 'Category name',
-            'type' => 'Text',
-            'column' => true]);
-
-        $this->addField(['name' => 'slug',
-                'type' => 'Slug',
-                'label' => 'Slug',
-                'column' => true]
-        );
-    }
-}
index 4838b426cc9c360fbaeec5e893c240cb015cfc4b..f7b2793be46a70ab808ae0ad939e42656e01782a 100644 (file)
@@ -30,12 +30,6 @@ class ProductType extends CubistMagicModel
             ]
         );
 
-        $this->addField(['name' => 'featured_on_home',
-            'label' => 'Mis en avant sur la page d\'accueil',
-            'type' => 'Checkbox',
-            'column' => false,
-            'default' => 1]);
-
         $this->addField(['name' => 'specifications',
             'label' => 'Spécifications',
             'type' => 'SelectFromModel',
diff --git a/app/Models/Settings.php b/app/Models/Settings.php
new file mode 100644 (file)
index 0000000..6015d41
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+
+
+namespace App\Models;
+
+
+class Settings extends \Cubist\Backpack\app\Magic\Models\Settings
+{
+public function setFields()
+{
+    parent::setFields();
+
+}
+}
diff --git a/app/SubForms/HomeSolution.php b/app/SubForms/HomeSolution.php
new file mode 100644 (file)
index 0000000..3f76ffe
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+
+namespace App\SubForms;
+
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class HomeSolution extends SubForm
+{
+    public function init()
+    {
+        parent::init();
+        $this->addField(['name' => 'title',
+            'label' => 'Titre',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'image',
+            'label' => 'Image',
+            'type' => 'Images']);
+        $this->addField(['name' => 'page',
+            'label' => 'Lien vers',
+            'type' => 'SelectFromModel',
+            'optionsmodel' => 'App\Models\Page']);
+    }
+}
diff --git a/app/SubForms/Logo.php b/app/SubForms/Logo.php
new file mode 100644 (file)
index 0000000..aa33c9c
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+
+namespace App\SubForms;
+
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class Logo extends SubForm
+{
+    public function init()
+    {
+        parent::init();
+
+        $this->addField(['name' => 'title',
+            'label' => 'Nom / Titre',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'url',
+            'type' => 'URL',
+            'label' => 'Lien vers le site']);
+
+        $this->addField(['name' => 'logo',
+            'type' => 'Images',
+            'label' => 'logo']);
+    }
+}
index 3389dd9d0466753a4635b8c449417ea9782b4396..96a55ddd7f0297e33f893a50f692cae3005cd01c 100644 (file)
@@ -15,7 +15,7 @@ class Base extends TemplateAbstract
             'type' => 'BunchOfFields',
             'bunch' => 'App\SubForms\Intro',
             'label' => __('Introduction'),
-            'tab' => 'Contenus',
+            'tab' => 'Intro',
         ]);
 
     }
index 29487325d260baf668a20e4bf06c972fb97481d7..3626460a369d0d8e6e570eade5848b37203403bd 100644 (file)
@@ -19,12 +19,47 @@ class Home extends Base
     public function init()
     {
         parent::init();
+
         $this->addField([
             'name' => 'slideshow',
-            'type' => 'BunchOfFields',
+            'type' => 'BunchOfFieldsMultiple',
             'bunch' => 'App\SubForms\Slide',
             'label' => __('Slideshow'),
-            'tab' => 'Contenus',
+            'tab' => 'Slideshow',
+        ]);
+
+        $this->addField([
+            'name' => 'services_support',
+            'type' => 'BunchOfFields',
+            'bunch' => 'App\SubForms\Intro',
+            'label' => __('Bloc « Services & Support »'),
+            'tab' => 'Services & Support',
         ]);
+
+        $this->addField(['name' => 'products_capteurs',
+            'type' => 'SelectFromModel',
+            'optionsmodel' => 'App\Models\ProductType',
+            'label' => 'Capteurs',
+            'tab' => 'Produits',
+            'multiple' => true]);
+
+        $this->addField(['name' => 'solutions',
+            'type'=>'BunchOfFieldsMultiple',
+            'bunch'=>'App\SubForms\HomeSolution',
+            'label'=>'Solutions',
+            'tab' => 'Solutions / Applications']);
+
+        $this->addField(['name' => 'products_systems',
+            'type' => 'SelectFromModel',
+            'optionsmodel' => 'App\Models\ProductType',
+            'label' => 'Systèmes de mesure',
+            'tab' => 'Produits',
+            'multiple' => true]);
+
+        $this->addField(['name' => 'logos',
+            'type' => 'BunchOfFieldsMultiple',
+            'bunch' => 'App\SubForms\Logo',
+            'label' => 'Logos',
+            'tab' => 'Clients']);
     }
 }
index 3b12ecb20fcc9dcebebc441ae16b8e3d34e67f3b..360625a468936cd3698aab618945dad3bbcb5f3b 100644 (file)
@@ -28,7 +28,7 @@
             </li>
         @endcan
         @can('backpack_settings')
-            <li><a href='{{ backpack_url('setting') }}'><i class='fa fa-cog'></i> <span>Settings</span></a></li>
+            <li><a href='{{ backpack_url('settings') }}'><i class='fa fa-cog'></i> <span>Paramètres</span></a></li>
         @endcan
     @endcan
     <li class="header">Édition du catalogue de produits</li>
                 </li>
             </ul>
         </li>
-        <li class="header">Backpack administration</li>
-        <li><a href='{{ backpack_url('template') }}'><i class='fa fa-file'></i> <span>Templates</span></a></li>
-        <li><a href='{{ backpack_url('subform') }}'><i class='fa fa-wpforms'></i> <span>Sub Forms</span></a></li>
-        <li><a href='{{ backpack_url('model') }}'><i class='fa fa-database'></i> <span>Models</span></a></li>
         <li class="header">Maintenance</li>
         <li><a href='{{ backpack_url('backup') }}'><i class='fa fa-hdd-o'></i> <span>Backups</span></a></li>
         <li><a href='{{ backpack_url('log') }}'><i class='fa fa-terminal'></i> <span>Logs</span></a></li>
index 84591e82a919e304421a0fd85f67c2131c89eb78..7ec9638a0d711e25c79a804301a8c49a782af1a9 100644 (file)
@@ -4,10 +4,10 @@ Route::group([
     'middleware' => ['web', config('backpack.base.middleware_key', 'admin')],
     'namespace'  => 'App\Http\Controllers\Admin',
 ], function () { // custom admin routes
-    CRUD::resource('catalog_category', 'CategoryCrudController')->with(function () {
-        Route::match(['post'], 'catalog_category/{id}/media', 'CategoryCrudController@uploadMedia');
-        Route::match(['delete'], 'catalog_category/{id}/media/{mediaId}', 'CategoryCrudController@deleteMedia');
-        Route::match(['post'], 'catalog_category/{id}/media/reorder', 'CategoryCrudController@reorderMedia');
+    CRUD::resource('page', 'PageCrudController')->with(function () {
+        Route::match(['post'], 'page/{id}/media', 'PageCrudController@uploadMedia');
+        Route::match(['delete'], 'page/{id}/media/{mediaId}', 'PageCrudController@deleteMedia');
+        Route::match(['post'], 'page/{id}/media/reorder', 'PageCrudController@reorderMedia');
     });
     CRUD::resource('product', 'ProductCrudController')->with(function () {
         Route::match(['post'], 'product/{id}/media', 'ProductCrudController@uploadMedia');
@@ -19,6 +19,11 @@ Route::group([
         Route::match(['delete'], 'producttype/{id}/media/{mediaId}', 'ProductTypeCrudController@deleteMedia');
         Route::match(['post'], 'producttype/{id}/media/reorder', 'ProductTypeCrudController@reorderMedia');
     });
+    CRUD::resource('settings', 'SettingsCrudController')->with(function () {
+        Route::match(['post'], 'settings/{id}/media', 'SettingsCrudController@uploadMedia');
+        Route::match(['delete'], 'settings/{id}/media/{mediaId}', 'SettingsCrudController@deleteMedia');
+        Route::match(['post'], 'settings/{id}/media/reorder', 'SettingsCrudController@reorderMedia');
+    });
     CRUD::resource('specification', 'SpecificationCrudController')->with(function () {
         Route::match(['post'], 'specification/{id}/media', 'SpecificationCrudController@uploadMedia');
         Route::match(['delete'], 'specification/{id}/media/{mediaId}', 'SpecificationCrudController@deleteMedia');
diff --git a/update b/update
index 9a8e97bc918436e65c4b49951de83650b1ac878e..31f266cba992f3bdf67ecaf70c573121c7c7f409 100644 (file)
--- a/update
+++ b/update
@@ -2,9 +2,9 @@
 <?php
 echo `composer update -v --no-progress --profile --prefer-dist`;
 echo `composer dump-autoload`;
-echo `php artisan config:cache`;
-echo `php artisan view:clear`;
-echo `php artisan view:cache`;
+//echo `php artisan config:cache`;
+//echo `php artisan view:clear`;
+//echo `php artisan view:cache`;
 #`php artisan vendor:publish --provider="CubistBackpackServiceProvider"`;
 // Database migrations
 //`php artisan vendor:publish --tag=migrations`;