Files
rose-ash/blog/sxc/pages/renders.py
giles c71ca6754d Move blog composition from Python to .sx defcomps (Phase 4)
- Settings form: ~135 lines raw HTML → ~blog-settings-form-content defcomp
- Data introspection: ~110 lines raw HTML → ~blog-data-table-content with
  recursive ~blog-data-model-content defcomps, Python extracts ORM data only
- Preview: sx_call composition → ~blog-preview-content defcomp
- Entries browser: ~65 lines raw HTML → ~blog-entries-browser-content +
  ~blog-calendar-browser-item + ~blog-associated-entries-from-data defcomps
- Editor panels: sx_call composition in both helpers.py and renders.py →
  ~blog-editor-content and ~blog-edit-content composition defcomps
- renders.py: 178 → 25 lines (87% reduction)
- routes.py _render_associated_entries: data extraction → single sx_call

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 01:24:37 +00:00

26 lines
987 B
Python

"""Blog editor panel rendering."""
from __future__ import annotations
def render_editor_panel(save_error: str | None = None, is_page: bool = False) -> str:
"""Build the WYSIWYG editor panel for new post/page creation."""
from shared.browser.app.csrf import generate_csrf_token
from shared.sx.helpers import sx_call
from .helpers import _editor_urls, _editor_init_js
urls = _editor_urls()
csrf = generate_csrf_token()
title_placeholder = "Page title..." if is_page else "Post title..."
create_label = "Create Page" if is_page else "Create Post"
init_js = _editor_init_js(urls, form_id="post-new-form", has_initial_json=False)
return sx_call("blog-editor-content",
csrf=csrf,
title_placeholder=title_placeholder,
create_label=create_label,
css_href=urls["css_href"],
js_src=urls["js_src"],
sx_editor_js_src=urls["sx_editor_js_src"],
init_js=init_js,
save_error=save_error or None)