Skip to content

Commit 38c471e

Browse files
committed
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 #113
1 parent 66ac920 commit 38c471e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/Http/Controllers/UserController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ public function showLink(request $request)
207207
$order = Link::where('id', $linkId)->value('order');
208208
$custom_css = Link::where('id', $linkId)->value('custom_css');
209209
$buttonId = Link::where('id', $linkId)->value('button_id');
210+
$buttonName = Button::where('id', $buttonId)->value('name');
210211

211212
$buttons = Button::select('id', 'name')->get();
212213

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

215216
}
216217

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
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>
2021
@foreach($buttons as $button)
21-
<option <?= ($buttonId === $button->id) ? 'selected' : '' ?>> {{ $button->name }} </option>
22+
@if ($button->name != $buttonName)
23+
<option> {{ $button->name }} </option>
24+
@endif
2225
@endforeach
2326
</select>
2427
</div>

0 commit comments

Comments
 (0)