Skip to content

Commit

Permalink
Change route paths, fix minor things
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
BentiGorlich committed Sep 27, 2024
1 parent 4faa7dc commit 945f70e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
1 change: 0 additions & 1 deletion assets/controllers/subject_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions config/kbin_routes/bookmark.yaml
Original file line number Diff line number Diff line change
@@ -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%"
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions config/kbin_routes/bookmark_api.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Repository/BookmarkListRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion templates/bookmark/overview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<tr>
<td>
{% if list.isDefault %}
<i class="fa-solid fa-star active"></i>
<i class="fa-solid fa-star active" title="{{ 'bookmark_list_is_default'|trans }}" aria-description="{{ 'bookmark_list_is_default'|trans }}"></i>
{% endif %}
</td>
<td><a href="{{ path('bookmark_front', {'list': list.name}) }}">{{ list.name }}</a></td>
Expand Down
5 changes: 4 additions & 1 deletion templates/layout/_header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@
</a>
</li>
<li>
<a href="{{ path('bookmark_lists') }}">{{ 'bookmark_lists'|trans }}</a>
<a href="{{ path('bookmark_lists') }}"
class="{{ html_classes({'active': is_route_name_contains('bookmark')}) }}">
{{ 'bookmark_lists'|trans }}
</a>
</li>
{% if is_granted('ROLE_ADMIN') %}
<li>
Expand Down

0 comments on commit 945f70e

Please sign in to comment.