This commit is contained in:
Justine Pelletreau
2022-04-04 15:16:48 +02:00
parent c923e4b7f2
commit aa6a0f8e5e
8 changed files with 120 additions and 31 deletions

View File

@ -81,19 +81,6 @@ def rawtasks():
#No theme in export
return render_template("export.html", rawtasks = exporttasks())
#Read mode
@app.route('/readmode', methods=['GET','POST'])
def readmode():
#theme
csslink = request.cookies.get('csslink')
#Render page
if request.method == 'GET':
tasknumber = request.args.get("task")
mytask = findtask(int(tasknumber))
return render_template("read.html", task=mytask.flaskrender(), csslink = csslink)
#Edition mode
@app.route('/edit', methods=['GET', 'POST'])
@ -133,7 +120,8 @@ def edit():
rightnow = int(time.time())
newtask = task(createtime=tasknumber, modtime=rightnow, title=tasktitle, text=tasktext, done=taskdone, priority=taskpriority)
addtask(newtask)
return render_template("read.html", task=newtask.flaskrender(), csslink = csslink)
return render_template("homepage.html", ntodo = todotasks(gettasks()), ndone = donetasks(gettasks()), csslink = csslink)
#Basic route, allows task creation

View File

@ -41,12 +41,11 @@ class task:
rendered = f"""
<hr>
<div class="tasktitle">{Markup.escape(self.title)}</div>
<div class="priority">Priority: {self.priority}</div>
<div class="donemark">{self.donemark}</div>
<div class="tasktitle">{self.donemark} {Markup.escape(self.title)}</div>
<form action="." method="GET" name="{self.createtime}">
<button type="submit" name="toswitch" value="{self.createtime}" class "taskbutton">Done/Todo</button>|<button type="submit" name="delete" value="{self.createtime}" class="taskbutton" onclick="return confirm('Really ?')">Delete</button>|<button type="submit" name="edit" value="{self.createtime}" class="taskbutton">Edit</button>|<a href="{ url_for('render') }" class="backlink">Back</a>
</form>
<div class="tasktime">Priority: {self.priority}</div>
<div class="tasktime">Created : {self.rendertime(self.createtime)}
<br>Modified : {self.rendertime(self.modtime)}</div><br>
<div class="tasktext">{markdown.markdown(self.text, extensions=['fenced_code', 'codehilite', 'nl2br', 'smarty'])}</div><br>

View File

@ -157,6 +157,55 @@ a {
white-space: pre-wrap;
}
.priorityinput {
background-color: #22242e;
color: #f8f8f2;
border-radius: 5px;
border-style: none;
border-width: 1px;
width: 40px;
}
label {
background-color: transparent;
border: none;
color: #8be9fd;
padding: 1px 2px;
text-align: left;
text-decoration: none;
display: inline-block;
font-size: 1em;
font-style: normal;
cursor: pointer;
}
/* Hide priority select arrows
Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
.donemarkselect {
background-color: #22242e;
color: #f8f8f2;
border-radius: 5px;
border-style: inset;
border-color: #ff79c6;
border-width: 1px;
width: 40px;
}
.separator {
text-align: center;
}
/* Syntax highlighting */
pre { line-height: 125%; }
td.linenos .normal { color: #f1fa8c; background-color: #44475a; padding-left: 5px; padding-right: 5px; }

View File

@ -135,7 +135,7 @@ a {
border-style: none;
outline: none;
border-width: 1px;
height: 80%;
height: 40%;
font-size: 15px;
-webkit-box-shadow: 0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);
}
@ -158,6 +158,55 @@ a {
white-space: pre-wrap;
}
.priorityinput {
background-color: #eee8d5;
color: #586e75;
border-radius: 5px;
border-style: none;
border-width: 1px;
width: 40px;
}
label {
background-color: transparent;
border: none;
color: #2aa198;
padding: 1px 2px;
text-align: left;
text-decoration: none;
display: inline-block;
font-size: 1em;
font-style: normal;
cursor: pointer;
}
/* Hide priority select arrows
Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
.donemarkselect {
background-color: #eee8d5;
color: #586e75;
border-radius: 5px;
border-style: inset;
border-color: #ff79c6;
border-width: 1px;
width: 40px;
}
.separator {
text-align: center;
}
/* Syntax highlighting */
pre { line-height: 125%; }
td.linenos .normal { color: #93a1a1; background-color: #eee8d5; padding-left: 5px; padding-right: 5px; }

View File

@ -13,16 +13,20 @@
</div>
<form action="." method="POST">
<input type="text" name="title" class="title" placeholder="Title"><br>
<label for="priority">Priority(0-10): </label>
<input type="number" name="priority" class="priorityinput" id="priority" min="0" max="10">
<textarea type="text" name="text" rows = "5" cols = "60*" class="text" placeholder="Text"></textarea><br>
<label for="priority">Priority</label>
<input type="number" name="priority" class="priorityinput" id="priority" min="0" max="10" value="5"><br>
<button type="submit" name="submit">Post</button>
<div class="tasktime">Note : you can drag the textbox to make it bigger. Scroll down to see your previous tasks.</div>
</form>
<br>
<h2>Todo</h2>
<hr>
<h2 class="separator">Todo</h2>
<hr>
{{ ntodo }}
<h2>Done</h2>
<hr>
<h2 class="separator">Done</h2>
<hr>
{{ ndone }}
</body>