Add bookmark editing form (no tags)
This commit is contained in:
parent
0b1fe6d491
commit
5782584a68
@ -52,7 +52,12 @@ class BookmarkController extends Controller
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
return view(
|
||||
'bookmarks.edit', [
|
||||
'edit' => true,
|
||||
'bookmark' => $bookmark = Bookmark::findOrFail($id),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@ body {
|
||||
|
||||
@import 'components/bookmark';
|
||||
@import 'components/pagination';
|
||||
@import 'components/forms';
|
||||
|
||||
a {
|
||||
&,
|
||||
|
@ -6,7 +6,8 @@
|
||||
"title title"
|
||||
"description description"
|
||||
"href href"
|
||||
"date tags";
|
||||
"date tags"
|
||||
"actions actions";
|
||||
|
||||
margin-bottom: 1em;
|
||||
padding: 0;
|
||||
@ -64,6 +65,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-actions {
|
||||
grid-area: actions;
|
||||
}
|
||||
|
||||
&-date {
|
||||
grid-area: date;
|
||||
}
|
||||
|
58
resources/sass/components/_forms.scss
Normal file
58
resources/sass/components/_forms.scss
Normal file
@ -0,0 +1,58 @@
|
||||
.form {
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1ex;
|
||||
column-gap: 1ex;
|
||||
row-gap: 0;
|
||||
|
||||
&-stacked {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
column-gap: 0;
|
||||
row-gap: 1ex;
|
||||
}
|
||||
|
||||
&.align-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
&-label {
|
||||
flex: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&-input,
|
||||
&-textarea {
|
||||
padding: 1ex;
|
||||
flex: 1;
|
||||
border: 1px solid #888;
|
||||
border-radius: 5px;
|
||||
min-height: 2em;
|
||||
}
|
||||
|
||||
&-textarea {
|
||||
min-height: 10em;
|
||||
}
|
||||
|
||||
&-button {
|
||||
border: 1px solid #888;
|
||||
padding: 1ex 2ex;
|
||||
border-radius: 5px;
|
||||
|
||||
text-decoration: none;
|
||||
font-size: 1em;
|
||||
|
||||
background-color: #fff;
|
||||
color: #000 !important;
|
||||
|
||||
cursor: default;
|
||||
|
||||
&:visited,
|
||||
&:hover,
|
||||
&:active {
|
||||
color: #000 !important;
|
||||
}
|
||||
}
|
||||
}
|
33
resources/views/bookmarks/edit.blade.php
Normal file
33
resources/views/bookmarks/edit.blade.php
Normal file
@ -0,0 +1,33 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<p>
|
||||
<a href="{{ action('BookmarkController@index') }}">← Back</a>
|
||||
</p>
|
||||
<form action="post" class="form">
|
||||
<div class="bookmark">
|
||||
<div class="bookmark-title form-row">
|
||||
<label class="form-label" for="title">
|
||||
Title:
|
||||
</label>
|
||||
<input type="text" class="form-input" "name="title" value="{{ htmlentities($bookmark->title) }}">
|
||||
</div>
|
||||
<div class="bookmark-href form-row form-row-stacked">
|
||||
<label class="form-label" for="href">
|
||||
URL:
|
||||
</label>
|
||||
<input type="text" class="form-input" "name="href" value="{{ htmlentities($bookmark->href) }}">
|
||||
</div>
|
||||
<div class="bookmark-description form-row form-row-stacked">
|
||||
<label class="form-label" for="description">
|
||||
Description:
|
||||
</label>
|
||||
<textarea name="description" class="form-textarea">{{ htmlentities($bookmark->title) }}</textarea>
|
||||
</div>
|
||||
<div class="form-row align-right bookmark-actions">
|
||||
<a class="form-button" href="{{ action('BookmarkController@show', ['bookmark' => $bookmark]) }}">Cancel</a>
|
||||
<input type="submit" class="form-button" value="Save">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
@ -5,4 +5,7 @@
|
||||
<a href="{{ action('BookmarkController@index') }}">← Back</a>
|
||||
</p>
|
||||
<x-bookmark :bookmark="$bookmark" />
|
||||
<p>
|
||||
<a href="{{ action('BookmarkController@edit', ['bookmark' => $bookmark]) }}">edit</a>
|
||||
</p>
|
||||
@endsection
|
||||
|
Loading…
Reference in New Issue
Block a user