Skip to content

Commit e4f7799

Browse files
committed
Sorted buttons alphabetically
1 parent 388d2f2 commit e4f7799

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/Http/Controllers/UserController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ public function showLink(request $request)
209209
$buttonId = Link::where('id', $linkId)->value('button_id');
210210
$buttonName = Button::where('id', $buttonId)->value('name');
211211

212-
$buttons = Button::select('id', 'name')->get();
212+
213+
$buttons = Button::select('id', 'name')->orderBy('name', 'asc')->get();
213214

214215
return view('studio/edit-link', ['custom_css' => $custom_css, 'buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId , 'buttonName' => $buttonName]);
215216

resources/views/studio/edit-link.blade.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@
1717
<div class="form-group col-lg-8">
1818
<label for="exampleFormControlSelect1">Button</label>
1919
<select class="form-control" name="button">
20-
<option> {{ $buttonName }} </option>
20+
<option style="background-color:#1e90ff;color:#fff"> {{ $buttonName }} </option>
2121
@foreach($buttons as $button)
22+
@if ($button->name != "custom")@if ($loop->first)<option style="background-color:#ffe8e4;"> custom </option>@endif @endif
23+
@if ($button->name != "custom_website")@if ($loop->first)<option style="background-color:#ffe8e4;"> custom_website </option>@endif @endif
24+
@endforeach
25+
@foreach($buttons as $button)
26+
@if (!in_array($button->name, ['custom', 'custom_website', 'heading', 'space']))
2227
@if ($button->name != $buttonName)
2328
<option> {{ $button->name }} </option>
2429
@endif
30+
@endif
31+
@endforeach
32+
@foreach($buttons as $button)
33+
@if ($button->name != "heading")@if ($loop->first)<option style="background-color:#ebebeb;"> heading </option>@endif @endif
34+
@if ($button->name != "space")@if ($loop->first)<option style="background-color:#ebebeb;"> space </option>@endif @endif
2535
@endforeach
2636
</select>
2737
</div>

0 commit comments

Comments
 (0)