From 3a5898afca1f3f00ff84e3d2eb310405df00e567 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 25 Sep 2019 11:46:35 -0500 Subject: Added option to edit most of the help pages except for Links --- wqflask/wqflask/docs.py | 15 ++++++++++++--- wqflask/wqflask/templates/docedit.html | 3 +++ wqflask/wqflask/templates/docs.html | 6 ++++-- wqflask/wqflask/views.py | 30 +++++++++++++----------------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 9777f170..f45202af 100644 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -7,7 +7,7 @@ logger = getLogger(__name__) class Docs(object): - def __init__(self, entry): + def __init__(self, entry, start_vars={}): sql = """ SELECT Docs.title, Docs.content FROM Docs @@ -15,8 +15,17 @@ class Docs(object): """ result = g.db.execute(sql, str(entry)).fetchone() self.entry = entry - self.title = result[0] - self.content = result[1] + if result == None: + self.title = self.entry.capitalize() + self.content = "" + else: + self.title = result[0] + self.content = result[1] + + if 'edit' in start_vars and start_vars['edit'] == "true": + self.editable = "true" + else: + self.editable = "false" def update_text(start_vars): content = start_vars['ckcontent'] diff --git a/wqflask/wqflask/templates/docedit.html b/wqflask/wqflask/templates/docedit.html index 8c3d5e7c..e8aa7da1 100644 --- a/wqflask/wqflask/templates/docedit.html +++ b/wqflask/wqflask/templates/docedit.html @@ -8,6 +8,9 @@