From 945f70e49ef047d50923f548432c3ac3e4d33990 Mon Sep 17 00:00:00 2001 From: BentiGorlich Date: Wed, 11 Sep 2024 14:15:11 +0200 Subject: [PATCH] Change route paths, fix minor things - change route paths from `lists` -> `bookmark-lists` - when creating a default list because the user doesn't have one yet it will be called `Default` - add a title and aria-description to the start icon (default list) - make the header dropdown item be bold when it should be --- assets/controllers/subject_controller.js | 1 - config/kbin_routes/bookmark.yaml | 10 +++++----- config/kbin_routes/bookmark_api.yaml | 10 +++++----- src/Repository/BookmarkListRepository.php | 2 +- templates/bookmark/overview.html.twig | 2 +- templates/layout/_header.html.twig | 5 ++++- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/assets/controllers/subject_controller.js b/assets/controllers/subject_controller.js index dec41850b..3d98a2ad3 100644 --- a/assets/controllers/subject_controller.js +++ b/assets/controllers/subject_controller.js @@ -205,7 +205,6 @@ export default class extends Controller { */ async linkCallback(event) { const cssClass = event.params.cssclass - console.log("called linkCallback", event, cssClass) event.preventDefault(); const a = event.target.closest('a'); diff --git a/config/kbin_routes/bookmark.yaml b/config/kbin_routes/bookmark.yaml index f134b0996..e758da3fd 100644 --- a/config/kbin_routes/bookmark.yaml +++ b/config/kbin_routes/bookmark.yaml @@ -1,7 +1,7 @@ bookmark_front: controller: App\Controller\BookmarkListController::front defaults: { sortBy: hot, time: '∞', federation: all } - path: /lists/show/{list}/{sortBy}/{time}/{federation} + path: /bookmark-lists/show/{list}/{sortBy}/{time}/{federation} methods: [GET] requirements: &front_requirement sortBy: "%default_sort_options%" @@ -10,22 +10,22 @@ bookmark_front: bookmark_lists: controller: App\Controller\BookmarkListController::list - path: /lists + path: /bookmark-lists methods: [GET, POST] bookmark_lists_make_default: controller: App\Controller\BookmarkListController::makeDefault - path: /lists/makeDefault + path: /bookmark-lists/makeDefault methods: [GET] bookmark_lists_edit_list: controller: App\Controller\BookmarkListController::editList - path: /lists/editList/{list} + path: /bookmark-lists/editList/{list} methods: [GET, POST] bookmark_lists_delete_list: controller: App\Controller\BookmarkListController::deleteList - path: /lists/deleteList/{list} + path: /bookmark-lists/deleteList/{list} methods: [GET] subject_bookmark_standard: diff --git a/config/kbin_routes/bookmark_api.yaml b/config/kbin_routes/bookmark_api.yaml index 910bc2e32..f69ad45eb 100644 --- a/config/kbin_routes/bookmark_api.yaml +++ b/config/kbin_routes/bookmark_api.yaml @@ -1,30 +1,30 @@ api_bookmark_front: controller: App\Controller\Api\Bookmark\BookmarkListApiController::front - path: /api/lists/show + path: /api/bookmark-lists/show methods: [GET] format: json api_bookmark_lists: controller: App\Controller\Api\Bookmark\BookmarkListApiController::list - path: /api/lists + path: /api/bookmark-lists methods: [GET] format: json api_bookmark_lists_make_default: controller: App\Controller\Api\Bookmark\BookmarkListApiController::makeDefault - path: /api/lists/{list_name}/makeDefault + path: /api/bookmark-lists/{list_name}/makeDefault methods: [GET] format: json api_bookmark_lists_edit_list: controller: App\Controller\Api\Bookmark\BookmarkListApiController::editList - path: /api/lists/{list_name} + path: /api/bookmark-lists/{list_name} methods: [POST] format: json api_bookmark_lists_delete_list: controller: App\Controller\Api\Bookmark\BookmarkListApiController::deleteList - path: /api/lists/{list_name} + path: /api/bookmark-lists/{list_name} methods: [DELETE] format: json diff --git a/src/Repository/BookmarkListRepository.php b/src/Repository/BookmarkListRepository.php index a655c1233..c942dc500 100644 --- a/src/Repository/BookmarkListRepository.php +++ b/src/Repository/BookmarkListRepository.php @@ -41,7 +41,7 @@ public function findOneByUserDefault(User $user): BookmarkList { $list = $this->findOneBy(['user' => $user, 'isDefault' => true]); if (null === $list) { - $list = new BookmarkList($user, 'default', true); + $list = new BookmarkList($user, 'Default', true); $this->entityManager->persist($list); $this->entityManager->flush(); } diff --git a/templates/bookmark/overview.html.twig b/templates/bookmark/overview.html.twig index b9651445b..4972ea4e6 100644 --- a/templates/bookmark/overview.html.twig +++ b/templates/bookmark/overview.html.twig @@ -38,7 +38,7 @@ {% if list.isDefault %} - + {% endif %} {{ list.name }} diff --git a/templates/layout/_header.html.twig b/templates/layout/_header.html.twig index 62a320b33..c3518a1f8 100644 --- a/templates/layout/_header.html.twig +++ b/templates/layout/_header.html.twig @@ -146,7 +146,10 @@
  • - {{ 'bookmark_lists'|trans }} + + {{ 'bookmark_lists'|trans }} +
  • {% if is_granted('ROLE_ADMIN') %}