]> _ Git - cubist_cms-back.git/commitdiff
wip #4627 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 29 Jul 2021 09:45:20 +0000 (11:45 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 29 Jul 2021 09:45:20 +0000 (11:45 +0200)
src/app/Magic/Controllers/CubistMagicController.php
src/app/Magic/Fields/Field.php
src/app/Magic/Models/CubistMagicAbstractModel.php
src/app/Magic/Models/Translate.php
src/resources/views/create.blade.php
src/resources/views/edit.blade.php

index 971159ab7345fafca2f5ef89a57d115c5618b20b..b8196e0ffb2b107768b7e35a80b236e76a6bcc48 100644 (file)
@@ -76,6 +76,9 @@ class CubistMagicController extends CubistCrudController
             }
         }
 
+        if (!$model->isRevisionEnabled()) {
+            $this->revisionEnabled = false;
+        }
 
         $this->crud->setRoute(backpack_url($this->_routeURL));
         $this->crud->setEntityNameStrings(__($this->_singular), __($this->_plural));
index 42caacda3246b320d185be3358de0c6932124c65..12a9f4b1d23074268933e36b9e663d86a89b9521 100644 (file)
@@ -107,7 +107,11 @@ class Field implements \ArrayAccess
     public function getDatabaseType()
     {
         if ($this->getAttribute('translatable')) {
-            return 'text';
+            if ($this->_databaseType === 'text') {
+                return 'longtext';
+            } else {
+                return 'text';
+            }
         }
         return $this->_databaseType;
     }
index 2627e612e1af627583bb9eee8f1b059ec3badbe6..d4a3b18b4c1fb2022fa0a08f2b2e70b7e5f52332 100644 (file)
@@ -45,7 +45,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia
         addField as protected bunchAddField;
     }
 
-    protected static $_doctrineTypesMapping = ['int' => 'integer'];
+    protected static $_doctrineTypesMapping = ['int' => 'integer', 'longtext' => 'blob'];
 
     protected $connection = null;
     protected $primaryKey = 'id';
@@ -118,11 +118,14 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     public function __construct(array $attributes = [])
     {
         $this->setup();
+
         parent::__construct($attributes);
+
     }
 
     public function setup()
     {
+        $this->revisionEnabled = $this->_enableRevisions;
         if (null !== $this->connection) {
             $this->setConnection($this->connection);
         }
@@ -391,6 +394,11 @@ class CubistMagicAbstractModel extends Model implements HasMedia
         return $res;
     }
 
+    public function isRevisionEnabled()
+    {
+        return $this->_enableRevisions;
+    }
+
     protected function _replaceInCode($stub, $dest)
     {
         $singular = $this->getOption('singular', $this->getOption('name'));
index ecab8b112b7111ff56a50d615432d74637bd42ca..98af49dc13895d5c090b2aa8e3d6cb706c8a9b33 100644 (file)
@@ -81,8 +81,8 @@ class Translate extends CubistMagicTranslatableModel
      */
     public function onBeforeUpdate($controller, $request)
     {
-        $this->saveLanguageFile($controller, $request);
-        parent::onBeforeUpdate($controller, $request); // TODO: Change the autogenerated stub
+        $this->saveLanguageFile();
+        parent::onBeforeUpdate($controller, $request);
     }
 
 
@@ -130,4 +130,9 @@ class Translate extends CubistMagicTranslatableModel
 
         return parent::_sortLocales($a, $b);
     }
+
+    public function getKey()
+    {
+        return 1;
+    }
 }
index e66385259f82952973c20a6e2586d05bc12193cb..9fc72e5c15adcd8b15a8ac5e1360373707b8fd30 100644 (file)
@@ -54,5 +54,7 @@
         @include('cubist_back::form.shortcuts')
     </div>
 
+    @stack('after_form')
+
 @endsection
 
index de543865fadd4b82c76efbd4853393c84ed398c1..dffd5ad86d4a2d05745a9fefeaaaf3ec3c4f2a16 100644 (file)
@@ -93,5 +93,7 @@
         </div>
         @include('cubist_back::form.shortcuts')
     </div>
+
+    @stack('after_form')
 @endsection