Edit Link now defaults to current link instead of "custom"
If a link is edited on the edit-link section, the default button selection now has the current button selected rather than the custom button. @bonelifer https://github.com/JulianPrieber/littlelink-custom/issues/113
This commit is contained in:
parent
66ac92087a
commit
38c471ec61
|
@ -207,10 +207,11 @@ class UserController extends Controller
|
|||
$order = Link::where('id', $linkId)->value('order');
|
||||
$custom_css = Link::where('id', $linkId)->value('custom_css');
|
||||
$buttonId = Link::where('id', $linkId)->value('button_id');
|
||||
$buttonName = Button::where('id', $buttonId)->value('name');
|
||||
|
||||
$buttons = Button::select('id', 'name')->get();
|
||||
|
||||
return view('studio/edit-link', ['custom_css' => $custom_css, 'buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId]);
|
||||
return view('studio/edit-link', ['custom_css' => $custom_css, 'buttonId' => $buttonId, 'buttons' => $buttons, 'link' => $link, 'title' => $title, 'order' => $order, 'id' => $linkId , 'buttonName' => $buttonName]);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
<div class="form-group col-lg-8">
|
||||
<label for="exampleFormControlSelect1">Button</label>
|
||||
<select class="form-control" name="button">
|
||||
<option> {{ $buttonName }} </option>
|
||||
@foreach($buttons as $button)
|
||||
<option <?= ($buttonId === $button->id) ? 'selected' : '' ?>> {{ $button->name }} </option>
|
||||
@if ($button->name != $buttonName)
|
||||
<option> {{ $button->name }} </option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue