diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-25 19:23:50 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-11-25 19:23:50 +0100 |
commit | 16f5be7f1446d3906343c6bf4ebe44fd3c3395b0 (patch) | |
tree | 30f0348152a94d10b3c081b7de9000f0d59b69d0 /source | |
parent | Template for the /notifications page. (diff) | |
download | newspipe-16f5be7f1446d3906343c6bf4ebe44fd3c3395b0.tar.gz newspipe-16f5be7f1446d3906343c6bf4ebe44fd3c3395b0.tar.bz2 newspipe-16f5be7f1446d3906343c6bf4ebe44fd3c3395b0.zip |
Template for the /statistics page.
Diffstat (limited to 'source')
-rwxr-xr-x | source/pyAggr3g470r.py | 23 | ||||
-rw-r--r-- | source/templates/statistics.html | 17 |
2 files changed, 21 insertions, 19 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index fb7da783..a7f12de8 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -289,25 +289,10 @@ class pyAggr3g470r(object): More advanced statistics. """ articles = self.mongo.get_all_articles() - html = htmlheader() - html += htmlnav - html += """<div class="left inner">\n""" - - # Some statistics (most frequent word) - if articles: - top_words = utils.top_words(articles, n=50, size=int(word_size)) - html += "<h1>Statistics</h1>\n" - html += "<h3>Tag cloud</h3>\n" - # Tags cloud - html += '<form method=get action="/statistics/">\n' - html += "Minimum size of a word:\n" - html += """<input type="number" name="word_size" value="%s" min="2" max="15" step="1" size="2"></form>\n""" % (word_size) - html += '<div style="width: 35%; overflow:hidden; text-align: justify">' + \ - utils.tag_cloud(top_words) + '</div>' - html += "<hr />\n" - - html += htmlfooter - return html + top_words = utils.top_words(articles, n=50, size=int(word_size)) + tag_cloud = utils.tag_cloud(top_words) + tmpl = lookup.get_template("statistics.html") + return tmpl.render(articles=articles, word_size=word_size, tag_cloud=tag_cloud) statistics.exposed = True diff --git a/source/templates/statistics.html b/source/templates/statistics.html new file mode 100644 index 00000000..42577efd --- /dev/null +++ b/source/templates/statistics.html @@ -0,0 +1,17 @@ +## statistics.html +<%inherit file="base.html"/> +<h1><div class="right innerlogo"><a href="/"><img src="/img/tuxrss.png" title="What's new today?"/></a> +</div><a name="top"><a href="/">pyAggr3g470r - News aggregator</a></a></h1> +<a href="http://bitbucket.org/cedricbonhomme/pyaggr3g470r/" rel="noreferrer" target="_blank">pyAggr3g470r (source code)</a> +<div class="left inner"> + %if articles: + <h1>Statistics</h1> + <h3>Tag cloud</h3> + <form method=get action="/statistics/"> + Minimum size of a word: + <input type="number" name="word_size" value="${word_size}" min="2" max="15" step="1" size="2"> + </form> + <div style="width: 35%; overflow:hidden; text-align: justify"> + ${tag_cloud} + </div> + %endif
\ No newline at end of file |