diff --git a/plugins/Favourite/Favourite.php b/plugins/Favourite/Favourite.php index 5494118354..09a2df28b8 100644 --- a/plugins/Favourite/Favourite.php +++ b/plugins/Favourite/Favourite.php @@ -58,17 +58,24 @@ class Favourite extends Plugin } // if note is favourited, "is_set" is 1 - $opts = ['note_id' => $note->getId(), 'gsactor_id' => $user->getId()]; - $is_set = DB::find('favourite', $opts) != null; - $form = Form::create([ - ['is_set', HiddenType::class, ['data' => $is_set ? '1' : '0']], + $opts = ['note_id' => $note->getId(), 'gsactor_id' => $user->getId()]; + $is_set = DB::find('favourite', $opts) != null; + $form_fav = Form::create([ + ['submit_fav', SubmitType::class, + [ + 'label' => ' ', + 'attr' => [ + 'class' => $is_set ? 'favourite-button-on' : 'favourite-button-off', + ], + ], + ], ['note_id', HiddenType::class, ['data' => $note->getId()]], - ["favourite-{$note->getId()}", SubmitType::class, ['label' => ' ', 'attr' => ['class' => $is_set ? 'favourite-button-on' : 'favourite-button-off']]], + ["favourite-{$note->getId()}", HiddenType::class, ['data' => $is_set ? '1' : '0']], ]); // Form handler $ret = self::noteActionHandle( - $request, $form, $note, "favourite-{$note->getId()}", /** + $request, $form_fav, $note, "favourite-{$note->getId()}", /** * Called from form handler * * @param $note Note to be favourited @@ -77,11 +84,11 @@ class Favourite extends Plugin * @throws RedirectException Always thrown in order to prevent accidental form re-submit from browser */ function ($note, $data) use ($opts, $request) { $fave = DB::find('favourite', $opts); - if ($data['is_set'] === '0' && $fave === null) { + if ($data["favourite-{$note->getId()}"] === '0' && $fave === null) { DB::persist(Entity\Favourite::create($opts)); DB::flush(); } else { - if ($data['is_set'] === '1' && $fave !== null) { + if ($data["favourite-{$note->getId()}"] === '1' && $fave !== null) { DB::remove($fave); DB::flush(); } @@ -97,7 +104,7 @@ class Favourite extends Plugin return $ret; } - $actions[] = $form->createView(); + $actions[] = $form_fav->createView(); return Event::next; } diff --git a/public/assets/css/base.css b/public/assets/css/base.css index f23f21def3..b63fa95270 100644 --- a/public/assets/css/base.css +++ b/public/assets/css/base.css @@ -195,27 +195,18 @@ display: block; } -.favourite-button-off { - all: unset; - - cursor: pointer !important; - border: none !important; +.favourite-button-container button { width: 1em !important; height: 1em !important; - background-size: cover !important; - background-image: url(../icons/heart.svg) !important; - filter: invert(26%) sepia(21%) saturate(580%) hue-rotate(201deg) brightness(96%) contrast(93%); + border: unset !important; + padding: unset !important; + mask-image: url("../icons/heart.svg") !important; +} +.favourite-button-off { + background: var(--bg2) !important; } .favourite-button-on { - all: unset; - - cursor: pointer !important; - border: none !important; - width: 1em !important; - height: 1em !important; - background-size: cover !important; - background-image: url(../icons/heart.svg) !important; - filter: invert(100%); + background: var(--white) !important; } .note-content { diff --git a/public/assets/css/right/right.css b/public/assets/css/right/right.css index 5116490d59..1edb614e41 100644 --- a/public/assets/css/right/right.css +++ b/public/assets/css/right/right.css @@ -26,11 +26,11 @@ background-color: var(--translucent); } -.section-title-hamburger { +.section-title-menu { display: flex; justify-content: space-between; } -.section-title-hamburger svg { +.section-title-menu svg { align-self: center; fill: var(--white); } diff --git a/public/assets/css/security/security.css b/public/assets/css/security/security.css index 7e035ae9d1..e69de29bb2 100644 --- a/public/assets/css/security/security.css +++ b/public/assets/css/security/security.css @@ -1,56 +0,0 @@ -form { - width: 50%; - margin-left: auto; - margin-right: auto; - - padding: var(--main-size); - border-radius: var(--unit-size); -} - -fieldset { - display: flex; - flex-direction: column; - - font-family: var(--display-font); - font-size: var(--main-size); -} - -fieldset legend { - margin-bottom: var(--main-size); -} - -br { - margin-bottom: var(--unit-size); -} - -label { - font-family: var(--display-font); - font-size: var(--medium-size); -} - -input[type="text"]:hover, -input[type="password"]:hover, -input[type="email"]:hover, -input[type="text"]:focus, -input[type="password"]:focus, -input[type="email"]:focus { - background: var(--white) !important; - color: var(--bg1) !important; - transition: all 0.4s ease; -} - -input[type="text"], -input[type="password"], -input[type="email"] { - all: unset; - background: var(--translucent); - padding: var(--unit-size) var(--small-size); - box-sizing: border-box; - border-radius: var(--unit-size); - font-size: var(--medium-size); - width: 100%; -} - -fieldset div:last-child { - text-align: end; -} \ No newline at end of file diff --git a/public/assets/icons/heart.svg b/public/assets/icons/heart.svg index f9d3f19865..e1908f6667 100644 --- a/public/assets/icons/heart.svg +++ b/public/assets/icons/heart.svg @@ -1,9 +1,3 @@ - - heart - - - - - + + diff --git a/templates/base.html.twig b/templates/base.html.twig index 630837138e..7a3a8b8d12 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -29,7 +29,7 @@ -{% block header %} + {% block header %}