feat: add quick task completion action
This commit is contained in:
@@ -112,7 +112,7 @@ def quick_create():
|
||||
form = QuickTaskForm(prefix="quick")
|
||||
config = get_quick_task_config()
|
||||
form.effort.choices = [
|
||||
(key, f"{values['label']} · {values['points']} Punkte")
|
||||
(key, values["label"])
|
||||
for key, values in config.items()
|
||||
]
|
||||
|
||||
@@ -122,7 +122,12 @@ def quick_create():
|
||||
flash(error, "error")
|
||||
return redirect(request.referrer or url_for("tasks.my_tasks"))
|
||||
|
||||
quick_action = request.form.get("quick_action", "save")
|
||||
task = create_quick_task(form.title.data, form.effort.data, current_user)
|
||||
if quick_action == "complete":
|
||||
complete_task(task, current_user.id)
|
||||
flash(f"Schnellaufgabe „{task.title}“ wurde direkt als erledigt gespeichert.", "success")
|
||||
else:
|
||||
flash(f"Schnellaufgabe „{task.title}“ wurde für dich angelegt.", "success")
|
||||
return redirect(request.referrer or url_for("tasks.my_tasks"))
|
||||
|
||||
|
||||
@@ -129,7 +129,8 @@
|
||||
{{ quick_task_form.effort() }}
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
{{ quick_task_form.submit(class_='button') }}
|
||||
<button type="submit" class="button" name="quick_action" value="save">Aufgabe speichern</button>
|
||||
<button type="submit" class="button button--secondary" name="quick_action" value="complete">Aufgabe als erledigt speichern</button>
|
||||
<button type="button" class="button button--ghost" id="quickTaskClose">Abbrechen</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user