Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
cda12028c1 | |||
7ea0a7ddb7 | |||
a2ec1aeebd | |||
004b1a1c37 | |||
48e98cbfc3 | |||
e632ca23a5 | |||
|
6739e997bc | ||
33cd9c202e | |||
efcab93460 | |||
b4344d31a8 | |||
2d4b88bc7a | |||
2721d2a524 | |||
13d1e1674d | |||
44b7228982 | |||
673c04af19 | |||
4911842d3f | |||
d71cde1171 | |||
e615f774ad | |||
ed38156e77 | |||
4b82097fd9 | |||
d0d9529e41 | |||
a1c41349bd | |||
066bac721b | |||
5964ef4963 | |||
|
8acbb02a2f | ||
|
2c4c9a9802 | ||
8aa2675240 | |||
e5c424fff8 | |||
b3f257b7f4 | |||
9f2817fcf8 | |||
d81ff0592e | |||
52866f9c84 | |||
d9a73a6fd9 | |||
7aa57af9ef | |||
5166777e40 | |||
33c71cf93d | |||
dd142693d9 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/python,flask,vim,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=python,flask,vim,visualstudiocode
|
||||
*.db
|
||||
@ -24,7 +23,7 @@ dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
#lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
@ -234,3 +233,5 @@ tags
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/python,flask,vim,visualstudiocode
|
||||
|
||||
# deb files
|
||||
*.deb
|
||||
|
2
LICENSE
2
LICENSE
@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
flaskapp
|
||||
taskmanager
|
||||
Copyright (C) 2023 Decentrala
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
19
Makefile
Normal file
19
Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
VENV = venv
|
||||
PYTHON = $(VENV)/bin/python3
|
||||
PIP = $(VENV)/bin/pip
|
||||
|
||||
run: $(VENV)/bin/activate
|
||||
$(PYTHON) init_db.py
|
||||
$(PYTHON) run.py
|
||||
|
||||
|
||||
$(VENV)/bin/activate: requirements.txt
|
||||
python3 -m venv $(VENV)
|
||||
$(PIP) install -r requirements.txt
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf __pycache__
|
||||
rm -rf $(VENV)
|
||||
rm -r taskmanager/__pycache__/
|
||||
rm instance/taskmanager.db
|
39
README.md
39
README.md
@ -1,4 +1,39 @@
|
||||
# flaskapp
|
||||
# Task Manager
|
||||
|
||||
Web app
|
||||
Interactive TODO list web application
|
||||
|
||||
# Development Setup
|
||||
|
||||
Install python and pip on local machine
|
||||
|
||||
```bash
|
||||
pip install virtualenv
|
||||
python -m venv venv #/path/to/new/virtual/environment
|
||||
source venv/bin/activate #activate virtual env
|
||||
pip install -r requirments.txt
|
||||
python3 ./init_db.py #initialize database
|
||||
|
||||
python3 ./run.py #run project
|
||||
```
|
||||
|
||||
# On database changes
|
||||
|
||||
Delete file `/instance/taskmanager.db`
|
||||
And reinit the db
|
||||
|
||||
```shell
|
||||
python3 ./init_db.py
|
||||
```
|
||||
|
||||
# Build app
|
||||
|
||||
```bash
|
||||
cd build-deb/
|
||||
make
|
||||
```
|
||||
|
||||
# Install app
|
||||
|
||||
```bash
|
||||
apt install ./build-deb/taskmanager.deb
|
||||
```
|
||||
|
@ -7,8 +7,12 @@ man: man/taskmanager.1.md
|
||||
deb: man ../requirments.txt ../run.py ../taskmanager ../LICENSE
|
||||
cp -r ../taskmanager/* taskmanager/var/taskmanager/taskmanager/
|
||||
cp ../run.py taskmanager/var/taskmanager/
|
||||
cp ../init_db.py taskmanager/var/taskmanager/
|
||||
cp ../LICENSE taskmanager/var/taskmanager/
|
||||
chmod -w taskmanager/DEBIAN/*
|
||||
chmod +w taskmanager/DEBIAN/control
|
||||
dpkg-deb --build taskmanager
|
||||
chmod +w taskmanager/DEBIAN/*
|
||||
clean:
|
||||
rm -f taskmanager.deb
|
||||
rm -f man/taskmanager.1
|
||||
|
@ -1,15 +1,15 @@
|
||||
% FLASKAPP(1) taskmanager 1.0.0
|
||||
% TASKMANAGER(1) taskmanager 1.0.0
|
||||
% Decentrala
|
||||
% Jun 2023
|
||||
|
||||
# NAME
|
||||
taskmanager - Web app
|
||||
taskmanager - Interactive TODO list Web app
|
||||
|
||||
# SYNOPSIS
|
||||
**python3 run.py**
|
||||
|
||||
# DESCRIPTION
|
||||
Web app
|
||||
Interactive TODO list Web app
|
||||
|
||||
# AUTHORS
|
||||
Decentrala
|
@ -7,5 +7,5 @@ Installed-Size: 2000
|
||||
Depends: gunicorn, python3-flask-sqlalchemy
|
||||
Homepage: https://gitea.dmz.rs/Decentrala/taskmanager
|
||||
Maintainer: Decentrala <dmz@dmz.rs>
|
||||
Description: Web app
|
||||
Version: 1.0.0
|
||||
Description: Interactive TODO list Web app
|
||||
Version: 1.0.10
|
||||
|
@ -1,3 +1,12 @@
|
||||
#!/bin/sh
|
||||
/usr/bin/systemctl enable taskmanager.service
|
||||
/var/taskmanager/init_db.py
|
||||
/sbin/service taskmanager start
|
||||
if [ -f /tmp/oldtaskmanagerconfig.ini ] ; then
|
||||
cp /tmp/oldtaskmanagerconfig.ini /var/taskmanager/taskmanager/config.ini
|
||||
rm /tmp/oldtaskmanagerconfig.ini
|
||||
fi
|
||||
if [ -f /tmp/oldtaskmanager.db ] ; then
|
||||
cp /tmp/oldtaskmanager.db /var/taskmanager/instance/taskmanager.db
|
||||
rm /tmp/oldtaskmanager.db
|
||||
fi
|
||||
|
6
build-deb/taskmanager/DEBIAN/preinst
Executable file
6
build-deb/taskmanager/DEBIAN/preinst
Executable file
@ -0,0 +1,6 @@
|
||||
if [ -f /var/taskmanager/taskmanager/config.ini ] ; then
|
||||
cp /var/taskmanager/taskmanager/config.ini /tmp/oldtaskmanagerconfig.ini
|
||||
fi
|
||||
if [ -f /var/taskmanager/instance/taskmanager.db ] ; then
|
||||
cp /var/taskmanager/instance/taskmanager.db /tmp/oldtaskmanager.db
|
||||
fi
|
@ -1,3 +1,9 @@
|
||||
#!/bin/sh
|
||||
/sbin/service taskmanager stop
|
||||
/usr/bin/systemdctl disable taskmanager.service
|
||||
/usr/bin/systemctl disable taskmanager.service
|
||||
if [ -f /var/taskmanager/taskmanager/config.ini ] ; then
|
||||
cp /var/taskmanager/taskmanager/config.ini /tmp/oldtaskmanagerconfig.ini
|
||||
fi
|
||||
if [ -f /var/taskmanager/instance/taskmanager.db ] ; then
|
||||
cp /var/taskmanager/instance/taskmanager.db /tmp/oldtaskmanager.db
|
||||
fi
|
||||
|
12
build-deb/taskmanager/lib/systemd/system/taskmanager.service
Normal file
12
build-deb/taskmanager/lib/systemd/system/taskmanager.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Gunicorn taskmanager service
|
||||
Documentation=man:gunicorn(1)
|
||||
After=network.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/var/taskmanager/
|
||||
ExecStart=/usr/bin/gunicorn --workers 3 --bind 0.0.0.0:80 run:app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
from flaskapp import db
|
||||
from taskmanager import db, app
|
||||
|
||||
print('[i] Trying to create databse...')
|
||||
try:
|
||||
db.create_all()
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
print('[+] Success you can proceed with deployment!')
|
||||
except:
|
||||
print('[-] Creating db failed :/')
|
||||
|
3
run.py
3
run.py
@ -1,4 +1,5 @@
|
||||
from flaskapp import app
|
||||
#!/usr/bin/env python3
|
||||
from taskmanager import app
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=False)
|
||||
|
2
taskmanager/config.ini
Normal file
2
taskmanager/config.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[credentials]
|
||||
ADMINPASS = defaultpassword
|
@ -0,0 +1,17 @@
|
||||
from taskmanager.models import *
|
||||
|
||||
def gettaskusers(taskid):
|
||||
users = list()
|
||||
userids = list()
|
||||
try:
|
||||
taskusers = TaskUser.query.filter_by(taskid = taskid).all()
|
||||
except:
|
||||
taskusers = list()
|
||||
|
||||
for taskuser in taskusers:
|
||||
userids.append(taskuser.userid)
|
||||
|
||||
for userid in userids:
|
||||
users.append(User.query.get(userid))
|
||||
|
||||
return users
|
@ -1,7 +1,19 @@
|
||||
from taskmanager import db
|
||||
|
||||
class Table(db.Model):
|
||||
class Task(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
variable1 = db.Column(db.Integer, nullable=False)
|
||||
variable2 = db.Column(db.Integer, nullable=False)
|
||||
name = db.Column(db.String, nullable=False)
|
||||
desc = db.Column(db.String, nullable=True)
|
||||
creatorid = db.Column(db.Integer, nullable=True)
|
||||
|
||||
class User(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String, nullable=False)
|
||||
contact = db.Column(db.String, nullable=False)
|
||||
password = db.Column(db.String, nullable=True)
|
||||
|
||||
class TaskUser(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
taskid = db.Column(db.Integer, nullable=False)
|
||||
userid = db.Column(db.Integer, nullable=False)
|
||||
|
||||
|
@ -1,34 +1,184 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
from flask import render_template, request, redirect
|
||||
|
||||
from taskmanager import app, db
|
||||
from taskmanager.functions import *
|
||||
from taskmanager.models import *
|
||||
|
||||
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
CONFIG_PATH = os.path.join(PROJECT_PATH, "config.ini")
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
ADMINPASS = config.get('credentials', 'ADMINPASS')
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
def index():
|
||||
if request.method == 'GET':
|
||||
localvariable1 = "Placeholder1"
|
||||
localvariable1 = "Placeholder2"
|
||||
try:
|
||||
return render_template('index.html', pagevariable1 = localvariable1, pagevariable2 = localvariable2 )
|
||||
except:
|
||||
return 'Error retriving page'
|
||||
else:
|
||||
return 'HTTP request method not recogniezed'
|
||||
tasks = Task.query.all()
|
||||
return render_template('pages/index.html', tasks = tasks)
|
||||
|
||||
@app.route('/submit', methods=['POST', 'GET'])
|
||||
def submit():
|
||||
@app.route('/addtask', methods=['GET','POST'])
|
||||
def addtask():
|
||||
if request.method == 'GET':
|
||||
return render_template('submit.html')
|
||||
return render_template('pages/addtask.html')
|
||||
elif request.method == 'POST':
|
||||
userinput1 = request.form['forminput1']
|
||||
userinput2 = request.form['forminput2']
|
||||
sqlrow = Table(variable1 = int(userinput1), variable2 = int(userinput2))
|
||||
taskname = request.form['taskname']
|
||||
taskdesc = request.form['taskdesc']
|
||||
username = request.form['username']
|
||||
# Input sanitation
|
||||
# Task name
|
||||
if not taskname.isprintable() or ("<" in taskname and ">" in taskname):
|
||||
return render_template('pages/response.html', response = "Task name has to be made only of letters or numbers.")
|
||||
if len(taskname) < 1 or len(taskname) > 40:
|
||||
return render_template('pages/response.html', response = "Task name lenght invalid, only smaller then 40 charachters allowed")
|
||||
|
||||
# Username
|
||||
if username == "":
|
||||
creatorid = None
|
||||
else:
|
||||
try:
|
||||
creatorid = User.query.filter_by(username = username).first().id
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'No user with this username. Please register')
|
||||
if creatorid is None:
|
||||
return render_template('pages/response.html', response = 'No user with this username. Please register.')
|
||||
|
||||
# Task descripton
|
||||
if taskdesc != '':
|
||||
if not taskdesc.isprintable() or ("<" in taskdesc and ">" in taskdesc):
|
||||
return render_template('pages/response.html', response = "Task description has to be made of printable characters.")
|
||||
if len(taskdesc) > 2000:
|
||||
return render_template('pages/response.html', response = "Task description lenght invalid, only smaller then 2000 charachters allowed")
|
||||
sqladdtask = Task(name = taskname, desc = taskdesc, creatorid = creatorid)
|
||||
try:
|
||||
db.session.add(sqlrow)
|
||||
db.session.add(sqladdtask)
|
||||
db.session.commit()
|
||||
return 'Row added'
|
||||
return render_template('pages/response.html', response = 'Task added')
|
||||
except:
|
||||
return 'Adding row to table failed'
|
||||
return render_template('pages/response.html', response = 'Adding task failed')
|
||||
|
||||
@app.route('/register', methods=['POST', 'GET'])
|
||||
def register():
|
||||
if request.method == 'GET':
|
||||
return render_template('pages/register.html')
|
||||
elif request.method == 'POST':
|
||||
username = request.form['username']
|
||||
contact = request.form['contact']
|
||||
password = request.form['password']
|
||||
|
||||
# Username
|
||||
if not username.isalnum():
|
||||
return render_template('pages/response.html', response = "Username has to be made only of letters or numbers.")
|
||||
if len(username) < 1 or len(username) > 40:
|
||||
return render_template('pages/response.html', response = "Username lenght invalid, only smaller then 40 charachters allowed")
|
||||
|
||||
# Contact
|
||||
if contact != '':
|
||||
if not contact.isprintable() or ("<" in contact and ">" in contact):
|
||||
return render_template('pages/response.html', response = "Contact information has to be made of printable characters.")
|
||||
if len(contact) > 100:
|
||||
return render_template('pages/response.html', response = "Contact lenght invalid, only smaller then 100 charachters allowed")
|
||||
|
||||
# Password
|
||||
if password != '':
|
||||
if not password.isprintable():
|
||||
return render_template('pages/response.html', response = "Password has to be made of printable characters.")
|
||||
if len(password) > 500:
|
||||
return render_template('pages/response.html', response = "Password lenght invalid, only smaller then 500 charachters allowed")
|
||||
|
||||
sqladduser = User(username = username, contact = contact, password = password)
|
||||
try:
|
||||
db.session.add(sqladduser)
|
||||
db.session.commit()
|
||||
return render_template('pages/response.html', response = 'User added')
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Adding user failed')
|
||||
|
||||
else:
|
||||
return 'HTTP request method not recogniezed'
|
||||
return render_template('pages/response.html', response = 'HTTP request method not recogniezed')
|
||||
|
||||
|
||||
@app.route('/projects/<int:task_id>', methods=['GET','POST'])
|
||||
def project(task_id:int):
|
||||
try:
|
||||
task = Task.query.get(task_id)
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Task not found, bad URL')
|
||||
if task is None:
|
||||
return render_template('pages/response.html', response = 'Task not found, bad URL')
|
||||
users = gettaskusers(task_id)
|
||||
if request.method == 'GET':
|
||||
return render_template("pages/project.html", task = task, users = users)
|
||||
elif request.method == 'POST':
|
||||
# Assigning user to task
|
||||
username = request.form['username']
|
||||
for user in users:
|
||||
if username == user.username:
|
||||
return render_template('pages/response.html', response = 'User already added to task')
|
||||
try:
|
||||
userid = User.query.filter_by(username = username).first().id
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'User not found, please register.')
|
||||
if userid is None:
|
||||
return render_template('pages/response.html', response = 'User not found, please register.')
|
||||
sqladduser = TaskUser(userid = userid, taskid = task_id)
|
||||
try:
|
||||
db.session.add(sqladduser)
|
||||
db.session.commit()
|
||||
return render_template('pages/response.html', response = 'User added')
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Adding user failed')
|
||||
|
||||
@app.route('/projects/<int:task_id>/del', methods=['GET','POST'])
|
||||
def deltask(task_id:int):
|
||||
try:
|
||||
task = Task.query.get(task_id)
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Task not found, bad URL')
|
||||
if task is None:
|
||||
return render_template('pages/response.html', response = 'Task not found, bad URL')
|
||||
try:
|
||||
taskusers = TaskUser.query.filter_by(taskid = task_id).all()
|
||||
except:
|
||||
taskusers = None
|
||||
creatorid = task.creatorid
|
||||
if request.method == 'GET':
|
||||
if creatorid is None:
|
||||
try:
|
||||
db.session.delete(task)
|
||||
db.session.commit()
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Deleting task failed')
|
||||
try:
|
||||
if taskusers != None:
|
||||
for taskuser in taskusers:
|
||||
db.session.delete(taskuser)
|
||||
db.session.commit()
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Deleting user assignment to task failed')
|
||||
return render_template('pages/response.html', response = 'Task deleted')
|
||||
else:
|
||||
return render_template('pages/deltask.html', task = task)
|
||||
if request.method == 'POST':
|
||||
password = request.form['password']
|
||||
if len(password) < 1 or len(password) > 500:
|
||||
return render_template('pages/response.html', response = "Password lenght invalid, only smaller then 500 charachters allowed")
|
||||
# Check password
|
||||
if password != ADMINPASS and password != User.query.get(creatorid).password:
|
||||
return render_template('pages/response.html', response = 'Wrong password')
|
||||
# Delete task
|
||||
try:
|
||||
db.session.delete(task)
|
||||
db.session.commit()
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Deleting task failed')
|
||||
try:
|
||||
if taskusers != None:
|
||||
for taskuser in taskusers:
|
||||
db.session.delete(taskuser)
|
||||
db.session.commit()
|
||||
except:
|
||||
return render_template('pages/response.html', response = 'Deleting user assignment to task failed')
|
||||
return render_template('pages/response.html', response = 'Task deleted')
|
||||
|
@ -1,24 +1,36 @@
|
||||
:root {
|
||||
--border-radus: 1rem;
|
||||
--background: #000000;
|
||||
--header-background: #FFFFFF;
|
||||
--background: #383840;
|
||||
--header-background: #212121;
|
||||
--header-height: 3rem;
|
||||
--input-bar-height: 3rem;
|
||||
--white: #FFF;
|
||||
--primary: #d2d2d2;
|
||||
--font-primary: #d2d2d2;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
body{
|
||||
background: var(--background);
|
||||
font-family: sans-serif;
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: var(--font-primary);
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-self: flex-start;
|
||||
gap: 1rem;
|
||||
margin: 0 auto;
|
||||
padding: 30px 0;
|
||||
height: calc(100vh - var(--header-height) - var(--input-bar-height));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -35,6 +47,12 @@ header {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
header ul {
|
||||
display: flex;
|
||||
list-style-type: none;
|
||||
gap:15px
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 100vw;
|
||||
height: var(--input-bar-height);
|
||||
@ -46,3 +64,120 @@ footer {
|
||||
box-sizing: border-box;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
/* global classes */
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 30px;
|
||||
}
|
||||
|
||||
.page h1 {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.btn-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 15px 12px;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 5px 20px;
|
||||
border: 1px solid var(--primary);
|
||||
color: var(--primary);
|
||||
background-color: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-color: rgba(0,0,0,0.3);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 11px;
|
||||
display: inline-block;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.underline {
|
||||
border-bottom: 1px solid var(--font-primary);
|
||||
padding-bottom: 2px;
|
||||
margin-top:20px;
|
||||
}
|
||||
|
||||
.section-tasks > ul {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* page index*/
|
||||
|
||||
.page-index .btn{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.task-wrap {
|
||||
border: 1px solid var(--primary);
|
||||
padding: 20px 40px 40px 40px;
|
||||
border-radius: 5px;
|
||||
box-shadow: inset 0 0 9px 4px rgba(255,255,255, 0.1);
|
||||
}
|
||||
|
||||
.task {
|
||||
display: flex;
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
|
||||
.task a:hover {
|
||||
background-color: rgba(255,255,255,0.1);
|
||||
}
|
||||
|
||||
.task a {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Page projects */
|
||||
|
||||
.page-project h1 {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.user-info-wrap{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* form */
|
||||
|
||||
.form-wrap {
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.form-input input {
|
||||
height: 25px;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
2
taskmanager/templates/includes/footer.html
Normal file
2
taskmanager/templates/includes/footer.html
Normal file
@ -0,0 +1,2 @@
|
||||
<footer>
|
||||
</footer>
|
8
taskmanager/templates/includes/header.html
Normal file
8
taskmanager/templates/includes/header.html
Normal file
@ -0,0 +1,8 @@
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li class="current"><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
31
taskmanager/templates/includes/index.html
Normal file
31
taskmanager/templates/includes/index.html
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<header>
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li class="current"><a href="/">Home</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="container page page-index">
|
||||
<section>
|
||||
<div class="btn">
|
||||
<a href="/addtask">Add new task</a>
|
||||
</div>
|
||||
<div class="tasks-wrap">
|
||||
<h1>Tasks</h1>
|
||||
{% for task in tasks %}
|
||||
<div class="task">
|
||||
<a href="/projects/{{task.id}}">
|
||||
<div>{{task.id}}.</div>
|
||||
<div>{{task.name}}</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
{% endblock content %}
|
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Decentrala</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
{% for task in tasks %}
|
||||
<li>{{task}}</li>
|
||||
{% endfor %}
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
15
taskmanager/templates/layouts/base.html
Normal file
15
taskmanager/templates/layouts/base.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
<title>Task manager</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include "includes/header.html" %}
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
{% include "includes/footer.html" %}
|
||||
</body>
|
||||
</html>
|
25
taskmanager/templates/pages/addtask.html
Normal file
25
taskmanager/templates/pages/addtask.html
Normal file
@ -0,0 +1,25 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<main class="container page page-addtask">
|
||||
<h1>Create new task</h1>
|
||||
<div class="form-wrap">
|
||||
<form action="/addtask" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="taskname" class="label">Task name:</label>
|
||||
<input type="text" name="taskname" id="taskname" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="taskdesc" class="label">Description:</label>
|
||||
<input type="text" name="taskdesc" id="taskdesc" placeholder="optional"/>
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="username" class="label">Username:</label>
|
||||
<input type="text" name="username" id="username" placeholder="optional"/>
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock content %}
|
19
taskmanager/templates/pages/deltask.html
Normal file
19
taskmanager/templates/pages/deltask.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<body>
|
||||
<main class="container page page-addtask">
|
||||
<h1>Create new task</h1>
|
||||
<div class="form-wrap">
|
||||
<form action="/projects/{{task.id}}/del" method="POST">
|
||||
<p> Task creator's password <p>
|
||||
<div class="form-input">
|
||||
<label for="password" class="label">password:</label>
|
||||
<input type="password" name="password" id="password" required />
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">DELETE</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock content %}
|
21
taskmanager/templates/pages/index.html
Normal file
21
taskmanager/templates/pages/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<main class="container page page-index">
|
||||
<section>
|
||||
<div class="btn">
|
||||
<a href="/addtask">Add new task</a>
|
||||
</div>
|
||||
<div class="tasks-wrap">
|
||||
<h1>Tasks</h1>
|
||||
{% for task in tasks %}
|
||||
<div class="task">
|
||||
<a href="/projects/{{task.id}}">
|
||||
<div>{{task.id}}.</div>
|
||||
<div>{{task.name}}</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
{% endblock content %}
|
36
taskmanager/templates/pages/project.html
Normal file
36
taskmanager/templates/pages/project.html
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<main class="container page page-project">
|
||||
<section >
|
||||
<h1>{{task.name}}</h1>
|
||||
<label class="label underline">Description</label>
|
||||
<p>{{task.desc}}</p>
|
||||
</section>
|
||||
<section class="section-task">
|
||||
<div>
|
||||
<label class="label underline">Users added to this task</label>
|
||||
{% for user in users %}
|
||||
<div class="user-info-wrap">
|
||||
<div><b>Username:</b> {{user.username}}</div>
|
||||
<div><b>Contact info:</b> {{user.contact}}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
<label class="label underline"> Add person to task</label>
|
||||
<div class="form-wrap">
|
||||
<form action="/projects/{{task.id}}" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="username" class="label">Username:</label>
|
||||
<input type="text" name="username" id="username" required />
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
<p><a href="/projects/{{task.id}}/del">DELETE TASK</a><p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
{% endblock content %}
|
24
taskmanager/templates/pages/register.html
Normal file
24
taskmanager/templates/pages/register.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<main class="container page page-register">
|
||||
<div class="form-wrap">
|
||||
<form action="/register" method="POST">
|
||||
<div class="form-input">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" name="username" id="username" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="contact">Contact:</label>
|
||||
<input type="text" name="contact" id="contact" required />
|
||||
</div>
|
||||
<div class="form-input">
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" name="password" placeholder="optional" id="password"/>
|
||||
</div>
|
||||
<div class="btn-wrap">
|
||||
<button class="btn">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock content %}
|
8
taskmanager/templates/pages/response.html
Normal file
8
taskmanager/templates/pages/response.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
{% block content %}
|
||||
<main class="container page page-project">
|
||||
<section >
|
||||
<p>{{response}}<p>
|
||||
</section>
|
||||
</main>
|
||||
{% endblock content %}
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Submit</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<form action="/submit" method="POST">
|
||||
<label for="forminput1">forminput1</label>
|
||||
<input type="text" name="forminput1" id="forminput1" required>
|
||||
<label for="forminput2">forminput2</label>
|
||||
<input type="text" name="forminput2" id="forminput2" required>
|
||||
<button> Submit </button>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user