From 5ec961a719246d5082814c8eb49ee3f3d7cea11e Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Thu, 18 Dec 2014 16:16:46 +0000 Subject: Committer: Lei Yan On branch master --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9a509baa..b2c841ad 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *.bak *~ web/new_genotypes/HSNIH.json +wqflask/secure_server.py -- cgit v1.2.3 From 4ea8b8a5efc848c99767894cbdbef2f135e3b83c Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Thu, 18 Dec 2014 16:51:47 +0000 Subject: Committer: Lei Yan On branch master --- web/images/edit.png | Bin 0 -> 4322 bytes wqflask/wqflask/docs.py | 1 + wqflask/wqflask/templates/docedit.html | 20 ++++++++++++++++++++ wqflask/wqflask/templates/docs.html | 5 +++++ wqflask/wqflask/templates/testhtmleditor.html | 20 -------------------- wqflask/wqflask/views.py | 7 ++++--- 6 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 web/images/edit.png create mode 100755 wqflask/wqflask/templates/docedit.html delete mode 100755 wqflask/wqflask/templates/testhtmleditor.html diff --git a/web/images/edit.png b/web/images/edit.png new file mode 100644 index 00000000..dda50521 Binary files /dev/null and b/web/images/edit.png differ 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/templates/docedit.html b/wqflask/wqflask/templates/docedit.html new file mode 100755 index 00000000..1a9e8ca8 --- /dev/null +++ b/wqflask/wqflask/templates/docedit.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{% block title %}Edit: {{title}}{% endblock %} + +{% block content %} +
+

Edit: {{title}}

+
+ + + +
+
+{% endblock %} 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 %}

{{title}}

+
+ + + +
{{content|safe}}
{% endblock %} diff --git a/wqflask/wqflask/templates/testhtmleditor.html b/wqflask/wqflask/templates/testhtmleditor.html deleted file mode 100755 index 1d258d0e..00000000 --- a/wqflask/wqflask/templates/testhtmleditor.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Test html editor{% endblock %} - -{% block content %} -
-

Test HTML Editor

-
- - - -
-
-{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index cdf93147..deb566ba 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -134,9 +134,10 @@ 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(): -- cgit v1.2.3 From 723fcb3723d16e4ef476b0fc7471f7a770ed01be Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Fri, 13 Feb 2015 18:18:49 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/news.py | 16 ++++++++++++++++ wqflask/wqflask/templates/news.html | 21 +++++++++++++++++++++ wqflask/wqflask/views.py | 13 ++++--------- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100755 wqflask/wqflask/news.py create mode 100755 wqflask/wqflask/templates/news.html 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/news.html b/wqflask/wqflask/templates/news.html new file mode 100755 index 00000000..0a19dcee --- /dev/null +++ b/wqflask/wqflask/templates/news.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block title %}{{title}}{% endblock %} + +{% block content %} +
+

{{title}}

+ + + {% for newsitem in newslist %} + + + + + {% endfor %} + +
+ {{newsitem.date}} + {{newsitem.details|safe}}
+
+{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index deb566ba..7c0f4e14 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -30,6 +30,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 @@ -145,15 +146,9 @@ def help(): return render_template("docs.html", **doc.__dict__) @app.route("/news") -def news(): - #variables = whats_new.whats_new() - with open("/home/sam/gene/wqflask/wqflask/yaml_data/whats_new.yaml") as fh: - contents = fh.read() - yamilized = yaml.safe_load(contents) - news_items = yamilized['news'] - for news_item in news_items: - print("\nnews_item is: %s\n" % (news_item)) - return render_template("whats_new.html", news_items=news_items) +def news_route(): + newsobject = news.News() + return render_template("news.html", **newsobject.__dict__) @app.route("/references") def references(): -- cgit v1.2.3 From 0e21a58cfe7ca1ec6c1d84c43e1d2fd2d0b9104c Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Fri, 13 Feb 2015 19:54:00 +0000 Subject: Committer: Lei Yan On branch master --- wqflask/wqflask/templates/news.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/news.html b/wqflask/wqflask/templates/news.html index 0a19dcee..4f0032b8 100755 --- a/wqflask/wqflask/templates/news.html +++ b/wqflask/wqflask/templates/news.html @@ -5,11 +5,11 @@ {% block content %}

{{title}}

- +
{% for newsitem in newslist %} - -- cgit v1.2.3
+ {{newsitem.date}} {{newsitem.details|safe}}