added new parent page + minor css/js improvements
This commit is contained in:
parent
6ff3f05272
commit
8b0b56cb7b
@ -29,6 +29,7 @@ urlpatterns = [
|
|||||||
path("parents/", views.ParentsView.as_view(), name="parents"),
|
path("parents/", views.ParentsView.as_view(), name="parents"),
|
||||||
path("table/<date:start_date>/<date:end_date>/", views.get_table_data, name="table_data"),
|
path("table/<date:start_date>/<date:end_date>/", views.get_table_data, name="table_data"),
|
||||||
path("table/", views.table_view, name="table"),
|
path("table/", views.table_view, name="table"),
|
||||||
|
path("parents/new/", views.new_parent_view, name="new_parent"),
|
||||||
path("parents/<int:id>/", views.parent_view, name="parent"),
|
path("parents/<int:id>/", views.parent_view, name="parent"),
|
||||||
path("projects/<int:id>/", views.project_view, name="project"),
|
path("projects/<int:id>/", views.project_view, name="project"),
|
||||||
path("projects/<int:id>/set_parent", views.set_parent, name="set_parent"),
|
path("projects/<int:id>/set_parent", views.set_parent, name="set_parent"),
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
--light2: #e5e5e5;
|
--light2: #e5e5e5;
|
||||||
--light3: #cccccc;
|
--light3: #cccccc;
|
||||||
--light4: #c5c5c5;
|
--light4: #c5c5c5;
|
||||||
|
--accent: #69c935;
|
||||||
|
--accent2: #61ba31;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@ -43,6 +45,16 @@ nav a {
|
|||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav a.logo {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
nav a.logo img {
|
||||||
|
object-fit: contain;
|
||||||
|
height: 2em;
|
||||||
|
width: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
nav a.active {
|
nav a.active {
|
||||||
box-shadow: 0 -2px var(--light1) inset;
|
box-shadow: 0 -2px var(--light1) inset;
|
||||||
}
|
}
|
||||||
@ -95,5 +107,5 @@ button, select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #69c935
|
color: var(--accent);
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ form input[type="checkbox"] {
|
|||||||
|
|
||||||
form input[type="checkbox"]:checked::after {
|
form input[type="checkbox"]:checked::after {
|
||||||
content: "";
|
content: "";
|
||||||
background-color: #69c935;
|
background-color: var(--accent);
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 80%;
|
height: 80%;
|
||||||
border-radius: 10%;
|
border-radius: 10%;
|
@ -1,8 +1,24 @@
|
|||||||
.list {
|
.list-wrapper {
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 40em;
|
max-width: 40em;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header button {
|
||||||
|
padding: 0.4em 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
gap: 0.8em;
|
gap: 0.8em;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
|
document.querySelector("button.new").addEventListener("click", () => {
|
||||||
|
window.location.href = "new/"
|
||||||
|
})
|
||||||
|
|
||||||
document.querySelectorAll(".list li").forEach(row => {
|
document.querySelectorAll(".list li").forEach(row => {
|
||||||
let id = row.dataset.id
|
let id = row.dataset.id
|
||||||
row.querySelector("button.edit").addEventListener("click", () => {
|
row.querySelector("button.edit").addEventListener("click", () => {
|
99
dispatcher/static/logo.svg
Normal file
99
dispatcher/static/logo.svg
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
sodipodi:docname="logo.svg"
|
||||||
|
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="11.559708"
|
||||||
|
inkscape:cx="31.012894"
|
||||||
|
inkscape:cy="41.047749"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1016"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1">
|
||||||
|
<inkscape:grid
|
||||||
|
id="grid1"
|
||||||
|
units="px"
|
||||||
|
originx="0"
|
||||||
|
originy="0"
|
||||||
|
spacingx="1"
|
||||||
|
spacingy="1"
|
||||||
|
empcolor="#0099e5"
|
||||||
|
empopacity="0.30196078"
|
||||||
|
color="#0099e5"
|
||||||
|
opacity="0.14901961"
|
||||||
|
empspacing="8"
|
||||||
|
enabled="true"
|
||||||
|
visible="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="fillet_chamfer"
|
||||||
|
id="path-effect3"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
nodesatellites_param="F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,0,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1"
|
||||||
|
radius="0"
|
||||||
|
unit="px"
|
||||||
|
method="auto"
|
||||||
|
mode="F"
|
||||||
|
chamfer_steps="1"
|
||||||
|
flexible="false"
|
||||||
|
use_knot_distance="true"
|
||||||
|
apply_no_radius="true"
|
||||||
|
apply_with_radius="true"
|
||||||
|
only_selected="false"
|
||||||
|
hide_knots="false" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<g
|
||||||
|
id="g4">
|
||||||
|
<path
|
||||||
|
style="fill:#69c935;fill-opacity:1;stroke-width:6;stroke-linecap:square;stroke:none"
|
||||||
|
d="m 8,10 v 4 a 2,2 45 0 0 2,2 h 7 a 2,2 45 0 1 2,2 v 36 a 2,2 45 0 0 2,2 h 4 a 2,2 135 0 0 2,-2 V 18 a 2,2 135 0 1 2,-2 h 7 a 2,2 135 0 0 2,-2 V 10 A 2,2 45 0 0 36,8 H 10 a 2,2 135 0 0 -2,2 z"
|
||||||
|
id="path1"
|
||||||
|
sodipodi:nodetypes="ccccccccc"
|
||||||
|
inkscape:path-effect="#path-effect3"
|
||||||
|
inkscape:original-d="m 8,8 v 8 h 11 v 40 h 8 V 16 H 38 V 8 Z" />
|
||||||
|
<g
|
||||||
|
id="g3"
|
||||||
|
style="stroke:#61ba31;stroke-opacity:1;fill:none">
|
||||||
|
<path
|
||||||
|
id="path2"
|
||||||
|
style="fill:none;stroke:#61ba31;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
|
||||||
|
d="M 44.834929,13.274537 C 51.52452,17.296808 56,24.625752 56,33 56,45.702549 45.702549,56 33,56"
|
||||||
|
sodipodi:nodetypes="csc" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#61ba31;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 44,47 33,33 38,26"
|
||||||
|
id="path3" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
@ -1,3 +1,3 @@
|
|||||||
.productive {
|
.productive {
|
||||||
box-shadow: 0.2em 0 0 #69c935 inset;
|
box-shadow: 0.2em 0 0 var(--accent) inset;
|
||||||
}
|
}
|
@ -23,6 +23,7 @@ def dashboard_view(request):
|
|||||||
|
|
||||||
def projects_view(request):
|
def projects_view(request):
|
||||||
context = {
|
context = {
|
||||||
|
"class_name": "parent",
|
||||||
"projects": Project.objects.all(),
|
"projects": Project.objects.all(),
|
||||||
"parents": Parent.objects.all()
|
"parents": Parent.objects.all()
|
||||||
}
|
}
|
||||||
@ -38,9 +39,21 @@ def parent_view(request, id):
|
|||||||
form = ParentForm(request.POST or None, request.FILES or None, instance=parent)
|
form = ParentForm(request.POST or None, request.FILES or None, instance=parent)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
|
return redirect("parents")
|
||||||
context["form"] = ParentForm(instance=parent)
|
context["form"] = ParentForm(instance=parent)
|
||||||
return render(request, "edit.html", context)
|
return render(request, "edit.html", context)
|
||||||
|
|
||||||
|
def new_parent_view(request):
|
||||||
|
context = {
|
||||||
|
"class": "parent"
|
||||||
|
}
|
||||||
|
form = ParentForm(request.POST or None, request.FILES or None)
|
||||||
|
if form.is_valid():
|
||||||
|
form.save()
|
||||||
|
return redirect("parents")
|
||||||
|
context["form"] = form
|
||||||
|
return render(request, "add.html", context)
|
||||||
|
|
||||||
def project_view(request, id):
|
def project_view(request, id):
|
||||||
project = get_object_or_404(Project, id=id)
|
project = get_object_or_404(Project, id=id)
|
||||||
context = {
|
context = {
|
||||||
|
16
templates/add.html
Normal file
16
templates/add.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% block title %}New {{ class }}{% endblock %}
|
||||||
|
{% block head %}
|
||||||
|
<link rel="stylesheet" href="{% static "form.css" %}">
|
||||||
|
{% endblock %}
|
||||||
|
{% block main %}
|
||||||
|
<div class="container">
|
||||||
|
<h2>New {{ class }}</h2>
|
||||||
|
<form action="" method="POST">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form }}
|
||||||
|
<button type="submit">Create</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -4,6 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Title{% endblock %}</title>
|
<title>{% block title %}Title{% endblock %}</title>
|
||||||
|
<link rel="shortcut icon" href="{% static "logo.svg" %}" type="image/x-svg">
|
||||||
<link rel="stylesheet" href="{% static "base.css" %}">
|
<link rel="stylesheet" href="{% static "base.css" %}">
|
||||||
<script src="{% static "base.js" %}"></script>
|
<script src="{% static "base.js" %}"></script>
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
@ -11,6 +12,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<nav>
|
<nav>
|
||||||
|
<a class="logo" href="{% url "dashboard" %}"><img src="{% static "logo.svg" %}" alt="Time Dispatcher logo"></a>
|
||||||
{% for nav_link in nav_links %}
|
{% for nav_link in nav_links %}
|
||||||
<a href="{% url nav_link.view %}" {% if request.resolver_match.view_name == nav_link.view %}class="active"{% endif %}>{{ nav_link.label }}</a>
|
<a href="{% url nav_link.view %}" {% if request.resolver_match.view_name == nav_link.view %}class="active"{% endif %}>{{ nav_link.label }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block title %}Editing {{ class }} {{ id }}{% endblock %}
|
{% block title %}Editing {{ class }} {{ id }}{% endblock %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<link rel="stylesheet" href="{% static "edit.css" %}">
|
<link rel="stylesheet" href="{% static "form.css" %}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
{% block title %}Import tasks{% endblock %}
|
{% block title %}Import tasks{% endblock %}
|
||||||
|
{% block head %}
|
||||||
|
<link rel="stylesheet" href="{% static "form.css" %}">
|
||||||
|
{% endblock %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<form action="" method="POST" enctype="multipart/form-data">
|
<div class="container">
|
||||||
{% csrf_token %}
|
<h1>Import tasks</h1>
|
||||||
<div>
|
<form action="" method="POST" enctype="multipart/form-data">
|
||||||
<label for="file">File</label>
|
{% csrf_token %}
|
||||||
<input type="file" name="file" id="file">
|
<div>
|
||||||
</div>
|
<label for="file">File</label>
|
||||||
<button type="submit">Import</button>
|
<input type="file" name="file" id="file">
|
||||||
</form>
|
</div>
|
||||||
|
<button type="submit">Import</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -2,19 +2,25 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<link rel="stylesheet" href="{% static "list.css" %}">
|
<link rel="stylesheet" href="{% static "list.css" %}">
|
||||||
|
<script src="{% static "list.js" %}"></script>
|
||||||
{% block extra-head %}{% endblock %}
|
{% block extra-head %}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<ul class="list">
|
<div class="list-wrapper">
|
||||||
{% for element in elements %}
|
<div class="list-header">
|
||||||
<li data-id="{{ element.id }}" class="{% block extra-class %}{% endblock %}">
|
<button class="new">New {{ class_name }}</button>
|
||||||
{% block element %}{% endblock %}
|
</div>
|
||||||
<div class="actions">
|
<ul class="list">
|
||||||
{% block actions %}{% endblock %}
|
{% for element in elements %}
|
||||||
</div>
|
<li data-id="{{ element.id }}" class="{% block extra-class %}{% endblock %}">
|
||||||
</li>
|
{% block element %}{% endblock %}
|
||||||
{% empty %}
|
<div class="actions">
|
||||||
<li class="empty">No {% block element_name %}{% endblock %} defined yet</li>
|
{% block actions %}{% endblock %}
|
||||||
{% endfor %}
|
</div>
|
||||||
</ul>
|
</li>
|
||||||
|
{% empty %}
|
||||||
|
<li class="empty">No {{ class_name }} defined yet</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,15 +1,15 @@
|
|||||||
{% extends "list.html" %}
|
{% extends "list.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block title %}Parents{% endblock %}
|
{% block title %}Parents{% endblock %}
|
||||||
{% block element_name %}parent{% endblock %}
|
|
||||||
{% block extra-head %}
|
{% block extra-head %}
|
||||||
<link rel="stylesheet" href="{% static "parents.css" %}">
|
<link rel="stylesheet" href="{% static "parents.css" %}">
|
||||||
<script src="{% static "parents.js" %}"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extra-class %}{% if element.is_productive %}productive{% endif %}{% endblock %}
|
{% block extra-class %}{% if element.is_productive %}productive{% endif %}{% endblock %}
|
||||||
{% block element %}
|
{% block element %}
|
||||||
<div class="name">{{ element.name }}</div>
|
<div class="name">{{ element.name }}</div>
|
||||||
<div class="project_num">({{ element.project_num }})</div>
|
{% if element.project_num %}
|
||||||
|
<div class="project_num">({{ element.project_num }})</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block actions %}
|
{% block actions %}
|
||||||
<button class="edit">Edit</button>
|
<button class="edit">Edit</button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user