jqh %!s(int64=5) %!d(string=hai) anos
pai
achega
ba82308438
Modificáronse 5 ficheiros con 19 adicións e 8 borrados
  1. 0 4
      phpunit.dusk.xml
  2. 1 1
      src/Form.php
  3. 1 1
      src/Form/EmbeddedForm.php
  4. 16 1
      src/Form/Field/Divide.php
  5. 1 1
      src/Widgets/Form.php

+ 0 - 4
phpunit.dusk.xml

@@ -13,10 +13,6 @@
             <directory suffix="Test.php">./tests/Browser</directory>
         </testsuite>
 
-        <testsuite name="Unit">
-            <directory suffix="Test.php">./tests/Unit</directory>
-        </testsuite>
-
         <testsuite name="Feature">
             <directory suffix="Test.php">./tests/Feature</directory>
         </testsuite>

+ 1 - 1
src/Form.php

@@ -58,7 +58,7 @@ use Symfony\Component\HttpFoundation\Response;
  * @method Field\SwitchField            switch($column, $label = '')
  * @method Field\Display                display($column, $label = '')
  * @method Field\Rate                   rate($column, $label = '')
- * @method Field\Divide                 divider()
+ * @method Field\Divide                 divider(string $title = null)
  * @method Field\Password               password($column, $label = '')
  * @method Field\Decimal                decimal($column, $label = '')
  * @method Field\Html                   html($html, $label = '')

+ 1 - 1
src/Form/EmbeddedForm.php

@@ -38,7 +38,7 @@ use Illuminate\Support\Collection;
  * @method Field\SwitchField            switch($column, $label = '')
  * @method Field\Display                display($column, $label = '')
  * @method Field\Rate                   rate($column, $label = '')
- * @method Field\Divide                 divider()
+ * @method Field\Divide                 divider(string $title = null)
  * @method Field\Password               password($column, $label = '')
  * @method Field\Decimal                decimal($column, $label = '')
  * @method Field\Html                   html($html, $label = '')

+ 16 - 1
src/Form/Field/Divide.php

@@ -6,8 +6,23 @@ use Dcat\Admin\Form\Field;
 
 class Divide extends Field
 {
+    public function __construct($label = null)
+    {
+        $this->label = $label;
+    }
+
     public function render()
     {
-        return '<hr>';
+        if (! $this->label) {
+            return '<hr/>';
+        }
+
+        return <<<HTML
+<div class="mt-2 text-center" style="height: 20px; border-bottom: 1px solid #eee; margin-bottom: 25px">
+  <span style="font-size: 16px; background-color: #ffffff; padding: 0 10px;">
+    {$this->label}
+  </span>
+</div>
+HTML;
     }
 }

+ 1 - 1
src/Widgets/Form.php

@@ -57,7 +57,7 @@ use Illuminate\Validation\Validator;
  * @method Field\SwitchField         switch($column, $label = '')
  * @method Field\Display             display($column, $label = '')
  * @method Field\Rate                rate($column, $label = '')
- * @method Field\Divide              divider()
+ * @method Field\Divide              divider(string $title = null)
  * @method Field\Password            password($column, $label = '')
  * @method Field\Decimal             decimal($column, $label = '')
  * @method Field\Html                html($html, $label = '')