Add a configurable default tag for the dashboard#1572
Merged
Conversation
In tags mode the dashboard always opened showing every link. This adds a "Default tag" setting (Advanced) that pre-selects one tag group on load, so the dashboard opens filtered to it - the built-in equivalent of the custom JavaScript workaround people have been sharing. The setting is a select populated from the user's own tags, following the same dynamic-option pattern already used for the search provider. When a tag is chosen its slug is exposed on the tag list and the matching tab is activated on load; when the setting is empty, behaviour is unchanged and all links are shown. Resolves #1556
Closed
The default_tag dropdown was populated from every tag (type=1), but the dashboard taglist only renders pinned tags. Selecting an unpinned tag as the default therefore triggered a click on a taglist entry that does not exist, silently doing nothing. Filter the option queries in both Setting accessors to pinned tags so only selectable tags are offered, and assert an unpinned tag is excluded. Also drop the unused $data['default_tag'] assignment in ItemController: the taglist partial reads the setting directly via Setting::fetch(), so the view variable was never consumed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Resolves #1556 (multiple requesters).
With "Treat Tags As: Tags", the dashboard always opens showing every link. Users who group links with tags want one tag group to be the landing view. The only current workaround is pasting Custom JavaScript that clicks a tag tab on load — which requires knowing the tag's internal
data-tagslug.Change
Adds a "Default tag" setting under Advanced:
selectpopulated dynamically from the user's own tags (following the exact pattern already used for the search-provider setting), plus a "None" option (the default — unchanged behaviour).data-default-tagon#taglist) and the dashboard auto-activates that tag's tab on load, so it opens filtered to that group. Empty ⇒ all links shown, exactly as before.This is the built-in, UI-driven equivalent of the community workaround.
Files
database/seeders/SettingsSeeder.php— newdefault_tagsetting (id 15, Advanced group)app/Setting.php— dynamic tag options for the select (edit + list accessors)app/Http/Controllers/ItemController.php—dash()exposes the valueresources/views/partials/taglist.blade.php—data-default-tagattributeresources/assets/js/app.js(+ recompiledpublic/js/app.js) — auto-select on loadlang/en/app.php— labelTests
SettingsSeederTest: the setting is seeded (select, Advanced) and its edit value lists all tags + a "None" option.DashTest: with tags mode + a default tag configured,/rendersdata-default-tag="…".Full suite green (37 tests, 1 pre-existing skip);
phpcsclean; source JS lints clean and the recompiled bundle passesnode --check.Note
The on-load tab activation mirrors the community-confirmed
querySelector('[data-tag="tag-…"]').click()snippet; the compiled bundle was hand-patched to keep the diff minimal (CI rebuilds assets regardless).