From 5782584a685f5c1650fcf24eb4b5b600c659a336 Mon Sep 17 00:00:00 2001
From: Annika Backstrom
Date: Sun, 26 May 2024 13:48:04 +0100
Subject: [PATCH] Add bookmark editing form (no tags)
---
app/Http/Controllers/BookmarkController.php | 7 ++-
resources/sass/app.scss | 1 +
resources/sass/components/_bookmark.scss | 7 ++-
resources/sass/components/_forms.scss | 58 +++++++++++++++++++++
resources/views/bookmarks/edit.blade.php | 33 ++++++++++++
resources/views/bookmarks/show.blade.php | 3 ++
6 files changed, 107 insertions(+), 2 deletions(-)
create mode 100644 resources/sass/components/_forms.scss
create mode 100644 resources/views/bookmarks/edit.blade.php
diff --git a/app/Http/Controllers/BookmarkController.php b/app/Http/Controllers/BookmarkController.php
index 1706c1f..039b645 100644
--- a/app/Http/Controllers/BookmarkController.php
+++ b/app/Http/Controllers/BookmarkController.php
@@ -52,7 +52,12 @@ class BookmarkController extends Controller
*/
public function edit(string $id)
{
- //
+ return view(
+ 'bookmarks.edit', [
+ 'edit' => true,
+ 'bookmark' => $bookmark = Bookmark::findOrFail($id),
+ ]
+ );
}
/**
diff --git a/resources/sass/app.scss b/resources/sass/app.scss
index 6bebdc0..0e80b96 100644
--- a/resources/sass/app.scss
+++ b/resources/sass/app.scss
@@ -16,6 +16,7 @@ body {
@import 'components/bookmark';
@import 'components/pagination';
+@import 'components/forms';
a {
&,
diff --git a/resources/sass/components/_bookmark.scss b/resources/sass/components/_bookmark.scss
index aa88276..f2cb300 100644
--- a/resources/sass/components/_bookmark.scss
+++ b/resources/sass/components/_bookmark.scss
@@ -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;
}
diff --git a/resources/sass/components/_forms.scss b/resources/sass/components/_forms.scss
new file mode 100644
index 0000000..487ac9a
--- /dev/null
+++ b/resources/sass/components/_forms.scss
@@ -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;
+ }
+ }
+}
diff --git a/resources/views/bookmarks/edit.blade.php b/resources/views/bookmarks/edit.blade.php
new file mode 100644
index 0000000..2ac7799
--- /dev/null
+++ b/resources/views/bookmarks/edit.blade.php
@@ -0,0 +1,33 @@
+@extends('layouts.app')
+
+@section('content')
+
+ ← Back
+
+
+@endsection
diff --git a/resources/views/bookmarks/show.blade.php b/resources/views/bookmarks/show.blade.php
index 9704559..d2e1359 100644
--- a/resources/views/bookmarks/show.blade.php
+++ b/resources/views/bookmarks/show.blade.php
@@ -5,4 +5,7 @@
← Back
+
+ edit
+
@endsection