Skip to content

Modules: notice when activating a theme alongside another active theme - #311

Merged
WebTigers merged 1 commit into
mainfrom
feat/theme-multi-active-notice
Sep 25, 2026
Merged

WebTigers merged 1 commit into
mainfrom
feat/theme-multi-active-notice

Conversation

@WebTigers

Copy link
Copy Markdown
Owner

What

Activating a second theme while one is already active is allowed — a theme may be built to coexist — but it can produce unpredictable results. This adds a modal notice (via TigerModal, not a browser alert or a scary warning) in the Modules admin: when you click Activate on a theme and another theme is already active, you get "Another theme is already active. Activating more than one theme at a time can have unpredictable results — unless the theme is designed to work alongside others. Activate anyway?" — and it proceeds on OK.

How

  • modules/system/views/scripts/modules/index.phtml — in the activate branch of handleToggle, when the target is a theme (data-theme="1") and another active theme exists, show the notice and run() on confirm. Active themes are already the rows rendering a data-mod-toggle="deactivate" data-theme="1" button, so the check is client-side with no new server round-trip. Reuses the exact TigerModal.confirm pattern already used in this file for the mutex-conflict and deactivate confirmations.
  • modules/system/languages/en/system.php — adds system.js.activate_theme_multi + system.js.activate_theme_multi_title.

Notes

  • i18n: the key is added to en only, consistent with this file (en is already the superset; other locales fall back to en). Full localization is a separate i18n pass.
  • Deployed to tiger-dev for manual click-testing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

Activating a second theme is allowed — a theme may be built to coexist — but it can be
unpredictable, so surface a modal NOTICE (TigerModal, not an alert/warning) before it runs,
and proceed on OK. Active themes are the rows already tagged with a data-theme="1" Deactivate
button, so the check is client-side with no new server round-trip.

- modules/system/views/scripts/modules/index.phtml: in the activate path of handleToggle,
  when activating a theme and another active theme exists, show the notice, then run() on OK.
- modules/system/languages/en/system.php: system.js.activate_theme_multi(_title).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ
@WebTigers
WebTigers merged commit 73fcad1 into main Sep 25, 2026
14 checks passed
@WebTigers
WebTigers deleted the feat/theme-multi-active-notice branch September 25, 2026 15:59
WebTigers added a commit that referenced this pull request Sep 25, 2026
…checkbox) (#312)

* Themes: allow multiple active at once; default site theme is opt-in

Activating a theme no longer deactivates the others. A theme's "active" state is now the
same module flag every module uses (multiple can be active, their layouts/assets available);
which one is the DEFAULT site theme is the separate `tiger.theme` config, changed only on
request. This replaces the "one active theme per scope" behavior (activating one silently
replaced the previous), and supersedes the Flag 3 "multiple active is unpredictable" notice
(#311) — multiple active is now the normal, supported case.

- library/Tiger/Theme.php: `activate($slug, $makeDefault = true)` — always links assets; sets
  `tiger.theme` only when $makeDefault (default true keeps the headless installer's behavior).
- modules/system/services/Modules.php: `_toggleTheme` maintains the module active flag (setActive)
  and passes `make_default` through to `Tiger_Theme::activate`; `_isModuleActive` (delete guard)
  reads the flag like any module.
- modules/system/controllers/ModulesController.php: theme "active" = the flag; exposes `is_default`
  (the theme whose key == tiger.theme).
- modules/system/views/scripts/modules/index.phtml: on theme Activate, a confirm with a
  "Make <name> the default site theme" CHECKBOX (pre-checked only when nothing is default yet);
  only sends make_default=1 when ticked. A "Default" badge marks the current default theme.
- themes/puma/assets/js/tiger.modal.js: TigerModal.confirm gains an optional `checkbox: {label,
  checked}` — with it, confirm resolves { confirmed, checked } (backward-compatible; without it,
  a bare boolean as before).

Proven: the shipped handleToggle sends make_default only when the box is ticked (JS harness), and
the server keeps every theme active while moving the default only on request (dev: activate B
without the box → A and B both active, default stays A; deactivating the default clears it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

* Update theme tests for multiple-active + opt-in default

The theme-activation semantics changed (Themes: allow multiple active): activating a theme
sets the module active FLAG (multiple can be active) and writes tiger.theme only when
make_default is set; Tiger_Theme::activate() returns a 'default' flag. Bring the integration
tests to the new contract.

- ModulesServiceThemeTest: activating sets the flag and does NOT change the default unless
  make_default is passed; deactivating the default clears the flag + tiger.theme.
- ThemeActivateTest: activate() return array now carries 'default' => true.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@WebTigers WebTigers mentioned this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant