aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/docs.py15
-rw-r--r--wqflask/wqflask/templates/docedit.html3
-rw-r--r--wqflask/wqflask/templates/docs.html6
-rw-r--r--wqflask/wqflask/views.py30
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 @@
<form action="/update_text" method="post">
<input type="hidden" name="entry_type" value="{{ entry }}">
<input type="hidden" name="title" value="{{ title }}">
+ {% if editable is defined %}
+ <input type="hidden" name="edit" value="{{ editable }}">
+ {% endif %}
<textarea name="ckcontent" id="ckcontent">
{{content|safe}}
</textarea>
diff --git a/wqflask/wqflask/templates/docs.html b/wqflask/wqflask/templates/docs.html
index 1a241ce7..1e5a7aef 100644
--- a/wqflask/wqflask/templates/docs.html
+++ b/wqflask/wqflask/templates/docs.html
@@ -6,9 +6,11 @@
<div class="container">
<h3>{{title}}</h3>
<div style="text-align: right;">
- <!--<a href="docedit?entry={{entry}}">-->
+ {% if editable == "true" %}
+ <a href="docedit?entry={{entry}}&edit=true">
<img style="width: 16px;" src="/static/new/images/edit.gif">
- <!--</a>-->
+ </a>
+ {% endif %}
</div>
{{content|safe}}
</div>
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index cef5f8ec..70748040 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -216,7 +216,7 @@ def gsearch_updating():
@app.route("/docedit")
def docedit():
logger.info(request.url)
- doc = docs.Docs(request.args['entry'])
+ doc = docs.Docs(request.args['entry'], request.args)
return render_template("docedit.html", **doc.__dict__)
@app.route('/generated/<filename>')
@@ -227,7 +227,7 @@ def generated_file(filename):
@app.route("/help")
def help():
logger.info(request.url)
- doc = docs.Docs("help")
+ doc = docs.Docs("help", request.args)
return render_template("docs.html", **doc.__dict__)
@app.route("/wgcna_setup", methods=('POST',))
@@ -260,46 +260,42 @@ def ctl_results():
result = ctl.process_results(ctlA) # After the analysis is finished store the result
return render_template("ctl_results.html", **result) # Display them using the template
-#@app.route("/news")
-#def news_route():
-# newsobject = news.News()
-# return render_template("news.html", **newsobject.__dict__)
-
@app.route("/news")
def news():
- doc = docs.Docs("news")
+ doc = docs.Docs("news", request.args)
return render_template("docs.html", **doc.__dict__)
@app.route("/references")
def references():
- # doc = docs.Docs("references")
- # return render_template("docs.html", **doc.__dict__)
- return render_template("reference.html")
+ doc = docs.Docs("references", request.args)
+ return render_template("docs.html", **doc.__dict__)
+ # return render_template("reference.html")
@app.route("/intro")
def intro():
- doc = docs.Docs("intro")
+ doc = docs.Docs("intro", request.args)
return render_template("docs.html", **doc.__dict__)
@app.route("/policies")
def policies():
- doc = docs.Docs("policies")
+ doc = docs.Docs("policies", request.args)
return render_template("docs.html", **doc.__dict__)
@app.route("/links")
def links():
- doc = docs.Docs("links")
- return render_template("docs.html", **doc.__dict__)
+ #doc = docs.Docs("links")
+ #return render_template("docs.html", **doc.__dict__)
+ return render_template("links.html")
@app.route("/environments")
def environments():
- doc = docs.Docs("environments")
+ doc = docs.Docs("environments", request.args)
return render_template("docs.html", **doc.__dict__)
@app.route("/update_text", methods=('POST',))
def update_page():
docs.update_text(request.form)
- doc = docs.Docs(request.form['entry_type'])
+ doc = docs.Docs(request.form['entry_type'], request.form)
return render_template("docs.html", **doc.__dict__)
@app.route("/submit_trait")