jqh 5 лет назад
Родитель
Сommit
d2e72a7429

+ 11 - 2
resources/views/filter/checkbox.blade.php

@@ -3,8 +3,17 @@
         $checkbox = new \Dcat\Admin\Widgets\Checkbox($name, $options);
         if ($inline) $checkbox->inline();
 
-        $checkbox->checked(request($name, is_null($value) ? [] : $value));
+        $checkbox->checked(request($name, is_null($value) ? [] : $value))->circle(false);
 
     @endphp
-    {!! $checkbox !!}
+    @if($showLabel)
+        <div class="pull-left" style="margin-top: 6px;margin-right: 15px;">
+            <b>{{ $label }}</b>
+        </div>
+        <div class="pull-left">
+            {!! $checkbox !!}
+        </div>
+    @else
+        {!! $checkbox !!}
+    @endif
 </div>

+ 10 - 1
resources/views/filter/radio.blade.php

@@ -6,5 +6,14 @@
         $radio->checked(request($name, is_null($value) ? [] : $value));
 
     @endphp
-    {!! $radio !!}
+    @if($showLabel)
+        <div class="pull-left" style="margin-top: 6px;margin-right: 15px;">
+            <b>{{ $label }}</b>
+        </div>
+        <div class="pull-left">
+            {!! $radio !!}
+        </div>
+    @else
+        {!! $radio !!}
+    @endif
 </div>

+ 2 - 2
src/Controllers/AdminController.php

@@ -13,7 +13,7 @@ class AdminController extends Controller
      *
      * @var string
      */
-    protected $title = 'Title';
+    protected $title;
 
     /**
      * Set description for following 4 action pages.
@@ -34,7 +34,7 @@ class AdminController extends Controller
      */
     protected function title()
     {
-        return $this->title;
+        return $this->title ?: admin_trans_label();
     }
 
     /**

+ 15 - 4
src/Grid/Filter/Presenter/Radio.php

@@ -18,6 +18,11 @@ class Radio extends Presenter
      */
     protected $inline = true;
 
+    /**
+     * @var bool
+     */
+    protected $showLabel = true;
+
     /**
      * Radio constructor.
      *
@@ -25,8 +30,6 @@ class Radio extends Presenter
      */
     public function __construct($options = [])
     {
-        parent::__construct();
-
         if ($options instanceof Arrayable) {
             $options = $options->toArray();
         }
@@ -48,6 +51,13 @@ class Radio extends Presenter
         return $this;
     }
 
+    public function showLabel(bool $value)
+    {
+        $this->showLabel = $value;
+
+        return $this;
+    }
+
     protected function prepare()
     {
     }
@@ -60,8 +70,9 @@ class Radio extends Presenter
         $this->prepare();
 
         return [
-            'options' => $this->options,
-            'inline'  => $this->inline,
+            'options'   => $this->options,
+            'inline'    => $this->inline,
+            'showLabel' => $this->showLabel,
         ];
     }
 }

+ 0 - 7
src/Scaffold/stubs/controller.stub

@@ -10,13 +10,6 @@ use Dcat\Admin\Controllers\AdminController;
 
 class DummyClass extends AdminController
 {
-    /**
-     * Title for current resource.
-     *
-     * @var string
-     */
-    protected $title = 'DummyTitle';
-
     /**
      * Make a grid builder.
      *