aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorArjun Satarkar <me@arjunsatarkar.net>2023-07-30 10:09:24 +0000
committerArjun Satarkar <me@arjunsatarkar.net>2023-07-30 10:09:24 +0000
commit278649e832bb4e61a3478f8838555529d4848934 (patch)
treebd8d1283cbbeaa201cc7d39d0a025f4e7c5f389a /views
parent178b26030f56bd600c5efa33cffa2758f20a7639 (diff)
downloadtagrss-278649e832bb4e61a3478f8838555529d4848934.tar
tagrss-278649e832bb4e61a3478f8838555529d4848934.tar.gz
tagrss-278649e832bb4e61a3478f8838555529d4848934.zip
Reduce unnecessary repetition in views
Diffstat (limited to 'views')
-rw-r--r--views/add_feed.tpl9
-rw-r--r--views/index.tpl12
-rw-r--r--views/manage_feed.tpl7
-rw-r--r--views/tag_hover_help.tpl1
-rw-r--r--views/tag_input.tpl6
5 files changed, 17 insertions, 18 deletions
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
<h1>Add a feed</h1>
<form method="post">
- <input type="url" placeholder="Feed source" name="feed_source">
+ <label>Source:
+ <input type="url" name="feed_source">
+ </label>
<br>
- <div class="side-by-side-help-container">
- <input type="text" placeholder="Tags" name="tags">
- % include("tag_hover_help.tpl")
- </div>
+ % include("tag_input.tpl", input_name="tags")
<input type="submit" value="Add">
</form>
% 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 @@
</label>
% include("hover_help.tpl", text="Space-separated feed IDs.")
</div>
- <div class="side-by-side-help-container">
- <label>Included tags:
- <input type="text" name="included_tags" value="{{included_tags_str if included_tags_str else ''}}">
- </label>
- % include("tag_hover_help.tpl")
- </div>
+ % include(
+ % "tag_input.tpl",
+ % label="Included tags:",
+ % input_name="included_tags",
+ % input_value=included_tags_str if included_tags_str else ""
+ % )
<input type="submit" value="Filter">
<input type="number" value="{{page_num}}" min="1" max="{{total_pages}}" name="page_num" style="display: none;">
<input type="number" value="{{per_page}}" min="1" max="{{max_per_page}}" name="per_page" style="display: none;">
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 @@
<label>Source:
<input type="text" name="source" value="{{feed['source']}}"><br>
</label>
- <div class="side-by-side-help-container">
- <label>Tags:
- <input type="text" name="tags" value="{{feed['serialised_tags']}}">
- </label>
- % include("tag_hover_help.tpl")
- </div>
+ % include("tag_input.tpl", input_name="tags", input_value=feed["serialised_tags"])
<input type="submit" value="Update" name="update_feed">
</form>
<hr>
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 @@
+<div class="side-by-side-help-container">
+ <label>{{get("label", "Tags:")}}
+ <input type="text" name="{{input_name}}" value="{{get('input_value', '')}}">
+ </label>
+ % include("hover_help.tpl", text="Space-separated. Backslashes escape spaces.")
+</div>