Skip to content

Add a configurable default tag for the dashboard#1572

Merged
KodeStar merged 2 commits into
2.xfrom
feature/default-tag-group
Jul 8, 2026
Merged

Add a configurable default tag for the dashboard#1572
KodeStar merged 2 commits into
2.xfrom
feature/default-tag-group

Conversation

@KodeStar

@KodeStar KodeStar commented Jul 8, 2026

Copy link
Copy Markdown
Member

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-tag slug.

Change

Adds a "Default tag" setting under Advanced:

  • It's a select populated 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).
  • When set, the tag list carries the chosen slug (data-default-tag on #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.
  • Only applies in tags mode (the tag list only renders there); an unknown/removed tag falls back to "All".

This is the built-in, UI-driven equivalent of the community workaround.

Files

  • database/seeders/SettingsSeeder.php — new default_tag setting (id 15, Advanced group)
  • app/Setting.php — dynamic tag options for the select (edit + list accessors)
  • app/Http/Controllers/ItemController.phpdash() exposes the value
  • resources/views/partials/taglist.blade.phpdata-default-tag attribute
  • resources/assets/js/app.js (+ recompiled public/js/app.js) — auto-select on load
  • lang/en/app.php — label

Tests

  • 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, / renders data-default-tag="…".

Full suite green (37 tests, 1 pre-existing skip); phpcs clean; source JS lints clean and the recompiled bundle passes node --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).

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
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.
@KodeStar KodeStar merged commit 6d0242d into 2.x Jul 8, 2026
1 check passed
@LinuxServer-CI LinuxServer-CI moved this from PRs to Done in Issue & PR Tracker Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[Enhancement] Select starting tag group when Treat Tags As: Tags is selected

2 participants