Fakultas Ilmu Komputer UI

Commit b0d2ff7d authored by Nandhika Prayoga's avatar Nandhika Prayoga
Browse files

Merge branch 'master' into '1706039912-41'

# Conflicts:
#   app/tests.py
#   app/views.py
parents 3c733918 fc2849fa
Pipeline #58759 passed with stages
in 15 minutes and 43 seconds
......@@ -15,6 +15,7 @@ media
/static/
media/
.coverage
virtualenv
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
......
......@@ -68,7 +68,7 @@
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
<em class="fas fa-angle-up"></em>
</a>
......
......@@ -4,6 +4,7 @@
<html lang="en">
<!-- Static assets -->
<head>
<title>Digipus</title>
<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">
......@@ -67,7 +68,7 @@
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
<em class="fas fa-angle-up"></em>
</a>
......
......@@ -28,7 +28,7 @@
<div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.0}}</div>
</div>
<div class="col-auto">
<i class="fas fa-eye" aria-hidden="true"></i>
<em class="fas fa-eye" aria-hidden="true"></em>
</div>
</div>
</div>
......@@ -45,7 +45,7 @@
<div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.1}}</div>
</div>
<div class="col-auto">
<i class="fas fa-download" aria-hidden="true"></i>
<em class="fas fa-download" aria-hidden="true"></em>
</div>
</div>
</div>
......@@ -62,7 +62,7 @@
<div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.2}}</div>
</div>
<div class="col-auto">
<i class="fas fa-thumbs-up" aria-hidden="true"></i>
<em class="fas fa-thumbs-up" aria-hidden="true"></em>
</div>
</div>
</div>
......@@ -79,7 +79,7 @@
<div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.3}}</div>
</div>
<div class="col-auto">
<i class="fas fa-comments fa-2x text-gray-300"></i>
<em class="fas fa-comments fa-2x text-gray-300"></em>
</div>
</div>
</div>
......@@ -100,7 +100,7 @@
<!-- <div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
<em class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></em>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in"
aria-labelledby="dropdownMenuLink">
......
......@@ -19,31 +19,46 @@
<h4>{{ user.email }}</h4>
<h4>{{ user.biography }}</h4>
<div class="profile-margin"></div>
<table>
<tr>
<td class="profile-data">Instansi</td>
<td>{{ user.instansi }}</td>
</tr>
<td class="profile-data">LinkedIn</td>
<td><a href="https://linkedin.com">{{ user.linkedin }}</a></td>
</tr>
<tr>
<td class="profile-data">Facebook</td>
<td><a href="https://facebook.com">{{ user.facebook }}</a></td>
</tr>
<tr>
<td class="profile-data">Twitter</td>
<td><a href="https://twitter.com">{{ user.twitter }}</a></td>
</tr>
<tr>
<td class="profile-data">Instagram</td>
<td><a href="https://instagram.com">{{ user.instagram }}</a></td>
</tr>
</table>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
instansi
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
{{user.instansi}}
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
LinkedIn
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://linkedin.com">{{ user.linkedin }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Facebook
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://facebook.com">{{ user.facebook }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Twitter
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://twitter.com">{{ user.twitter }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Instagram
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://instagram.com">{{ user.instagram }}</a>
</div>
</div>
<a class="btn btn-primary btn-admin" href="/administration/kelola-admin/">Kembali ke Kelola Admin</a>
</div>
</div>
......
......@@ -18,31 +18,46 @@
<h4>{{ user.email }}</h4>
<h4>{{ user.biography }}</h4>
<div class="profile-margin"></div>
<table>
<tr>
<td class="profile-data">Instansi</td>
<td>{{ user.instansi }}</td>
</tr>
<td class="profile-data">LinkedIn</td>
<td><a href="https://linkedin.com">{{ user.linkedin }}</a></td>
</tr>
<tr>
<td class="profile-data">Facebook</td>
<td><a href="https://facebook.com">{{ user.facebook }}</a></td>
</tr>
<tr>
<td class="profile-data">Twitter</td>
<td><a href="https://twitter.com">{{ user.twitter }}</a></td>
</tr>
<tr>
<td class="profile-data">Instagram</td>
<td><a href="https://instagram.com">{{ user.instagram }}</a></td>
</tr>
</table>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
instansi
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
{{user.instansi}}
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
LinkedIn
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://linkedin.com">{{ user.linkedin }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Facebook
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://facebook.com">{{ user.facebook }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Twitter
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://twitter.com">{{ user.twitter }}</a>
</div>
</div>
<div class="row">
<div class="col-md-6 my-auto" style="font-size: 2rem;">
Instagram
</div>
<div class="col-md-6 my-auto" style="font-size: 1.2rem;">
<a href="https://instagram.com">{{ user.instagram }}</a>
</div>
</div>
<a class="btn btn-primary btn-admin" href="/administration/kelola-kontributor/">Kembali ke Kelola Kontributor</a>
</div>
</div>
......
......@@ -8,7 +8,7 @@ Pratinjau Materi
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
<em class="fa fa-bars"></em>
</button>
<div class="sidebar-brand-text mx-3">Pratinjau Materi</div>
......@@ -53,7 +53,7 @@ Pratinjau Materi
<div class="info-wrapper">
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Verifikatur</p>
<p class="info-name"><strong>Verifikatur</strong></p>
</dt>
<dd>
<p class="info-content">{{verification_report.user.name}}</p>
......@@ -61,7 +61,7 @@ Pratinjau Materi
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Waktu Verifikasi</p>
<p class="info-name"><strong>Waktu Verifikasi</strong></p>
</dt>
<dd>
<p class="info-content">{{verification_report.timestamp}}</p>
......@@ -69,7 +69,7 @@ Pratinjau Materi
</div>
<div class="info" id="1">
<dt class="col col-4">
<p class="info-name">Status Materi</p>
<p class="info-name"><strong>Status Materi</strong></p>
</dt>
<dd>
<p class="info-content">{{verification_report.status}}</p>
......
......@@ -15,7 +15,7 @@
<div class="card-header py-3">
<div class="d-flex">
<div class="mr-auto p-2">
<h6 class="m-0 font-weight-bold text-primary">Tabel Daftar Admin</h6>
<h6 id="table-description" class="m-0 font-weight-bold text-primary">Tabel Daftar Admin</h6>
</div>
<div class="p-2">
<a href="/administration/kelola-admin/tambah/" class="accept-button button-decoration button-header">Buat Akun Baru</a>
......@@ -24,7 +24,7 @@
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<table aria-describedby="table-description" class="table table-bordered" id="dataTable">
<thead>
<tr>
<th scope="col">Nama</th>
......
......@@ -13,25 +13,25 @@
<!-- DataTales Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Tabel Daftar Kontributor</h6>
<h6 id="table-description" class="m-0 font-weight-bold text-primary">Tabel Daftar Kontributor</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<table aria-describedby="table-description" class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Nama</th>
<th>NIK</th>
<th>Instansi</th>
<th>Detail</th>
<th scope="col">Nama</th>
<th scope="col">NIK</th>
<th scope="col">Instansi</th>
<th scope="col">Detail</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Nama</th>
<th>NIK</th>
<th>Instansi</th>
<th>Detail</th>
<th scope="col">Nama</th>
<th scope="col">NIK</th>
<th scope="col">Instansi</th>
<th scope="col">Detail</th>
</tr>
</tr>
</tfoot>
......
......@@ -76,11 +76,11 @@
</div>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary" id="titleTabelPending">Materi yang Diblokir</h6>
<h6 id="table-description" class="m-0 font-weight-bold text-primary" id="titleTabelPending">Materi yang Diblokir</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTablePending" aria-describedby="titleTabelPending">
<table aria-describedby="table-description" class="table table-bordered" id="dataTablePending" aria-describedby="titleTabelPending">
{% if not materi_diblokir %}
Tidak ada materi yang diblokir
{% else %}
......
......@@ -103,7 +103,7 @@
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
<em class="fa fa-bars"></em>
</button>
<div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
......@@ -257,7 +257,7 @@
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
<em class="fas fa-angle-up"></em>
</a>
<!-- Bootstrap core JavaScript-->
......
......@@ -112,7 +112,7 @@
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
<em class="fa fa-bars"></em>
</button>
<div class="sidebar-brand-text mx-3">Diskominfo Kota Depok</div>
......@@ -172,7 +172,7 @@
<label>Deskripsi &nbsp;:</label>{{ form.description }}<br>
<br>
<div class="row">
<button class="primary_btn save" style="border-radius:20px;" type="submit"><i class="far fa-save"></i>
<button class="primary_btn save" style="border-radius:20px;" type="submit"><em class="far fa-save"></em>
Simpan</button>
</div>
</form>
......@@ -182,24 +182,24 @@
<!-- DataTales Example -->
<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>
<h6 id="table-description" 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">
<table aria-describedby="table-description" class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Judul Verifikasi</th>
<th>Deskripsi</th>
<th></th>
<th scope="col">Judul Verifikasi</th>
<th scope="col">Deskripsi</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for item in verification_settings %}
<tr>
<th>{{item.title}}</th>
<th>{{item.description}}</th>
<th> </th>
<th scope="col">{{item.title}}</th>
<th scope="col">{{item.description}}</th>
<th scope="col"> </th>
</tr>
{% endfor %}
</tbody>
......@@ -232,7 +232,7 @@
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
<em class="fas fa-angle-up"></em>
</a>
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
......
......@@ -281,9 +281,9 @@
<tbody>
{% for item in items %}
<tr>
<th>{{item.title}} {{item.name}}</th>
<th>{{item.description}}</th>
<th class="verif-buttons">
<th scope="col">{{item.title}} {{item.name}}</th>
<th scope="col">{{item.description}}</th>
<th scope="col" class="verif-buttons">
{% if item.name is None %}
<a
href="/administration/setting/verification/{{ item.id }}/edit"
......@@ -377,9 +377,9 @@
<tbody>
{% for item in items_archived %}
<tr>
<th>{{item.title}} {{item.name}}</th>
<th>{{item.description}}</th>
<th>{{item.archived_by.name}}</th>
<th scope="col">{{item.title}} {{item.name}}</th>
<th scope="col">{{item.description}}</th>
<th scope="col">{{item.archived_by.name}}</th>
</tr>
{% endfor %}
</tbody>
......
......@@ -2,16 +2,20 @@ from django import forms
from app.models import Materi, Category, RatingContributor
from authentication.models import User
import datetime
def year_choices():
return[(r,r) for r in range(2000, datetime.date.today().year+1)]
class UploadMateriForm(forms.ModelForm):
categories = forms.ModelMultipleChoiceField(queryset=Category.objects.all(),widget=forms.CheckboxSelectMultiple(attrs={'style' : 'column-count:2'}),required=True)
#categories.widget.attrs["style"] = "column-count:2"
release_year = forms.TypedChoiceField(coerce=int, choices=year_choices, initial=datetime.date.today().year)
class Meta:
model = Materi
fields = ["title", "author", "publisher",
fields = ["title", "author", "publisher", "release_year",
"categories", "descriptions", "cover", "content"]
def __init__(self, *args, **kwargs):
......
# Generated by Django 3.1 on 2020-10-09 16:19
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('app', '0020_merge_20201009_2039'),
]
operations = [
migrations.CreateModel(
name='LikeComment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
('session_id', models.CharField(max_length=32)),
('comment', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='app.comment')),
],
),
migrations.CreateModel(
name='DislikeComment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
('session_id', models.CharField(max_length=32)),
('comment', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='app.comment')),
],
),
]
# Generated by Django 3.1 on 2020-10-09 16:13
import app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0020_merge_20201009_2039'),
]
operations = [
migrations.AddField(
model_name='materi',
name='release_year',
field=models.IntegerField(default=app.models.current_year),
),
]
# Generated by Django 3.1 on 2020-10-11 04:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0021_dislikecomment_likecomment'),
('app', '0021_materi_release_year'),
]
operations = [
]
import random
import datetime
from django.contrib.postgres import search
from django.core.exceptions import ValidationError
......@@ -24,6 +25,8 @@ def getRandomColor():
color = "%06x" % random.randint(0, 0xFFFFFF)
return color
def current_year():
return datetime.date.today().year
class Category(models.Model):
name = models.CharField(max_length=20)
......@@ -56,6 +59,7 @@ class Materi(models.Model):
author = models.CharField(max_length=30, default="Penyusun")
uploader = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
publisher = models.CharField(max_length=30, default="Penerbit")
release_year = models.IntegerField(default=current_year)
pages = models.IntegerField(default=0)
descriptions = models.TextField(default="Deskripsi")
status = models.CharField(max_length=30, choices=VERIFICATION_STATUS, default=VERIFICATION_STATUS[0][0])
......@@ -108,6 +112,28 @@ class Comment(models.Model):
def __str__(self):
return self.username
@property
def like_count(self):
count = LikeComment.objects.filter(comment=self).count()
return count
@property
def dislike_count(self):
count = DislikeComment.objects.filter(comment=self).count()
return count
class LikeComment(models.Model):
comment = models.ForeignKey(Comment, models.SET_NULL, null=True)
timestamp = models.DateTimeField(default=timezone.now)
session_id = models.CharField(max_length=32, blank=False)
class DislikeComment(models.Model):
comment = models.ForeignKey(Comment, models.SET_NULL, null=True)
timestamp = models.DateTimeField(default=timezone.now)
session_id = models.CharField(max_length=32, blank=False)
class Like(models.Model):
materi = models.ForeignKey(Materi, models.SET_NULL, null=True)
......
......@@ -4,7 +4,7 @@
<html lang="en">
<head>
<title>Digipus</title>
<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">
......@@ -75,7 +75,7 @@
<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>
<em class="fa fa-bars"></em>
</button>