Fakultas Ilmu Komputer UI

Commit 651e62c7 authored by Michael Christopher Manullang's avatar Michael Christopher Manullang
Browse files

Merge branch '1706039723-96' into 'master'

[#96] User Guide

Closes #96

See merge request !102
parents c1810816 cad90ef7
Pipeline #60140 passed with stages
in 24 minutes and 25 seconds
......@@ -4,7 +4,7 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
......@@ -16,6 +16,9 @@
<li class="nav-item">
<a class="nav-link" href="/news/all">Berita</a>
</li>
<li class="user-guide">
<a class="nav-link" href="/userguide/">User Guide</a>
</li>
{% if not request.user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="/registrasi/umum">Registrasi Umum</a>
......
......@@ -66,6 +66,7 @@
</div>
<button type="submit" class="btn btn-cari">Cari</button>
</form>
<p class="pageTitle">Tidak tahu cara menggunakan Digipus? Silahkan kunjungi <a href="/userguide/"> user guide ini</a></p>
<p class="pageTitle">Tidak menemukan materi yang kamu cari ? ajukan permintaan materi kami <a
href="/req-materi">disini</a></p>
<p class="pageTitle">Ingin diskusi lebih mendalam? Silahkan kunjungi <a
......
......@@ -51,6 +51,7 @@ INSTALLED_APPS = [
"traffic_statistics",
"forum",
"rest_framework",
'userguide'
]
MIDDLEWARE = [
......
......@@ -27,6 +27,7 @@ urlpatterns = [
path("", include("news.urls"), name="news"),
path("statistics/", include("traffic_statistics.urls")),
path("forum/", include("forum.urls")),
path("userguide/", include(("userguide.urls")))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
handler403 = 'app.views.permission_denied'
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class UserguideConfig(AppConfig):
name = 'userguide'
from django.db import models
# Create your models here.
.purple {
background-color : #615CFD !important;
color : #ffffff !important;
}
.rounded {
border-radius: 5px;
}
.padded {
height: 64px;
padding: 20px;
}
li {
padding-top: 5px;
padding-bottom: 5px;
}
#userGuideText {
font-size: 80px;
color: #615CFD;
padding-left: 10px;
}
body {
background-color: #F8F8F8;
}
#changedDiv {
background-color: #FFFFFF;
padding-top: 10px;
}
h1 {
color: #615CFD;
}
\ No newline at end of file
$("#loginAdmin").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(10);
})
$("#approveRejectAdmin").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(11);
})
$("#configCategoryAdmin").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(12);
})
$("#manageContributorAdmin").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(13);
})
$("#manageAdminAdmin").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(14);
})
$("#editProfileAdmin, #editProfileContributor, #editProfileUser").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(15);
})
$("#loginContributor").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(21);
})
$("#uploadMaterialContributor").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(22);
})
$("#historyUploadsContributor").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(23);
})
$("#lookStatisticCommentsContributor").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(25);
})
$("#lookMaterialUser").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(31);
})
$("#giveCommentUser").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(32);
})
$("#downloadReadMaterials").click(function(e) {
e.preventDefault();
ajaxCallToChangeTemplateBasedOnState(33);
})
function ajaxCallToChangeTemplateBasedOnState(state){
$.ajax({
url: '/userguide/',
headers: {'X-CSRFToken': csrftoken},
data :{
'state' : state
},
dataType : 'html',
type : 'POST',
success : function(data) {
console.log(data)
$('#changedDiv').html(data)
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
})
}
\ No newline at end of file
{% if state == 0 %}
Digipus is a system application that can accommodate archiving educational material from regional
apparatus, academics, and practitioners, and organizing it properly so that it becomes material for
increasing knowledge and skills for the community at large.
{% elif state == 10 %}
<h1>Login as an admin</h1>
<ol>
<li>Click on the Login Admin button on the dashboard.</li>
<li>Type your credentials and solve the captcha problem.</li>
<li>Click “Login”</li>
</ol>
<h1>Register as an admin</h1>
<ol>
<li>Click on the Login Admin button on the dashboard.</li>
<li>Click on the “Belum mendaftar? klik di sini” Text</li>
<li>Type your registration details and click “Daftar”</li>
<li>Wait for our internal team to accept your admin account</li>
</ol>
{% elif state == 11 %}
<h1>Approve/Reject a Material</h1>
<ol>
<li>Click on "Administrasi" on the navigation bar</li>
<li>Click on "Verifikasi Materi" on the top left</li>
<li>Assuming that a material has been submitted, you can click on "Approve" or "Reject" on that particular material</li>
</ol>
{% elif state == 12 %}
<h1>Configuration Category and Criteria of Material</h1>
<ol>
<li>Click on "Administrasi" on the navigation bar</li>
<li>Click on "Pengaturan Kategori"</li>
<li>To add category, fill in the form and click "Tambahkan"</li>
<li>On the List of Categories, you can either edit or delete the category by clicking on “Edit” and “Hapus” respectively</li>
<li>You can view the list of categories and erased categories on the table on that page.</li>
</ol>
{% elif state == 13 %}
<h1>Manage contributor</h1>
<ol>
<li>Click on "Administrasi" on the navigation bar</li>
<li>Click on "Kelola Contributor"</li>
<li>On the “Tabel Daftar Kontributor” table, you can view all contributors. For each contributor, you can either look at the details or delete by pressing “Detail” or “Delete”</li>
</ol>
{% elif state == 14 %}
<h1>Manage Admin</h1>
<ol>
<li>Click on "Administrasi" on the navigation bar</li>
<li>Click on "Kelola Admin"</li>
<li>On the “Tabel Daftar Kontributor” table, you can view all contributors. For each contributor, you can either look at the details or delete by pressing “Detail” or “Delete”</li>
</ol>
{% elif state == 15 %}
<h1>Edit Profile</h1>
<ol>
<li>Click "Profil" on the top navigation bar</li>
<li>Configure your profile from there</li>
</ol>
{% elif state == 21 %}
<h1>Login as a kontributor</h1>
<ol>
<li>Click on the Login Kontributor button on the dashboard.</li>
<li>Type your credentials and solve the captcha problem.</li>
<li>Click “Login”</li>
</ol>
<h1>Register as an admin</h1>
<ol>
<li>Click on the Login Kontributor button on the dashboard.</li>
<li>Click on the “Belum mendaftar? klik di sini” Text</li>
<li>Type your registration details and click “Daftar”</li>
</ol>
{% elif state == 22 %}
<h1>Upload a material</h1>
<ol>
<li>Click on Dashboard on the Navigation Bar</li>
<li>Click on "Unggah Materi" on the top left</li>
<li>Fill in the form</li>
<li>Click "Simpan"</li>
<li>You can also upload through excel by clicking on “Unggah Materi (Excel)” instead of “Unggah Materi” The template for the excel can be downloaded from there</li>
</ol>
{% elif state == 23 %}
<h1>History of Uploads</h1>
<ol>
<li>Click on Dashboard on the Navigation Bar</li>
<li>Click on "Riwayat Unggah"</li>
<li>For each of the things on the table, you can either view the details or delete by clicking “Detail” or “Hapus” respectively</li>
</ol>
{% elif state == 24 %}
<h1>Edit Profile</h1>
<ol>
<li>Click "Profil" on the top navigation bar</li>
<li>Configure your profile from there</li>
</ol>
{% elif state == 25 %}
<h1>Look at statistic comments</h1>
This feature is under construction
{% elif state == 31 %}
<h1>Look on a material</h1>
<ol>
<li>Find the material that you want to look at</li>
<li>Click on "Detil"</li>
</ol>
{% elif state == 32 %}
<h1>Give Comment</h1>
This feature is under construction
{% elif state == 33 %}
<h1> Download or Read Materials </h1>
<ol>
<li>Find the material that you want to look at</li>
<li>Download or read by clicking on “Unduh” or “Baca” respectively</li>
</ol>
{% endif %}
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block header %}
<!DOCTYPE html>
<html>
<head>
{% csrf_token %}
<link href="../../static/app/css/heroic-features.css" rel="stylesheet">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'css/styles.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/util.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/home.css' %}">
<script>
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
</script>
{% endblock header %}
{% block content%}
</head>
<div class="container">
{% include 'app/includes/navbar_katalog_materi.html' %}
<div class="row">
<div><span id = "userGuideText">USER GUIDE</span></div>
</div>
<div class="row">
<div class="col-5">
<a class="btn-block rounded padded purple" data-toggle="collapse" href="#collapseAdmin" role="button" aria-expanded="false" aria-controls="collapseAdmin">
Admin
</a>
<div class="card">
<div class="collapse" id="collapseAdmin">
<ul>
<li><a href = "" id = "loginAdmin">Login/Register as Admin</a></li>
<li><a href = "" id = "approveRejectAdmin">Approve/Reject a material</a></li>
<li><a href = "" id = "configCategoryAdmin">Configuration Category and Criteria of material</a></li>
<li><a href = "" id = "manageContributorAdmin">Manage Contributor</a></li>
<li><a href = "" id = "manageAdminAdmin">Manage Admin</a></li>
<li><a href = "" id = "editProfileAdmin">Edit Profile</a></li>
</ul>
</div>
</div>
<a class="btn-block rounded padded purple" data-toggle="collapse" href="#collapseContributor" role="button" aria-expanded="false" aria-controls="collapseContributor">
Contributor
</a>
<div class="card">
<div class="collapse" id="collapseContributor">
<ul>
<li><a href = "" id = "loginContributor">Login/Register as Contributor</a></li>
<li><a href = "" id = "uploadMaterialContributor">Upload a Material</a></li>
<li><a href = "" id = "historyUploadsContributor">History of Uploads</a></li>
<li><a href = "" id = "editProfileContributor">Edit Profile</a></li>
<li><a href = "" id = "lookStatisticCommentsContributor">Look at Statistic Comments</a></li>
</ul>
</div>
</div>
<a class="btn-block rounded padded purple" data-toggle="collapse" href="#collapseUser" role="button" aria-expanded="false" aria-controls="collapseContributor">
User
</a>
<div class="card">
<div class="collapse" id="collapseUser">
<ul>
<li><a href = "" id = "lookMaterialUser">Look on a Material</a></li>
<li><a href = "" id = "giveCommentUser">Give Comment</a></li>
<li><a href = "" id = "downloadReadMaterials">Download or Read Materials</a></li>
<li><a href = "" id = "editProfileUser">Edit Profile</a></li>
</ul>
</div>
</div>
</div>
<div class = "col-7" id = "changedDiv">
{% include "changed.html" %}
</div>
</div>
</div>
{% endblock content %}
{% block extra_scripts %}
<script src="../static/js/home.js"></script>
{% endblock extra_scripts%}
</html>
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
# Tests must start with the keyword test
# Relevant Resource: https://stackoverflow.com/questions/2037364/django-test-runner-not-finding-tests/4747444
class TestUserGuide(TestCase):
def test_response_returns_correct_html(self):
c = self.client.get('/userguide/')
self.assertTemplateUsed(c, 'home.html')
def test_response_returns_state_variable(self):
c = self.client.get('/userguide/')
self.assertIn('state', c.context)
def test_state_variable_is_int(self):
c = self.client.get('/userguide/')
state = c.context['state']
isinstance(state, int)
def test_state_sends_request_to_controller_and_receives_state_variable_equal_to_sent_number(self):
for number in range(10,34):
c = self.client.post('/userguide/', data={'state': number})
self.assertEquals(number, c.context['state'])
def test_when_state_changed_html_also_changes(self):
state_before = 10
state_after = 11
c_before = self.client.post('/userguide/', data={'state': state_before}).content
c_after = self.client.post('/userguide/', data={'state': state_after}).content
self.assertNotEquals(c_before, c_after)
\ No newline at end of file
from django.urls import path
from userguide.views import UserGuideHome
urlpatterns = [
path("", UserGuideHome, name="user_guide_home"),
]
from django.shortcuts import render
from django.views.decorators.csrf import ensure_csrf_cookie
from django.http import JsonResponse
# Create your views here.
@ensure_csrf_cookie
def UserGuideHome(request):
state = 0
if (request.method == 'POST'):
state = int(request.POST['state'])
return render(request, 'changed.html', {'state' : state})
return render(request, 'home.html', {'state': state})
\ No newline at end of file
Markdown is supported
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