Fakultas Ilmu Komputer UI

Verified Commit 1a84ae47 authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

Add breadcrumbs control as navigation in developer sections

parent f366c932
......@@ -59,14 +59,20 @@ coverage report --show-missing --skip-covered
python3 ./manage.py migrate
```
6. Run development server
6. Load sitetree's sitetreedump-ed json data
```bash
python3 ./manage.py sitetreeload --mode=replace sitetree.json
```
7. Run development server
```bash
python3 ./manage.py runserver
```
7. Open generated portray docs in browser
8. Open generated portray docs in browser
```bash
portray in_browser
......
......@@ -35,6 +35,7 @@ INSTALLED_APPS = (
"django.contrib.messages",
"django.contrib.staticfiles",
"csaccountmanagement",
"rest_apereo_cas",
"rest_framework",
"corsheaders",
"django.contrib.sites",
......@@ -42,8 +43,8 @@ INSTALLED_APPS = (
"allauth.account",
"allauth.socialaccount",
"crispy_forms",
"rest_apereo_cas",
"captcha",
"sitetree",
)
MIDDLEWARE = [
......
......@@ -2,6 +2,8 @@
{% block content %}
<div>
{% load sitetree %}
{% sitetree_breadcrumbs from "developer" %}
<h2>Access Levels</h2>
<div>
{% for accesslevel in accesslevel_list %}
......
......@@ -7,6 +7,9 @@
{% endblock %}
{% block content %}
<h1>Delete {{ object.service.name }}</h1>
{% load sitetree %}
{% sitetree_breadcrumbs from "developer" %}
<h1>Delete {{ object.service.name }}?</h1>
{% crispy form %}
{% endblock %}
......@@ -5,6 +5,9 @@
{% endblock %}
{% block content %}
{% load sitetree %}
{% sitetree_breadcrumbs from "developer" %}
<h1>{{ object.service.name }}</h1>
<p>Access Level: {{ object.access_level }}</p>
<p>Service Id: <code>{{ object.service.serviceId }}</code></p>
......
{% extends 'base.html' %}
{% block content %}
<h1>Developers! Developers! Developers!</h1>
<h1>Developer Dashboard</h1>
<a href="{% url 'dev-add-client' %}">Add Client</a>
<a href="{% url 'dev-access-levels' %}">Access Levels</a>
......
{% load sitetree %}
{% if sitetree_items|length_is:"1" %}
{% else %}
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
{% for item in sitetree_items %}
{% if not forloop.last %}
<li class="breadcrumb-item"><a href="{% sitetree_url for item %}">{{ item.title_resolved }}</a></li>
{% else %}
<li class="breadcrumb-item active">{{ item.title_resolved }}</li>
{% endif %}
{% endfor %}
</ol>
</nav>
{% endif %}
\ No newline at end of file
......@@ -542,7 +542,7 @@ class DeveloperViewTestCase(TestCase):
self.client.force_login(self.dev_user)
response = self.client.get("/developer/")
self.assertContains(response, "Developers! Developers! Developers!")
self.assertContains(response, "Developer Dashboard")
def test_dashboard_client_list(self):
basic_access_level = AccessLevel.objects.get(name="basic")
......@@ -566,7 +566,7 @@ class DeveloperViewTestCase(TestCase):
def test_add_client_get(self):
self.client.force_login(self.dev_user)
response = self.client.get("/developer/add-client/")
response = self.client.get("/developer/client/add/")
self.assertContains(response, "basic")
self.assertContains(response, "deny_all")
......@@ -576,7 +576,7 @@ class DeveloperViewTestCase(TestCase):
self.client.force_login(self.dev_user)
basic_access_level = AccessLevel.objects.get(name="basic")
response = self.client.post(
"/developer/add-client/",
"/developer/client/add/",
data={
"name": "Coding and Game Stream",
"access_level": basic_access_level.id,
......@@ -604,7 +604,7 @@ class DeveloperViewTestCase(TestCase):
self.client.force_login(self.dev_user)
return_all_access_level = AccessLevel.objects.get(name="return_all")
response = self.client.post(
"/developer/add-client/",
"/developer/client/add/",
data={
"name": "Coding and Game Stream",
"access_level": return_all_access_level.id,
......@@ -635,7 +635,7 @@ class DeveloperViewTestCase(TestCase):
client.save()
self.client.force_login(self.dev_user)
response = self.client.get("/developer/1")
response = self.client.get("/developer/client/1/")
self.assertContains(response, "Coding and Game Stream")
self.assertContains(response, client.service.serviceId)
......@@ -662,7 +662,7 @@ class DeveloperViewTestCase(TestCase):
client.save()
self.client.force_login(dev_user2)
response = self.client.get("/developer/1")
response = self.client.get("/developer/client/1/")
self.assertEqual(response.status_code, HTTPStatus.FORBIDDEN)
......@@ -682,7 +682,7 @@ class DeveloperViewTestCase(TestCase):
client.save()
self.client.force_login(self.dev_user)
response = self.client.get("/developer/1/delete/")
response = self.client.get("/developer/client/1/delete/")
self.assertContains(response, "Delete Coding and Game Stream")
......@@ -702,7 +702,7 @@ class DeveloperViewTestCase(TestCase):
client.save()
self.client.force_login(self.dev_user)
response = self.client.post("/developer/1/delete/")
response = self.client.post("/developer/client/1/delete/")
self.assertRedirects(response, "/developer/")
self.assertFalse(
......@@ -729,7 +729,7 @@ class DeveloperViewTestCase(TestCase):
client.save()
self.client.force_login(dev_user2)
response = self.client.post("/developer/1/delete/")
response = self.client.post("/developer/client/1/delete/")
self.assertEqual(response.status_code, HTTPStatus.FORBIDDEN)
......
......@@ -19,10 +19,14 @@ urlpatterns = [
),
path("developer/", developer_views.dashboard, name="dev-dashboard"),
path("developer/signup/", developer_views.signup, name="dev-signup"),
path("developer/add-client/", developer_views.add_client, name="dev-add-client"),
path("developer/<int:pk>", developer_views.client_detail, name="dev-client-detail"),
path("developer/client/add/", developer_views.add_client, name="dev-add-client"),
path(
"developer/<int:pk>/delete/",
"developer/client/<int:pk>/",
developer_views.client_detail,
name="dev-client-detail",
),
path(
"developer/client/<int:pk>/delete/",
developer_views.delete_client,
name="dev-delete-client",
),
......
# This is hand-written requirements.txt
# Only add direct dependencies needed by the application
dj-database-url==0.5.0
dj-database-url
django_cors_headers==3.4.0
django-allauth
django-crispy-forms
django-kronos==1.0
django-sitetree
djangorestframework==3.11.0
gunicorn
whitenoise==5.1.0
......
[{"model": "sitetree.tree", "pk": 1, "fields": {"title": "Developer Dashboard", "alias": "developer"}}, {"model": "sitetree.treeitem", "pk": 1, "fields": {"title": "Dashboard", "hint": "", "url": "dev-dashboard", "urlaspattern": true, "tree": 1, "hidden": false, "alias": null, "description": "", "inmenu": true, "inbreadcrumbs": true, "insitetree": true, "access_loggedin": false, "access_guest": false, "access_restricted": false, "access_perm_type": 1, "parent": null, "sort_order": 1, "access_permissions": []}}, {"model": "sitetree.treeitem", "pk": 2, "fields": {"title": "Access Levels", "hint": "", "url": "dev-access-levels", "urlaspattern": true, "tree": 1, "hidden": false, "alias": null, "description": "", "inmenu": true, "inbreadcrumbs": true, "insitetree": true, "access_loggedin": false, "access_guest": false, "access_restricted": false, "access_perm_type": 1, "parent": 1, "sort_order": 2, "access_permissions": []}}, {"model": "sitetree.treeitem", "pk": 4, "fields": {"title": "{{ object.service.name }}", "hint": "", "url": "dev-client-detail object.id", "urlaspattern": true, "tree": 1, "hidden": false, "alias": null, "description": "", "inmenu": false, "inbreadcrumbs": true, "insitetree": false, "access_loggedin": false, "access_guest": false, "access_restricted": false, "access_perm_type": 1, "parent": 1, "sort_order": 4, "access_permissions": []}}, {"model": "sitetree.treeitem", "pk": 5, "fields": {"title": "Delete", "hint": "", "url": "dev-delete-client object.id", "urlaspattern": true, "tree": 1, "hidden": false, "alias": null, "description": "", "inmenu": false, "inbreadcrumbs": true, "insitetree": false, "access_loggedin": false, "access_guest": false, "access_restricted": false, "access_perm_type": 1, "parent": 4, "sort_order": 5, "access_permissions": []}}]
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