Skip to content

Commit fe99e27

Browse files
Added support for extra sidebar & form widgets to channel screens
1 parent 89abbb2 commit fe99e27

5 files changed

Lines changed: 31 additions & 3 deletions

File tree

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- Added the new `priority` and `subtitle` fields to the product/master/variant screens
99
- Added sorting by priority to the product list
10+
- Added support for additional sidebar and form widgets to the create/update channel screens
1011
- Added validation rule for every product/master/variant field in create/update request classes
1112
- Improved the product/master/variant forms by slight field reorganization and grouping
1213
- Changed the minimum product name length from 2 to 1 (eg. when a t-shirt is of size "S")

src/Http/Controllers/ChannelController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public function create()
5353
'shippingZones' => Zones::withShippingScope()->get(),
5454
'domains' => null,
5555
'languages' => $this->getLanguages(),
56+
'sidebarWidgets' => [],
57+
'formWidgets' => [],
5658
]));
5759
}
5860

@@ -94,6 +96,8 @@ public function edit(Channel $channel)
9496
'shippingZones' => Zones::withShippingScope()->get(),
9597
'domains' => null,
9698
'languages' => $this->getLanguages(),
99+
'sidebarWidgets' => [],
100+
'formWidgets' => [],
97101
]));
98102
}
99103

src/resources/views/channel/_form.blade.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,12 @@
151151
<hr class="mt-5">
152152
@include('vanilo::pricelist._select')
153153
@endif
154+
155+
@foreach($formWidgets ?? [] as $widget)
156+
@include($widget)
157+
@endforeach
158+
159+
@push('onload-scripts')
160+
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
161+
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
162+
@endpush()

src/resources/views/channel/create.blade.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
@stop
66

77
@section('content')
8-
{!! Form::model($channel, ['route' => 'vanilo.admin.channel.store', 'autocomplete' => 'off']) !!}
8+
{!! Form::model($channel, ['route' => 'vanilo.admin.channel.store', 'autocomplete' => 'off', 'class' => 'row']) !!}
99

10-
<x-appshell::card accent="success">
10+
<x-appshell::card accent="success" class="col col col-md-8">
1111
<x-slot:title>{{ __('Channel Details') }}</x-slot:title>
1212

1313
@include('vanilo::channel._form')
@@ -19,5 +19,11 @@
1919

2020
</x-appshell::card>
2121

22+
<div class="col col-md-4">
23+
@foreach($sidebarWidgets ?? [] as $widget)
24+
@include($widget)
25+
@endforeach
26+
</div>
27+
2228
{!! Form::close() !!}
2329
@stop

src/resources/views/channel/edit.blade.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
'method' => 'PUT'
1111
])
1212
!!}
13-
13+
<div class="row">
14+
<div class="col col-md-8">
1415
<x-appshell::card accent="secondary">
1516
<x-slot:title>{{ __('Channel Details') }}</x-slot:title>
1617

@@ -22,6 +23,13 @@
2223
</x-slot:footer>
2324

2425
</x-appshell::card>
26+
</div>
2527

28+
<div class="col col-md-4">
29+
@foreach($sidebarWidgets ?? [] as $widget)
30+
@include($widget)
31+
@endforeach
32+
</div>
33+
</div>
2634
{!! Form::close() !!}
2735
@stop

0 commit comments

Comments
 (0)