Enhance newsletter functionality and UI improvements
- Introduce `create_outlook_html` function for generating Outlook-compatible newsletter HTML. - Update dashboard to include `outlook_html` in the response. - Modify newsletter generation logic to support separate handling of Outlook HTML. - Improve CSS styles for newsletter preview and layout adjustments. - Add new button for downloading HTML directly from the dashboard.
This commit is contained in:
@@ -22,6 +22,7 @@ from app.services.newsletter import (
|
||||
DEFAULT_DISPLAY,
|
||||
article_url,
|
||||
create_html,
|
||||
create_outlook_html,
|
||||
create_plain_text,
|
||||
create_subject,
|
||||
filter_articles,
|
||||
@@ -189,6 +190,7 @@ async def dashboard(request: Request, db: Session = Depends(get_db), current_use
|
||||
"articles_new": [],
|
||||
"articles_edited": [],
|
||||
"raw_html": "",
|
||||
"outlook_html": "",
|
||||
"plain_text": "",
|
||||
"filters": {
|
||||
"days": 30,
|
||||
@@ -226,6 +228,7 @@ async def dashboard_generate(
|
||||
articles_edited: list = []
|
||||
plain_text = ""
|
||||
raw_html = ""
|
||||
outlook_html = ""
|
||||
try:
|
||||
articles = await wiki_service.get_recent_changes(days=days, only_edited=only_edited_flag)
|
||||
filtered = filter_articles(articles, category_filter=category or None)
|
||||
@@ -233,6 +236,7 @@ async def dashboard_generate(
|
||||
title = create_subject(days, category)
|
||||
plain_text = create_plain_text(filtered, days, display, category)
|
||||
raw_html = create_html(filtered, days, display, category)
|
||||
outlook_html = create_outlook_html(filtered, days, display, category)
|
||||
run_scheduled_send_if_due(db, title, raw_html, plain_text)
|
||||
except WikiFetchError as exc:
|
||||
wiki_error = exc.message
|
||||
@@ -243,6 +247,7 @@ async def dashboard_generate(
|
||||
"articles_new": articles_new,
|
||||
"articles_edited": articles_edited,
|
||||
"raw_html": raw_html,
|
||||
"outlook_html": outlook_html,
|
||||
"plain_text": plain_text,
|
||||
"filters": {
|
||||
"days": days,
|
||||
|
||||
Reference in New Issue
Block a user