mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
basic routes and template for playlist page
This commit is contained in:
parent
bd37b653c2
commit
1bfb912d09
@ -39,6 +39,9 @@
|
||||
<a href="{% url 'channel' %}">
|
||||
<div class="nav-item">channels</div>
|
||||
</a>
|
||||
<a href="{% url 'playlist' %}">
|
||||
<div class="nav-item">playlists</div>
|
||||
</a>
|
||||
<a href="{% url 'downloads' %}">
|
||||
<div class="nav-item">downloads</div>
|
||||
</a>
|
||||
|
55
tubearchivist/home/templates/home/playlist.html
Normal file
55
tubearchivist/home/templates/home/playlist.html
Normal file
@ -0,0 +1,55 @@
|
||||
{% extends "home/base.html" %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<div class="title-bar">
|
||||
<h1>Playlists</h1>
|
||||
</div>
|
||||
<div class="info-box info-box-2">
|
||||
<div class="icon-text">
|
||||
{% if running == "subscribing" %}
|
||||
<p>Subscribing in progress, refresh.</p>
|
||||
{% else %}
|
||||
<img id="add-icon" onclick="showForm()" src="{% static 'img/icon-add.svg' %}" alt="add-icon">
|
||||
<p>Subscribe to Playlist</p>
|
||||
<div class="show-form">
|
||||
<form id="hidden-form" action="/playlist/" method="post">
|
||||
{% csrf_token %}
|
||||
{{ subscribe_form }}
|
||||
<button type="submit">Subscribe</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="search-form icon-text">
|
||||
<div class="search-icon">
|
||||
<img src="{% static 'img/icon-search.svg' %}" alt="search-icon" onclick="showSearch()">
|
||||
<p>Search your Playlists</p>
|
||||
</div>
|
||||
<form onSubmit="return playlistRedirect();" id="search-box">
|
||||
{% csrf_token %}
|
||||
{{ search_form }}
|
||||
<datalist id="resultBox">
|
||||
</datalist>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="view-controls">
|
||||
<div class="toggle">
|
||||
<span>Show only subscribed playlists:</span>
|
||||
<div class="toggleBox">
|
||||
<input
|
||||
id="show_subed_only" onclick="toggleCheckbox(this)" type="checkbox"
|
||||
{% if show_subed_only %}
|
||||
checked
|
||||
{% endif %}
|
||||
>
|
||||
<label for="" class="onbtn">On</label>
|
||||
<label for="" class="ofbtn">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="view-icons">
|
||||
<img src="{% static 'img/icon-gridview.svg' %}" onclick="changeView(this)" data-origin="playlist" data-value="grid" alt="grid view">
|
||||
<img src="{% static 'img/icon-listview.svg' %}" onclick="changeView(this)" data-origin="playlist" data-value="list" alt="list view">
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
@ -11,6 +11,7 @@ from home.views import (
|
||||
DownloadView,
|
||||
HomeView,
|
||||
LoginView,
|
||||
PlaylistView,
|
||||
SettingsView,
|
||||
VideoView,
|
||||
process,
|
||||
@ -44,4 +45,5 @@ urlpatterns = [
|
||||
login_required(VideoView.as_view()),
|
||||
name="video",
|
||||
),
|
||||
path("playlist/", login_required(PlaylistView.as_view()), name="playlist"),
|
||||
]
|
||||
|
@ -541,6 +541,28 @@ class ChannelView(View):
|
||||
return redirect("channel", permanent=True)
|
||||
|
||||
|
||||
class PlaylistView(View):
|
||||
"""resolves to /playlist/
|
||||
show all playlists indexed
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
"""handle http get requests"""
|
||||
view_config = self.read_config(user_id=request.user.id)
|
||||
context = {"title": "Playlists", "colors": view_config["colors"]}
|
||||
return render(request, "home/playlist.html", context)
|
||||
|
||||
@staticmethod
|
||||
def read_config(user_id):
|
||||
"""read config file"""
|
||||
config_handler = AppConfig(user_id)
|
||||
view_config = {
|
||||
"es_url": config_handler.config["application"]["es_url"],
|
||||
"colors": config_handler.colors,
|
||||
}
|
||||
return view_config
|
||||
|
||||
|
||||
class VideoView(View):
|
||||
"""resolves to /video/<video-id>/
|
||||
display details about a single video
|
||||
|
Loading…
Reference in New Issue
Block a user