diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-10-13 12:10:57 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-10-13 12:10:57 +0200 |
commit | e3ed62caa7d4fe832adacf82b97b8802961e0d08 (patch) | |
tree | e8f1ed4f85eebfc2104e591303844964ba20d310 /pyaggr3g470r | |
parent | First prototype for the /article page. (diff) | |
download | newspipe-e3ed62caa7d4fe832adacf82b97b8802961e0d08.tar.gz newspipe-e3ed62caa7d4fe832adacf82b97b8802961e0d08.tar.bz2 newspipe-e3ed62caa7d4fe832adacf82b97b8802961e0d08.zip |
First prototype for the /articles page.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/templates/articles.html | 27 | ||||
-rw-r--r-- | pyaggr3g470r/templates/home.html | 9 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 8 |
3 files changed, 38 insertions, 6 deletions
diff --git a/pyaggr3g470r/templates/articles.html b/pyaggr3g470r/templates/articles.html new file mode 100644 index 00000000..374eaea7 --- /dev/null +++ b/pyaggr3g470r/templates/articles.html @@ -0,0 +1,27 @@ +{% extends "layout.html" %} +{% block content %} +<div class="container"> + {% for number in range(0, feed.articles|sort(attribute='date')|length-2, 3) %} + <div class="row"> + <div class="col-xs-6 col-sm-4 col-md-4"> + {% if feed.articles[number].readed %}<h3>{% else %}<h1>{% endif %} + <a href="/article/{{ feed.articles[number].id }}">{{ feed.articles[number].title }}</a><h2> + {% if feed.articles[number].readed %}</h3>{% else %}</h1>{% endif %} + <h6>{{ feed.articles[number].date }}</h6> + </div> + <div class="col-xs-6 col-sm-4 col-md-4"> + {% if feed.articles[number+1].readed %}<h3>{% else %}<h1>{% endif %} + <a href="/article/{{ feed.articles[number+1].id }}">{{ feed.articles[number+1].title }}</a><h2> + {% if feed.articles[number+1].readed %}</h3>{% else %}</h1>{% endif %} + <h6>{{ feed.articles[number+1].date }}</h6> + </div> + <div class="col-xs-6 col-sm-4 col-md-4"> + {% if feed.articles[number+2].readed %}<h3>{% else %}<h1>{% endif %} + <a href="/article/{{ feed.articles[number+2].id }}">{{ feed.articles[number+2].title }}</a><h2> + {% if feed.articles[number+2].readed %}</h3>{% else %}</h1>{% endif %} + <h6>{{ feed.articles[number+2].date }}</h6> + </div> + </div> + {% endfor %} +</div><!-- /.container --> +{% endblock %}
\ No newline at end of file diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html index b6e24a50..614ad269 100644 --- a/pyaggr3g470r/templates/home.html +++ b/pyaggr3g470r/templates/home.html @@ -3,11 +3,12 @@ <div class="container"> {% for feed in feeds %} <div class="row"> - <div class="col-md-6 col-md-offset-3"><h1>{{ feed.title }}</h1></div> + <div class="col-md-6 col-md-offset-3"> + <h1>{{ feed.title }}</h1> + <a href="/articles/{{ feed.id }}"><i class="glyphicon glyphicon-th-list"></i></a> + </div> </div> - {% for number in range(0, feed.articles[:10]|length-2, 3) %} - - + {% for number in range(0, feed.articles[:10]|sort(attribute='date')|length-2, 3) %} <div class="row"> <div class="col-xs-6 col-sm-4 col-md-4"> {% if feed.articles[number].readed %}<h3>{% else %}<h1>{% endif %} diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index eb1bf0c0..b4f93ddf 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -41,5 +41,9 @@ def feed(feed_id=None): @app.route('/article/<article_id>', methods=['GET']) def article(article_id=None): article = models.Article.objects(id=article_id).first() - print article.content - return render_template('article.html', article=article)
\ No newline at end of file + return render_template('article.html', article=article) + +@app.route('/articles/<feed_id>', methods=['GET']) +def articles(feed_id=None): + feed = models.Feed.objects(id=feed_id).first() + return render_template('articles.html', feed=feed)
\ No newline at end of file |