diff options
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/docs.py | 1 | ||||
-rwxr-xr-x | wqflask/wqflask/news.py | 16 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/docedit.html (renamed from wqflask/wqflask/templates/testhtmleditor.html) | 8 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/docs.html | 5 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/news.html | 21 | ||||
-rwxr-xr-x | wqflask/wqflask/views.py | 13 |
6 files changed, 57 insertions, 7 deletions
diff --git a/wqflask/wqflask/docs.py b/wqflask/wqflask/docs.py index 65255987..07b0b81a 100755 --- a/wqflask/wqflask/docs.py +++ b/wqflask/wqflask/docs.py @@ -11,5 +11,6 @@ class Docs(object): WHERE Docs.entry LIKE '%s' """ result = g.db.execute(sql % (entry)).fetchone() + self.entry = entry self.title = result[0] self.content = result[1] diff --git a/wqflask/wqflask/news.py b/wqflask/wqflask/news.py new file mode 100755 index 00000000..62dc1bbb --- /dev/null +++ b/wqflask/wqflask/news.py @@ -0,0 +1,16 @@ +from __future__ import absolute_import, print_function, division +import sys +reload(sys) +sys.setdefaultencoding('utf8') +from flask import g + +class News(object): + + def __init__(self): + sql = """ + SELECT News.id, News.date, News.details + FROM News + order by News.date desc + """ + self.title = "GeneNetwork News" + self.newslist = g.db.execute(sql).fetchall() diff --git a/wqflask/wqflask/templates/testhtmleditor.html b/wqflask/wqflask/templates/docedit.html index 1d258d0e..1a9e8ca8 100755 --- a/wqflask/wqflask/templates/testhtmleditor.html +++ b/wqflask/wqflask/templates/docedit.html @@ -1,18 +1,18 @@ {% extends "base.html" %} -{% block title %}Test html editor{% endblock %} +{% block title %}Edit: {{title}}{% endblock %} {% block content %} <div class="container"> - <h2>Test HTML Editor</h2> + <h3>Edit: {{title}}</h3> <form> <textarea name="ckcontent" id="ckcontent"> - Test HTML + {{content|safe}} </textarea> <script type="text/javascript" src="/static/packages/ckeditor/ckeditor.js"></script> <script type="text/javascript"> CKEDITOR.replace('ckcontent', { - height: '500px', + height: '650px', }); </script> </form> diff --git a/wqflask/wqflask/templates/docs.html b/wqflask/wqflask/templates/docs.html index cbaf1e70..08f95721 100755 --- a/wqflask/wqflask/templates/docs.html +++ b/wqflask/wqflask/templates/docs.html @@ -5,6 +5,11 @@ {% block content %} <div class="container"> <h3>{{title}}</h3> + <div style="text-align: right;"> + <a href="docedit?entry={{entry}}"> + <img style="width: 25px;" src="/static/images/edit.png"> + </a> + </div> {{content|safe}} </div> {% endblock %} diff --git a/wqflask/wqflask/templates/news.html b/wqflask/wqflask/templates/news.html new file mode 100755 index 00000000..4f0032b8 --- /dev/null +++ b/wqflask/wqflask/templates/news.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block title %}{{title}}{% endblock %} + +{% block content %} +<div class="container"> + <h3>{{title}}</h3> + <table class="table table-hover table-striped" style="width: 600px;"> + <tbody> + {% for newsitem in newslist %} + <tr> + <td style="width: 90px; text-wrap:none;" nowrap> + <span style="font-weight: bold;">{{newsitem.date}}</span> + </td> + <td>{{newsitem.details|safe}}</td> + </tr> + {% endfor %} + </tbody> + </table> +</div> +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index b7864041..39004f07 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -33,6 +33,7 @@ from flask import (render_template, request, make_response, Response, from wqflask import search_results from wqflask import docs +from wqflask import news from base.data_set import DataSet # Used by YAML in marker_regression from base.data_set import create_datasets_list from wqflask.show_trait import show_trait @@ -150,15 +151,21 @@ def search_page(): else: return render_template("search_result_page.html", **result) -@app.route("/testhtmleditor") -def testhtmleditor_page(): - return render_template("testhtmleditor.html") +@app.route("/docedit") +def docedit(): + doc = docs.Docs(request.args['entry']) + return render_template("docedit.html", **doc.__dict__) @app.route("/help") def help(): doc = docs.Docs("help") return render_template("docs.html", **doc.__dict__) +@app.route("/news") +def news_route(): + newsobject = news.News() + return render_template("news.html", **newsobject.__dict__) + @app.route("/references") def references(): doc = docs.Docs("references") |