From 278649e832bb4e61a3478f8838555529d4848934 Mon Sep 17 00:00:00 2001 From: Arjun Satarkar Date: Sun, 30 Jul 2023 15:39:24 +0530 Subject: Reduce unnecessary repetition in views --- serve.py | 4 ++-- views/add_feed.tpl | 9 ++++----- views/index.tpl | 12 ++++++------ views/manage_feed.tpl | 7 +------ views/tag_hover_help.tpl | 1 - views/tag_input.tpl | 6 ++++++ 6 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 views/tag_hover_help.tpl create mode 100644 views/tag_input.tpl diff --git a/serve.py b/serve.py index 7de1b52..63aea53 100755 --- a/serve.py +++ b/serve.py @@ -235,7 +235,7 @@ def update_feeds(run_event: threading.Event): feeds = core.get_feeds(limit=limit, offset=limit * i) for feed in feeds: parsed_feed, epoch_downloaded = tagrss.fetch_parsed_feed(feed["source"]) - logging.info(f"Fetched feed {feed['id']} (source {feed['source']}).") + logging.debug(f"Fetched feed {feed['id']} (source {feed['source']}).") with core_lock: try: core.store_feed_entries( @@ -246,7 +246,7 @@ def update_feeds(run_event: threading.Event): f"Failed to update feed {feed['id']} with source {feed['source']} " "due to constraint violation (feed already deleted?)." ) - logging.info("Finished updating feeds.") + logging.info("Finished updating all feeds.") inner_update() schedule.every(args.update_seconds).seconds.do(inner_update) diff --git a/views/add_feed.tpl b/views/add_feed.tpl index 0110bac..4b139d3 100644 --- a/views/add_feed.tpl +++ b/views/add_feed.tpl @@ -17,12 +17,11 @@ % end

Add a feed

- +
-
- - % include("tag_hover_help.tpl") -
+ % include("tag_input.tpl", input_name="tags")
% include("footer.tpl") diff --git a/views/index.tpl b/views/index.tpl index f65a1af..b00b7d0 100644 --- a/views/index.tpl +++ b/views/index.tpl @@ -61,12 +61,12 @@ % include("hover_help.tpl", text="Space-separated feed IDs.") -
- - % include("tag_hover_help.tpl") -
+ % include( + % "tag_input.tpl", + % label="Included tags:", + % input_name="included_tags", + % input_value=included_tags_str if included_tags_str else "" + % ) diff --git a/views/manage_feed.tpl b/views/manage_feed.tpl index 0ff127e..dce9dc5 100644 --- a/views/manage_feed.tpl +++ b/views/manage_feed.tpl @@ -42,12 +42,7 @@ -
- - % include("tag_hover_help.tpl") -
+ % include("tag_input.tpl", input_name="tags", input_value=feed["serialised_tags"])
diff --git a/views/tag_hover_help.tpl b/views/tag_hover_help.tpl deleted file mode 100644 index 9007e55..0000000 --- a/views/tag_hover_help.tpl +++ /dev/null @@ -1 +0,0 @@ -% include("hover_help.tpl", text="Space-separated. Backslashes escape spaces.") diff --git a/views/tag_input.tpl b/views/tag_input.tpl new file mode 100644 index 0000000..99145e9 --- /dev/null +++ b/views/tag_input.tpl @@ -0,0 +1,6 @@ +
+ + % include("hover_help.tpl", text="Space-separated. Backslashes escape spaces.") +
-- cgit v1.2.3-57-g22cb