Fakultas Ilmu Komputer UI

Commit 12182cfa authored by Ken Reinhart's avatar Ken Reinhart
Browse files

Flagged material

parent 2221a24c
...@@ -185,7 +185,11 @@ div.review { ...@@ -185,7 +185,11 @@ div.review {
class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Baca</a> class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Baca</a>
<a href="{% url 'download-materi' materi_data.id %}" <a href="{% url 'download-materi' materi_data.id %}"
class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Unduh</a> class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Unduh</a>
<div class="dropdown"> <!--
<a href="{% url 'download-materi' materi_data.id %}"
class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Flag!</a>
-->
<div class="dropdown">
<button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded" type="button" <button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded" type="button"
id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Bagikan Bagikan
......
...@@ -77,11 +77,11 @@ ...@@ -77,11 +77,11 @@
</div> </div>
</header> </header>
<a href="/download-history/" class="btn-history">Riwayat Unduh</a><br><br>
<div id="container-materi-ordering"> <div id="container-materi-ordering">
<a href="?random=1" class="btn-materi-ordering">Acak Materi</a><br><br> <a href="?random=1" class="btn-materi-ordering">Acak Materi</a><br><br>
<a href="?recommendation=1" class="btn-materi-ordering">Rekomendasi</a><br><br> <a href="?recommendation=1" class="btn-materi-ordering">Rekomendasi</a><br><br>
<a href="/download-history/" class="btn-history">Riwayat Unduh</a><br><br>
<a href="/flagged-book/" class="btn-history">Flagged Book</a><br><br>
</div> </div>
<div class="container"> <div class="container">
...@@ -171,6 +171,7 @@ ...@@ -171,6 +171,7 @@
</p> </p>
<a href="{% url 'view-materi' item.id %}" class="btn btn-book">Baca</a> <a href="{% url 'view-materi' item.id %}" class="btn btn-book">Baca</a>
<a href="{% url 'detail-materi' item.id %}" class="btn btn-book">Detail</a> <a href="{% url 'detail-materi' item.id %}" class="btn btn-book">Detail</a>
<a href="{% url 'detail-materi' item.id %}" class="btn btn-book">Flag!</a>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
......
{% extends 'base.html' %}
{% load static %}
{% block title %}
<title>Flagged Book | Digipus</title>
{% endblock %}
{% block header %}
<link rel="icon" type="image/png" href="{% static 'images/icons/logo.ico' %}" />
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/button.css' %}">
<link href="{% static 'vendor/datatables/dataTables.bootstrap4.min.css' %}" rel="stylesheet">
{% endblock %}
{% block content %}
<br><br>
<h1 id="flagged_book" class="h3 mb-2 text-gray-800">Flagged Book | {{ user_name }}</h1>
{% if riwayat_list %}
<p class="mb-4">Tekan tombol detail untuk informasi lebih lanjut tentang materi</p>
<div class="card shadow mb-4">
<div class="card-body">
<div class="table-responsive">
<table aria-describedby="flagged_book" class="table table-bordered" id="dataTable">
<thead>
<tr>
<th id="judul_materi">Judul Materi</th>
<th id="author">Pembuat Materi</th>
<th id="detail_buttons">Detail</th>
</tr>
</thead>
<tbody>
{% for riwayat in riwayat_list %}
<tr>
<td>{{riwayat.materi.title}}</td>
<td>{{riwayat.materi.author}}</td>
<td>{{riwayat.timestamp|date:"d F Y H:i:s"}}</td>
<td class="verif-buttons">
<span>
<a href="/materi/{{riwayat.materi.id}}/" class="accept-button button-decoration"
style="background-color:#4e73df">Detail</a>
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<p class="mb-4">Tidak ada buku yang ditandai untuk dilaporkan. Silahkan tandai materi yang isinya tidak sesuai dengan judulnya.</p>
{% endif %}
<span>
<a href="/" class="btn btn-primary main-content" style="background-color:#4e73df; right: 0px;">Back to Katalog</a>
</span>
<br>
{% endblock %}
\ No newline at end of file
...@@ -684,6 +684,22 @@ class DownloadHistoryView(TemplateView): ...@@ -684,6 +684,22 @@ class DownloadHistoryView(TemplateView):
DownloadHistoryService.init_data_guest_user(context, request) DownloadHistoryService.init_data_guest_user(context, request)
return self.render_to_response(context) return self.render_to_response(context)
class FlaggedBookView(TemplateView):
template_name = "flagged_book.html"
def get_context_data(self, **kwargs):
context = super(FlaggedBookView, self).get_context_data(**kwargs)
return context
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
if request.user.is_authenticated:
current_user = self.request.user
DownloadHistoryService.init_data_authenticated_user(context, current_user)
else:
DownloadHistoryService.init_data_guest_user(context, request)
return self.render_to_response(context)
def save_to_gdrive(request, pk): def save_to_gdrive(request, pk):
materi = get_object_or_404(Materi, pk=pk) materi = get_object_or_404(Materi, pk=pk)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment