]> _ Git - cubist_cms-back.git/commitdiff
#2843
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Jun 2019 11:53:55 +0000 (13:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Jun 2019 11:53:55 +0000 (13:53 +0200)
src/resources/views/fields/button.blade.php

index 1695bdbc055270a430f5f0c3c4c66f7024c756be..48e6b63dec3315f91070c7fe73435e80fe8a315f 100644 (file)
@@ -8,8 +8,8 @@ $active_pages = $page_model::all();
 
 $empty = ['label' => '', 'type' => array_key_first($link_types), 'link' => '', 'page_id' => ''];
 $value = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? [];
-if($value==''){
-    $value=[];
+if ($value == '') {
+    $value = [];
 }
 $value = array_merge($empty, $value);
 
@@ -19,17 +19,18 @@ $value = array_merge($empty, $value);
     <label>{!! $field['label'] !!}</label>
     @include('crud::inc.field_translatable_icon')
     <div class="clearfix"></div>
-    <div class="col-sm-3">
-        <label>Button label</label><br/>
-        <input type="text" name="{{$field['name']}}[label]" value="{{$value['label']}}" class="form-control">
-    </div>
-    <div class="col-sm-3">
-        <label>Link type</label><br/>
-        <select
-            id="page_or_link_select"
-            name="{{ $field['name']}}[type]"
-            @include('crud::inc.field_attributes')
-        >
+    <div class="button__wrapper">
+        <div class="col-sm-3 button__field">
+            <label>Button label</label><br/>
+            <input type="text" name="{{$field['name']}}[label]" value="{{$value['label']}}" class="form-control">
+        </div>
+        <div class="col-sm-3 button__field">
+            <label>Link type</label><br/>
+            <select
+                id="page_or_link_select"
+                name="{{ $field['name']}}[type]"
+                @include('crud::inc.field_attributes')
+            >
                 @foreach ($link_types as $key => $link_type)
                     <option value="{{ $key }}"
                             @if ($key===$value['type'])
@@ -37,70 +38,71 @@ $value = array_merge($empty, $value);
                         @endif
                     >{{ $link_type }}</option>
                 @endforeach
-        </select>
-    </div>
-    <div class="col-sm-6">
-        <label>Link</label><br/>
-        <!-- external link input -->
-        <div class="page_or_link_value <?php if ($value['type'] != 'external_link') {
-            echo 'hidden';
-        } ?>" id="page_or_link_external_link">
-            <input
-                type="url"
-                class="form-control"
-                name="link"
-                placeholder="{{ trans('backpack::crud.page_link_placeholder') }}"
-
-                @if ($value['type']!='external_link')
-                disabled="disabled"
-                @endif
-
-                @if ($value['type']=='external_link' && isset($value['link']) && $value['link']!='')
-                value="{{ $value['link'] }}"
-                @endif
-            >
-        </div>
-        <!-- internal link input -->
-        <div class="page_or_link_value <?php if ($value['type'] != 'internal_link') {
-            echo 'hidden';
-        } ?>" id="page_or_link_internal_link">
-            <input
-                type="text"
-                class="form-control"
-                name="link"
-                placeholder="{{ trans('backpack::crud.internal_link_placeholder', ['url', url(config('backpack.base.route_prefix').'/page')]) }}"
-
-                @if ($value['type']!='internal_link')
-                disabled="disabled"
-                @endif
-
-                @if ($value['type']=='internal_link' && isset($value['link']) && $value['link']!='')
-                value="{{ $value['link'] }}"
-                @endif
-            >
-        </div>
-        <!-- page slug input -->
-        <div class="page_or_link_value <?php if ($value['type'] != 'page_link') {
-            echo 'hidden';
-        } ?>" id="page_or_link_page">
-            <select
-                class="form-control"
-                name="page_id"
-            >
-                @if (!count($active_pages))
-                    <option value="">-</option>
-                @else
-                    @foreach ($active_pages as $key => $page)
-                        <option value="{{ $page->id }}"
-                                @if (isset($value['page_id']) && $page->id==$value['page_id'])
-                                selected
-                            @endif
-                        >{{ $page->name }}</option>
-                    @endforeach
-                @endif
-
             </select>
         </div>
+        <div class="col-sm-6 button__field">
+            <label>Link</label><br/>
+            <!-- external link input -->
+            <div class="page_or_link_value <?php if ($value['type'] != 'external_link') {
+                echo 'hidden';
+            } ?>" id="page_or_link_external_link">
+                <input
+                    type="url"
+                    class="form-control"
+                    name="link"
+                    placeholder="{{ trans('backpack::crud.page_link_placeholder') }}"
+
+                    @if ($value['type']!='external_link')
+                    disabled="disabled"
+                    @endif
+
+                    @if ($value['type']=='external_link' && isset($value['link']) && $value['link']!='')
+                    value="{{ $value['link'] }}"
+                    @endif
+                >
+            </div>
+            <!-- internal link input -->
+            <div class="page_or_link_value <?php if ($value['type'] != 'internal_link') {
+                echo 'hidden';
+            } ?>" id="page_or_link_internal_link">
+                <input
+                    type="text"
+                    class="form-control"
+                    name="link"
+                    placeholder="{{ trans('backpack::crud.internal_link_placeholder', ['url', url(config('backpack.base.route_prefix').'/page')]) }}"
+
+                    @if ($value['type']!='internal_link')
+                    disabled="disabled"
+                    @endif
+
+                    @if ($value['type']=='internal_link' && isset($value['link']) && $value['link']!='')
+                    value="{{ $value['link'] }}"
+                    @endif
+                >
+            </div>
+            <!-- page slug input -->
+            <div class="page_or_link_value <?php if ($value['type'] != 'page_link') {
+                echo 'hidden';
+            } ?>" id="page_or_link_page">
+                <select
+                    class="form-control"
+                    name="page_id"
+                >
+                    @if (!count($active_pages))
+                        <option value="">-</option>
+                    @else
+                        @foreach ($active_pages as $key => $page)
+                            <option value="{{ $page->id }}"
+                                    @if (isset($value['page_id']) && $page->id==$value['page_id'])
+                                    selected
+                                @endif
+                            >{{ $page->name }}</option>
+                        @endforeach
+                    @endif
+
+                </select>
+            </div>
+        </div>
     </div>
     <div class="clearfix"></div>
 
@@ -119,6 +121,19 @@ $value = array_merge($empty, $value);
 
     {{-- FIELD CSS - will be loaded in the after_styles section --}}
     @push('crud_fields_styles')
+        <style type="text/css">
+            .button__field label {
+                font-weight: 400;
+            }
+
+            .button__field:first-child {
+                padding-left: 0;
+            }
+
+            .button__field:last-child {
+                padding-right: 0;
+            }
+        </style>
     @endpush
 
     {{-- FIELD JS - will be loaded in the after_scripts section --}}