diff --git a/frontends/ycdl_flask/templates/channel.html b/frontends/ycdl_flask/templates/channel.html
index 1d284a4..96d83d1 100644
--- a/frontends/ycdl_flask/templates/channel.html
+++ b/frontends/ycdl_flask/templates/channel.html
@@ -80,15 +80,17 @@
All (?q)
- Pending (?q)
- Ignored (?q)
- Downloaded (?q)
{% else %}
All (?q)
- Pending (?q)
- Ignored (?q)
- Downloaded (?q)
{% endif %}
+
+ {% for statename in all_states %}
+ {% if channel is not none %}
+ {{statename}} (?q)
+ {% else %}
+ {{statename}} (?q)
+ {% endif %}
+ {% endfor %}
{{videos|length}} items
@@ -288,7 +290,6 @@ function onclick_select(event)
}
}
-
for (var index = 0; index < video_cards.length; index += 1)
{
card = video_cards[index];
@@ -339,21 +340,22 @@ function action_button_passthrough(event, action_function, action_argument)
function give_action_buttons(video_card_div)
{
+ var toolbox = video_card_div.getElementsByClassName("action_toolbox")[0]
+ var buttons = Array.from(toolbox.getElementsByTagName("button"));
+ var is_pending = video_card_div.classList.contains("video_card_pending");
+ buttons.forEach(function(button)
+ {
+ if (is_pending)
+ { button.classList.remove("hidden"); }
+ else
+ { button.classList.add("hidden"); }
+ });
+
var button_pending = video_card_div.getElementsByClassName("video_action_pending")[0];
- var button_download = video_card_div.getElementsByClassName("video_action_download")[0];
- var button_ignore = video_card_div.getElementsByClassName("video_action_ignore")[0];
- if (video_card_div.classList.contains("video_card_pending"))
- {
- button_download.classList.remove("hidden");
- button_ignore.classList.remove("hidden");
- button_pending.classList.add("hidden");
- }
+ if (is_pending)
+ { button_pending.classList.add("hidden"); }
else
- {
- button_download.classList.add("hidden");
- button_ignore.classList.add("hidden");
- button_pending.classList.remove("hidden");
- }
+ { button_pending.classList.remove("hidden"); }
}
function receive_action_response(response)
@@ -364,21 +366,10 @@ function receive_action_response(response)
var video_id = video_ids[index];
var state = response['state'];
var card = document.getElementById("video_card_" + video_id);
- if (state == 'pending')
- {
- card.classList = ["video_card", "video_card_pending"].join(" ");
- card.style.backgroundColor = "#ffffaa";
- }
- else if (state == 'ignored')
- {
- card.classList = ["video_card", "video_card_ignored"].join(" ");
- card.style.backgroundColor = "#ffc886";
- }
- else if (state == 'downloaded')
- {
- card.classList = ["video_card", "video_card_downloaded"].join(" ");
- card.style.backgroundColor = "#aaffaa";
- }
+ {% for statename in all_states %}
+ card.classList.remove("video_card_{{statename}}");
+ {% endfor %}
+ card.classList.add("video_card_" + state);
give_action_buttons(card);
}
}
diff --git a/frontends/ycdl_flask/ycdl_flask/ycdl_flask.py b/frontends/ycdl_flask/ycdl_flask/ycdl_flask.py
index 4b05c08..948b223 100644
--- a/frontends/ycdl_flask/ycdl_flask/ycdl_flask.py
+++ b/frontends/ycdl_flask/ycdl_flask/ycdl_flask.py
@@ -180,8 +180,12 @@ def get_channel(channel_id=None, download_filter=None):
published = datetime.datetime.utcfromtimestamp(published)
published = published.strftime('%Y %m %d')
video['_published_str'] = published
+
+ all_states = ycdldb.get_all_states()
+
return flask.render_template(
'channel.html',
+ all_states=all_states,
channel=channel,
download_filter=download_filter,
query_string='?' + request.query_string.decode('utf-8'),