Fakultas Ilmu Komputer UI

Commit 1f68d40e authored by Mika dabelza abi's avatar Mika dabelza abi
Browse files

Merge branch 'staging' of...

Merge branch 'staging' of https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-digipus/marjinal-digipus into Coldfix-Staging-StatusFilter
parents f77573c6 055ead5d
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Dasbor - Verifikasi Materi</title>
<!-- Custom fonts for this template -->
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/button.css' %}">
<!-- Custom styles for this page -->
<link href="{% static 'vendor/datatables/dataTables.bootstrap4.min.css' %}" rel="stylesheet">
</head>
<body id="page-top" style="font-family: 'Poppins', sans-serif;">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="verif.html">
<div class="sidebar-brand-icon rotate-n-15">
</div>
<div class="sidebar-brand-text mx-3">Digipus</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider my-0">
<!-- Nav Item - Dashboard -->
<li class="nav-item">
<a class="nav-link" href="/administration/">
<span>Verifikasi Materi</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">
<span>Daftar Kontributor</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">
<span>Statistik Materi</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider">
<li class="nav-item">
<a class="nav-link" href="/administration/setting/verification/">
<span>Pengaturan Verifikasi</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/administration/setting/category/">
<span>Pengaturan Kategori</span></a>
</li>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Nav Item - Search Dropdown (Visible Only XS) -->
<li class="nav-item dropdown no-arrow d-sm-none">
<a class="nav-link dropdown-toggle" href="#" id="searchDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-search fa-fw"></i>
</a>
<!-- Dropdown - Messages -->
<div class="dropdown-menu dropdown-menu-right p-3 shadow animated--grow-in"
aria-labelledby="searchDropdown">
<form class="form-inline mr-auto w-100 navbar-search">
<div class="input-group">
<input type="text" class="form-control bg-light border-0 small" placeholder="Search for..."
aria-label="Search" aria-describedby="basic-addon2">
<div class="input-group-append">
<button class="btn btn-primary" type="button">
<i class="fas fa-search fa-sm"></i>
</button>
</div>
</div>
</form>
</div>
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
<img class="img-profile rounded-circle" src="https://source.unsplash.com/QAB-WJcbgJk/60x60">
</a>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<div class="row materi-data">
<div class="col col-3 cover">
<img class="materi-image" src="{% static 'img/instagram.png' %}">
</div>
<div class="col col-6 ml-3 book">
<div class="category-wrapper">
</div>
<div class="info-wrapper">
<div class="info" id='1'>
<dt class="col col-4">
<p class="info-name">Deskripsi</p>
</dt>
<dd>
<p class="info-content">Loren ipsum</p>
</dd>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Penulis</p>
</dt>
<dd>
<p class="info-content">test</p>
</dd>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Penerbit</p>
</dt>
<dd>
<p class="info-content">test</p>
</dd>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Jumlah Halaman</p>
</dt>
<dd>
<p class="info-content">test</p>
</dd>
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Ukuran File</p>
</dt>
<dd>
<p class="info-content">396.2 KB</p>
</dd>
</div>
</div>
<a href="/materi/1/view" class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Baca</a>
<a href="/materi/1/unduh" class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Unduh</a>
<button class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Bagikan</button>
</div>
</div>
</div>
<!-- /.container-fluid -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Point Verifikasi Materi</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Judul Verifikasi</th>
<th>Deskripsi</th>
<th>Tombol</th>
</tr>
</thead>
<tbody>
<tr>
<th>Kriteria 1</th>
<th>Materi harus memenuhi kriteria 1</th>
<th>
<button class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Setuju</button>
<button class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Tolak</button>
</th>
</tr>
<tr>
<th>Kriteria 2</th>
<th>Materi harus memenuhi kriteria 2</th>
<th>
<button class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Setuju</button>
<button class="btn btn-link btn-book shadow-sm p-2 mb-1 bg-white rounded">Tolak</button>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; Diskominfo Kota Depok 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Bootstrap core JavaScript-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<!-- Core plugin JavaScript-->
<script src="https://code.jquery.com/jquery-3.5.0.min.js"
integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
<!-- Custom scripts for all pages-->
<script src="{% static 'js/sb-admin-2.min.js' %}"></script>
<!-- Page level plugins -->
<script src="{% static 'vendor/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'vendor/datatables/dataTables.bootstrap4.min.js' %}"></script>
<!-- Page level custom scripts -->
<script src="{% static 'js/demo/datatables-demo.js' %}"></script>
</body>
</html>
\ No newline at end of file
{% extends 'app/detail_materi.html' %}
{% block title %}
Pratinjau Materi
{% endblock title %}
{% block verification %}
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<div class="sidebar-brand-text mx-3">Pratinjau Materi</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<button data-toggle="modal" data-target="#myModal" id="checklistButton" class="btn"
style="background-color:#4e73df;color: azure;">
Tampilkan Kriteria
</button>
</li>
</ul>
</nav>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-xl">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Kriteria Verifikasi</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
{% if error %}
<h4>Terjadi Kesalahan, coba lagi.</h4>
{% endif %}
{% for kriteria in kriteria_list %}
<div class="row m-2">
<div class="col-8">
{{kriteria.title}}
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input id="kriteria{{ forloop.counter }}Ya" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input kriteria-ok" value=1>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Ya">Ya</label>
</div>
</div>
<div class="col-2">
<div class="custom-control custom-radio custom-control-inline">
<input checked id="kriteria{{ forloop.counter }}Tidak" type="radio"
name="kriteria{{ forloop.counter }}" class="custom-control-input" value=0>
<label class="custom-control-label" for="kriteria{{ forloop.counter }}Tidak">Tidak</label>
</div>
</div>
</div>
{% endfor %}
<span><small>Kontributor tidak dapat melihat point-point verifikasi, jika materi ditolak tuliskan alasan
penolakan tersebut di kolom tanggapan.</small></span>
<hr>
<form method="POST" id="submitForm">
{% csrf_token %}
<label for="feedbackMateri">Tanggapan terhadap materi untuk Kontributor :</label>
<textarea name="feedback" id="feedbackMateri" class="form-control" rows="6"></textarea>
</form>
</div>
<div class="modal-footer">
<button disabled class="accept-button btn" type="submit" name="action" value="approve" form="submitForm"
style="background-color: #28a745;border-radius: .25rem;color: azure;"
id="approveButton">Terima</button>
<button disabled class="reject-button btn" type="submit" name="action" value="disapprove"
form="submitForm" style="background-color: #dc3545;border-radius: .25rem;color: azure;"
id="disapproveButton">Tolak</button>
<button type="button" class="btn" data-dismiss="modal">Tutup</button>
</div>
</div>
</div>
</div>
{% endblock verification %}
{% block extra_scripts %}
<script>
function cekRadio() {
res = true
x = document.getElementsByClassName("kriteria-ok")
for (index = 0; index < x.length; index++) {
if (x[index].checked == false) {
res = false;
break;
}
}
return res;
}
function cekFeedback() {
if (!$.trim($("#feedbackMateri").val())) {
return false;
} else {
return true;
}
}
$(document).ready(function () {
var approveButton = document.getElementById("approveButton")
var disapproveButton = document.getElementById("disapproveButton")
$(":input").change(function () {
console.log("Running test")
var statusRadio = cekRadio();
var statusFeedback = cekFeedback();
if (statusFeedback) {
disapproveButton.disabled = false;
if (statusRadio) {
approveButton.disabled = false;
} else {
approveButton.disabled = true;
}
} else {
disapproveButton.disabled = true;
approveButton.disabled = true;
}
});
});
</script>
{% endblock extra_scripts %}
\ No newline at end of file
......@@ -210,9 +210,7 @@
<i class="fas fa-angle-up"></i>
</a>
<!-- Bootstrap core JavaScript-->
<!-- <script src="{% static 'vendor/jquery/jquery.min.js' %}"></script> -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
......@@ -222,19 +220,18 @@
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<!-- Core plugin JavaScript-->
<script src="https://code.jquery.com/jquery-3.5.0.min.js"
integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
<!-- Custom scripts for all pages-->
<script src="{% static 'js/sb-admin-2.min.js' %}"></script>
<!-- Page level plugins -->
<script src="{% static 'vendor/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'vendor/datatables/dataTables.bootstrap4.min.js' %}"></script>
<!-- Page level custom scripts -->
<script src="{% static 'js/demo/datatables-demo.js' %}"></script>
<script src="{% static 'js/demo/datatables-demo.js' %}"></script> -->
</body>
......
......@@ -149,29 +149,40 @@
<th>Judul Materi</th>
<th>Nama Kontributor</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for materi in materi_list %}
<tr>
<td><a href="?kategori={{itemKategori.pk}}">{{ materi.title }}</a></td>
<td>{{ materi.uploader.name }}</td>
<td>
{{ materi.status.13 }}{{ materi.status.14 }}{{ materi.status.15 }}{{ materi.status.16 }}{{ materi.status.17 }}{{ materi.status.18 }}{{ materi.status.19 }}{{ materi.status.20 }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Judul Materi</th>
<th>Nama Kontributor</th>
<th>Status</th>
<th> </th>
</tr>
</tfoot>
<tbody>
{% for materi in materi_list %}
<tr>
{% for materi in materi_list %}
<td>{{ materi.tittle }}</td>
<td>{{ materi.title }}</td>
<td>{{ materi.uploader.name }}</td>
<td>{{ materi.status.1 }}</td>
{% if materi.status.0 == "PENDING" %}
<td class="verif-buttons"><a href="/administration/api/approve/{{materi.id}}/" class="accept-button">Terima</a><a href="/administration/api/disapprove/{{materi.id}}/"
class="reject-button">Tolak</a></td>
<td>{{ materi.status.label }}</td>
{% if materi.status == "PENDING" %}
<td class="verif-buttons">
<a href="/administration/detail-verif/{{materi.id}}/" class="accept-button"
style="background-color:#4e73df">Detail</a>
<a href="/administration/api/approve/{{materi.id}}/" class="accept-button">Terima</a>
<a href="/administration/api/disapprove/{{materi.id}}/" class="reject-button">Tolak</a></td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
......@@ -206,7 +217,6 @@
</a>
<!-- Bootstrap core JavaScript-->
<!-- <script src="{% static 'vendor/jquery/jquery.min.js' %}"></script> -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
......
......@@ -3,39 +3,96 @@ from django.test import Client, TestCase
from django.urls import resolve
from administration import models, views
from app.models import Materi
from app.models import Materi, Category
class VerifikasiMateriTest(TestCase):
def setUp(self):
self.client = Client()
self.url = "/administration/setting/verification/"
self.model = models.VerificationSetting
self.admin = get_user_model().objects.create_user(
password="admin123", email="admin@admin.com", is_admin=True)
self.contributor = get_user_model().objects.create_user(
password="kontributor123", email="kontributor@kontributor.com", is_contributor=True
)
self.materi = Materi(title="LK 3", author="Agas", uploader=self.contributor,
publisher="Kelas SC", descriptions="COntoh pengerjaan LK 3", status="PENDING").save()
# def test_verifikasi_materi_url_exist(self):
# response = self.client.get('/administration/')
# self.assertEqual(response.status_code, 200)
def test_verifikasi_materi_url_exist(self):
# Login
self.client.login(email="admin@admin.com",
password="admin123")
response = self.client.get('/administration/')
self.assertEqual(response.status_code, 200)
# def test_verifikasi_materi_using_correct_template(self):
# found = resolve('/administration/')
# self.assertEqual(found.func.__name__, views.verification.__name__)
def test_verifikasi_materi_using_correct_template(self):
# Login
self.client.login(email="admin@admin.com",
password="admin123")
found = resolve('/administration/')
self.assertEqual(found.func.__name__, views.VerificationView.__name__)
# found2 = resolve('/admin/')
# self.assertNotEqual(found2.func.__name__, views.verification.__name__)
def test_verifikasi_materi_title(self):
# Login
self.client.login(email="admin@admin.com",
password="admin123")
response = self.client.get('/administration/')
# def test_verifikasi_materi_title(self):
# response = self.client.get('/administration/')
self.assertContains(response, 'Dasbor - Verifikasi Materi')
# self.assertContains(response, 'Dasbor - Verifikasi Materi')
self.assertNotContains(response, 'Fake Title')
# self.assertNotContains(response, 'Fake Title')
def test_verifikasi_materi_content(self):
# Login
self.client.login(email="admin@admin.com",
password="admin123")
response = self.client.get('/administration/')
# def test_verifikasi_materi_content(self):
# response = self.client.get('/administration/')
self.assertContains(response, 'LK 3')
self.assertContains(response, self.contributor.name)
# self.assertContains(response, 'Judul Materi')
# self.assertContains(response, 'Nama Kontributor')
# self.assertContains(response, 'Status')
self.assertNotContains(response, 'Halaman Katalog')
# self.assertNotContains(response, 'Halaman Katalog')
class DetailVerifikasiMateriTest(TestCase):
def setUp(self):
self.client = Client()
self.view = views.DetailVerificationView
self.template_name = "detai_verif.html"
self.model = models.VerificationSetting
self.admin = get_user_model().objects.create_user(
password="admin123", email="admin@admin.com", is_admin=True)
self.contributor = get_user_model().objects.create_user(
password="kontributor123", email="kontributor@kontributor.com", is_contributor=True
)
self.materi = Materi(id = 1, title="LK 3", author="Agas", uploader=self.contributor,
publisher="Kelas SC", descriptions="COntoh pengerjaan LK 3", status="PENDING").save()
self.url = f"/administration/detail-verif/1/"
def test_dashboard_kontributor_view(self):
found = resolve(self.url)
self.assertEqual(found.func.__name__, self.view.as_view().__name__)
def test_dashboard_kontributor_template(self):
# Login
self.client.login(email="admin@admin.com",