ycdl/frontends/ycdl_flask/templates/channels.html

117 lines
2.8 KiB
HTML
Raw Normal View History

2016-11-29 04:16:16 +00:00
<!DOCTYPE html5>
<html>
<head>
{% import "header.html" as header %}
<title>Channels</title>
<meta charset="UTF-8">
2020-01-07 05:55:01 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/static/css/common.css">
<script src="/static/js/common.js"></script>
2020-06-17 21:13:33 +00:00
<script src="/static/js/api.js"></script>
<script src="/static/js/spinner.js"></script>
2016-11-29 04:16:16 +00:00
<style>
#content_body
{
display: flex;
2016-12-07 06:11:09 +00:00
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto;
2016-11-29 04:16:16 +00:00
flex-direction: column;
2016-12-07 06:11:09 +00:00
width: 1440px;
margin: auto;
max-width: 100%;
2016-11-29 04:16:16 +00:00
}
#new_channel_textbox,
#new_channel_button
{
width: 200px;
}
.channel_card_no_pending,
2016-11-29 04:16:16 +00:00
.channel_card_pending
{
margin: 8px;
padding: 10px;
border-radius: 4px;
border: 1px solid #000;
}
.channel_card_pending
{
background-color: #ffffaa;
}
.channel_card_no_pending
2016-11-29 04:16:16 +00:00
{
background-color: #aaffaa;
}
</style>
</head>
<body>
{{header.make_header()}}
<div id="content_body">
<span><button class="refresh_button button_with_spinner" onclick="refresh_all_channels_form(false)">Refresh new videos</button></span>
<span><button class="refresh_button button_with_spinner" onclick="refresh_all_channels_form(true)">Refresh everything</button></span>
2016-11-29 04:16:16 +00:00
<div>
<input type="text" id="new_channel_textbox">
<button id="new_channel_button" onclick="add_channel_form(event)">Add new channel</button>
2016-11-29 04:16:16 +00:00
</div>
{% for channel in channels %}
{% if channel.has_pending() %}
2016-11-29 04:16:16 +00:00
<div class="channel_card_pending">
{% else %}
<div class="channel_card_no_pending">
2016-11-29 04:16:16 +00:00
{% endif %}
<a href="/channel/{{channel.id}}">{{channel.name}}</a> <a href="/channel/{{channel.id}}/pending">(p)</a>
{% if channel.automark not in [none, "pending"] %}
<span>automark: {{channel.automark}}</span>
{% endif %}
2016-11-29 04:16:16 +00:00
</div>
{% endfor %}
</div>
</body>
<script type="text/javascript">
var box = document.getElementById('new_channel_textbox');
var button = document.getElementById('new_channel_button');
common.bind_box_to_button(box, button);
2016-11-29 04:16:16 +00:00
function add_channel_form(event)
2016-11-29 04:16:16 +00:00
{
if (box.value !== "")
{
2020-06-03 20:00:44 +00:00
api.channels.add_channel(box.value, add_channel_callback);
2016-11-29 04:16:16 +00:00
}
}
function add_channel_callback(response)
2016-11-29 04:16:16 +00:00
{
if (response["meta"]["status"] == 200)
{
window.location.href = "/channel/" + response["data"]["id"];
}
else
{
alert(JSON.stringify(response));
}
}
function refresh_all_channels_form(force)
{
console.log(`Refreshing all channels, force=${force}.`);
api.channels.refresh_all_channels(force, refresh_all_channels_callback)
}
function refresh_all_channels_callback(response)
{
if (response["meta"]["status"] == 200)
{
common.refresh();
}
else
{
alert(JSON.stringify(response));
}
}
2016-11-29 04:16:16 +00:00
</script>
</html>