Add bookmark editing form (no tags)

This commit is contained in:
Annika Backstrom 2024-05-26 13:48:04 +01:00
parent 0b1fe6d491
commit 5782584a68
Signed by: annika
GPG Key ID: 3561F004DE1D9AFE
6 changed files with 107 additions and 2 deletions

View File

@ -52,7 +52,12 @@ class BookmarkController extends Controller
*/
public function edit(string $id)
{
//
return view(
'bookmarks.edit', [
'edit' => true,
'bookmark' => $bookmark = Bookmark::findOrFail($id),
]
);
}
/**

View File

@ -16,6 +16,7 @@ body {
@import 'components/bookmark';
@import 'components/pagination';
@import 'components/forms';
a {
&,

View File

@ -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;
}

View 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;
}
}
}

View File

@ -0,0 +1,33 @@
@extends('layouts.app')
@section('content')
<p>
<a href="{{ action('BookmarkController@index') }}">&larr; 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

View File

@ -5,4 +5,7 @@
<a href="{{ action('BookmarkController@index') }}">&larr; Back</a>
</p>
<x-bookmark :bookmark="$bookmark" />
<p>
<a href="{{ action('BookmarkController@edit', ['bookmark' => $bookmark]) }}">edit</a>
</p>
@endsection