codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

refactor(pages): move the Pages settings script into web_src #199

Merged
pat-s merged 1 commit from enh/pages-settings-script into v16.0/forgejo-codefloe 2026-10-01 09:49:34 +00:00
Owner

Closes #190.

Moves the roughly 380 lines of inline JavaScript and the <style> block out of templates/repo/settings/codefloe_pages.tmpl into web_src/js/codefloe/pages-settings.js (registered from web_src/js/codefloe/index.js) and web_src/css/codefloe/pages-settings.css.

Changes

  • alert() with hard-coded English is now showErrorToast with two new locale strings (repo.settings.pages.primary_remove_blocked, repo.settings.pages.primary_required), passed through data-* attributes on #domains-list.
  • The hard-coded title="Remove domain" is now repo.settings.pages.remove_domain.
  • The managed-address copy button uses the global data-clipboard-target listener, so its hard-coded 'Copied!' is gone and the feedback is the localised tooltip.
  • Status and log requests go through modules/fetch.js; the log copy button uses clippie.
  • New domain rows are cloned from a <template> instead of innerHTML, and the inline onclick="return false;" is gone (the disabled link has no href). Removal is one delegated listener instead of re-cloning every button on each add.
  • The two submit handlers (domain validation and the loading state) are merged into one, so their ordering no longer depends on script position.
  • Inline style="..." attributes are tw- classes; the remove button sizing moved into the CSS file.
  • word-break: break-word became overflow-wrap: anywhere to satisfy stylelint.
  • templates/admin/codefloe_pages.tmpl has no inline script or styles, so it is unchanged.

Verification

  • New web_src/js/codefloe/pages-settings.test.js (9 tests): domain serialisation, primary validation, add/remove rows, deleted-domain tracking, status rendering and failure, lazy log loading and colour validation.
  • Drove the page in Chromium against a local sqlite instance with a git-pages backend: status rendered, the primary-removal toast showed, a new row was added and an existing one removed, the managed address reached the clipboard, the posted domains_json/deleted_domains were correct, the log tab loaded, and there were no console errors.
Closes #190. Moves the roughly 380 lines of inline JavaScript and the `<style>` block out of `templates/repo/settings/codefloe_pages.tmpl` into `web_src/js/codefloe/pages-settings.js` (registered from `web_src/js/codefloe/index.js`) and `web_src/css/codefloe/pages-settings.css`. ## Changes - `alert()` with hard-coded English is now `showErrorToast` with two new locale strings (`repo.settings.pages.primary_remove_blocked`, `repo.settings.pages.primary_required`), passed through `data-*` attributes on `#domains-list`. - The hard-coded `title="Remove domain"` is now `repo.settings.pages.remove_domain`. - The managed-address copy button uses the global `data-clipboard-target` listener, so its hard-coded `'Copied!'` is gone and the feedback is the localised tooltip. - Status and log requests go through `modules/fetch.js`; the log copy button uses `clippie`. - New domain rows are cloned from a `<template>` instead of `innerHTML`, and the inline `onclick="return false;"` is gone (the disabled link has no `href`). Removal is one delegated listener instead of re-cloning every button on each add. - The two submit handlers (domain validation and the loading state) are merged into one, so their ordering no longer depends on script position. - Inline `style="..."` attributes are `tw-` classes; the remove button sizing moved into the CSS file. - `word-break: break-word` became `overflow-wrap: anywhere` to satisfy stylelint. - `templates/admin/codefloe_pages.tmpl` has no inline script or styles, so it is unchanged. ## Verification - New `web_src/js/codefloe/pages-settings.test.js` (9 tests): domain serialisation, primary validation, add/remove rows, deleted-domain tracking, status rendering and failure, lazy log loading and colour validation. - Drove the page in Chromium against a local sqlite instance with a git-pages backend: status rendered, the primary-removal toast showed, a new row was added and an existing one removed, the managed address reached the clipboard, the posted `domains_json`/`deleted_domains` were correct, the log tab loaded, and there were no console errors.
pat-s force-pushed enh/pages-settings-script from 81ab7d9e5b
Some checks failed
testing / backend-checks (pull_request) Has been cancelled
testing / frontend-checks (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-pgsql (1/4) (pull_request) Has been cancelled
testing / test-pgsql (2/4) (pull_request) Has been cancelled
testing / test-pgsql (3/4) (pull_request) Has been cancelled
testing / test-pgsql (4/4) (pull_request) Has been cancelled
to a773bbc01f
All checks were successful
testing / test-e2e (pull_request) Successful in 37m55s
testing / frontend-checks (pull_request) Successful in 2m38s
testing / backend-checks (pull_request) Successful in 7m42s
testing / test-pgsql (2/4) (pull_request) Successful in 13m40s
testing / test-pgsql (1/4) (pull_request) Successful in 14m10s
testing / test-pgsql (3/4) (pull_request) Successful in 20m41s
testing / test-unit (pull_request) Successful in 14m0s
issue-labels / backporting (pull_request_target) Has been skipped
testing / test-pgsql (4/4) (pull_request) Successful in 17m10s
milestone / set (pull_request_target) Has been skipped
2026-10-01 07:50:30 +00:00
Compare
pat-s merged commit 174a767791 into v16.0/forgejo-codefloe 2026-10-01 09:49:34 +00:00
pat-s deleted branch enh/pages-settings-script 2026-10-01 09:49:34 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!199
No description provided.