Commit Graph
5 Commits
Author SHA1 Message Date
KenanZhuandClaude Opus 4.8 fe77d52b5b refactor(preview): unified message notification component
Replace ad-hoc #static-notice with reusable .message system:
- .message — base notification bar, spans full width below navbar
- .message-warn — amber/yellow warning (static mode notice)
- .message-error — red error (missing rendered.js, dev disconnect)
- showMessage(html, type) / clearMessages() helpers
- Messages stack vertically in #messages container
- Static notice auto-shown on page load; cleared on dev ws connect
- Dev reconnect/disconnect events shown as error messages

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:17:16 +08:00
KenanZhuandClaude Opus 4.8 dc07b54625 fix(preview): simplify transform, fix static-notice display
- transform(): only Raw mode does HTML escaping. Modern, Gmail, Outlook
  all show the same rendered HTML — in dev mode Juice handles CSS
  inlining server-side; in static mode the notice bar warns.
- static-notice: change display from '' to 'block' to properly
  override CSS rule #static-notice{display:none}. The empty string
  did not override the stylesheet rule in static file:// mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:09:27 +08:00
KenanZhuandClaude Opus 4.8 13c49d2087 fix(preview): static-notice, simplify transform, HTML-safe rendering
- Add static-notice banner: 'Gmail/Outlook simulation is approximate.
  Use dev mode for accurate rendering.' Hidden in dev mode via
  WebSocket try/catch, auto-shown in file:// mode on WS failure.
- Simplify transform(): Gmail/Outlook modes now return same HTML as
  Modern — the dev server with Juice provides actual client sim.
- Add markSafeHTML(): converts RenderedNote/Body/RenderedContent
  from plain string to template.HTML so markdown-rendered HTML
  content is not escaped by Go's html/template engine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:51:43 +08:00
KenanZhuandClaude Opus 4.8 0bf982ffb9 refactor(tools): modularize CLI with urfave/cli/v2, externalise template metadata
- Split monolithic build-preview.go into modular packages:
  tools.go (entry), cli/ (list/create/delete/preview commands),
  config/ (JSON loading), preview/ (rendering engine, funcs, locale)
- Extract all template metadata into data/templates_config.json
  as single source of truth — no hardcoded template data in Go
- Replace hand-rolled CLI parsing with github.com/urfave/cli/v2
- Add sensible defaults for --folder (../themes) and --config
  (./data/templates_config.json) — most commands now run bare
- Add type-coercing gt/lt/ge/le template funcs for JSON float64
- Fix AppUrl to gitea.com matching official template convention
- rendered.js now exports __REGISTRY__ and __PARAMS__ alongside
  __RENDERED__ — preview/index.html reads all from single source
- Cross-validate all 11 template data contexts against official
  Gitea source (services/mailer/*.go + templates/mail/*.tmpl)
- Update all docs (README, AGENTS, CONTRIBUTING, 5 languages)
  to reflect new CLI workflow with create scaffolding command

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 12:26:44 +08:00
KenanZhuandClaude Opus 4.8 a2742887e8 chore(init): scaffold Gitea mail templates — 110 templates, 10 visual styles, drop-in deployment
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 18:10:22 +08:00