Browse Source

Add label type to form

Visman 1 year ago
parent
commit
5de4b88f1a

+ 2 - 1
app/Models/Pages/Profile/Search.php

@@ -176,9 +176,10 @@ class Search extends Profile
                 $fields = [];
                 $fields = [];
                 $fields["name{$forum->id}"] = [
                 $fields["name{$forum->id}"] = [
                     'class'   => ['modforum', 'name', 'depth' . $forum->depth],
                     'class'   => ['modforum', 'name', 'depth' . $forum->depth],
-                    'type'    => 'str',
+                    'type'    => 'label',
                     'value'   => $forum->forum_name,
                     'value'   => $forum->forum_name,
                     'caption' => 'Forum label',
                     'caption' => 'Forum label',
+                    'for'     => "follow[{$forum->id}]",
                 ];
                 ];
                 $fields["follow[{$forum->id}]"] = [
                 $fields["follow[{$forum->id}]"] = [
                     'class'    => ['modforum', 'moderator'],
                     'class'    => ['modforum', 'moderator'],

+ 4 - 1
app/templates/_default/layouts/form.forkbb.php

@@ -26,7 +26,7 @@
             <dl id="id-dl-{{ $cur['id'] or $key }}" @if ($cur['class']) class="f-field-{{ \implode(' f-field-', $cur['class']) }}" @endif>
             <dl id="id-dl-{{ $cur['id'] or $key }}" @if ($cur['class']) class="f-field-{{ \implode(' f-field-', $cur['class']) }}" @endif>
               <dt>
               <dt>
                     @if ($cur['caption'])
                     @if ($cur['caption'])
-                <label class="f-ycaption @if ($cur['required']) f-req @endif" @if (false === \strpos('.radio.yield.str.btn.link.', ".{$cur['type']}.")) for="id-{{ $key }}" @endif>{!! __($cur['caption']) !!}</label>
+                <label class="f-ycaption @if ($cur['required']) f-req @endif" @if (false === \strpos('.radio.yield.str.btn.link.label.', ".{$cur['type']}.")) for="id-{{ $key }}" @endif>{!! __($cur['caption']) !!}</label>
                     @endif
                     @endif
               </dt>
               </dt>
               <dd>
               <dd>
@@ -81,6 +81,9 @@
                         @case ('str')
                         @case ('str')
                 <p id="id-{{ $key }}" class="f-str"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</p>
                 <p id="id-{{ $key }}" class="f-str"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</p>
                             @break
                             @break
+                        @case ('label')
+                <label id="id-{{ $key }}" class="f-label" for="id-{{ $cur['for'] }}"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</label>
+                            @break
                         @case ('yield')
                         @case ('yield')
                 @yield($cur['value'])
                 @yield($cur['value'])
                             @break
                             @break

+ 2 - 1
public/style/ForkBB/style.css

@@ -796,7 +796,8 @@ body,
   margin: 0.3125rem 0 0;
   margin: 0.3125rem 0 0;
 }
 }
 
 
-#fork .f-flblch {
+#fork .f-flblch,
+#fork .f-label {
   cursor: pointer;
   cursor: pointer;
 }
 }