diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-12-04 23:40:02 -0500 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-12-04 23:40:02 -0500 |
| commit | 4e5e1a42e0782fa75ef22cb347588e0f0c101249 (patch) | |
| tree | 13845bbed7b678b4f71cd57b705140e4d0b2c8d4 | |
| parent | 7eecc9b3ee32a51c0344cced1a28e3a24cdf3d99 (diff) | |
| download | famille-flask-4e5e1a42e0782fa75ef22cb347588e0f0c101249.tar.gz | |
Redesign news list
| -rw-r--r-- | static/main.css | 10 | ||||
| -rw-r--r-- | templates/layout.html | 2 | ||||
| -rw-r--r-- | templates/news/list.html | 111 |
3 files changed, 73 insertions, 50 deletions
diff --git a/static/main.css b/static/main.css index 5dfa186..f4f67c7 100644 --- a/static/main.css +++ b/static/main.css @@ -1,7 +1,3 @@ -body { - font-size: 14px; -} - .borderless td, .borderless tr { border: none !important; @@ -15,4 +11,8 @@ body { .date { color: rgba(0, 0, 0, 0.6); font-size: 14px; -}
\ No newline at end of file +} + +article > header { + margin-bottom: 2em; +} diff --git a/templates/layout.html b/templates/layout.html index da1dd57..6b67943 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -4,8 +4,8 @@ <title>{% block title %}Site de la famille{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="stylesheet" media="screen" type="text/css" href="{{ url_for('static', filename = 'main.css') }}" /> <link rel="stylesheet" media="screen" type="text/css" href="{{ url_for('static', filename = 'bootstrap-flat.min.css') }}" /> + <link rel="stylesheet" media="screen" type="text/css" href="{{ url_for('static', filename = 'main.css') }}" /> <link rel="alternate" type="application/rss+xml" title="Les actualités" href='rss.xml' /> </head> <body> diff --git a/templates/news/list.html b/templates/news/list.html index d25715b..eba2495 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -1,54 +1,77 @@ {% extends 'layout.html' %} {% block content %} -<div class="second_menu"> - <a href="/news/add/">Ajouter une actualité</a> -</div> -<div class="quickview"> -<h2>Dernières visites</h2> +<div class="row"> + +<div class="col-md-8"> + +<p class="second_menu text-center"> + <a href="http://famille.horel.org/news/add/">Ajouter une actualité</a> +</p> + + -<table> - {% for user in users %} - <tr> - <td><a href="{{url_for('view_user', user_id=user.id)}}">{{user.user_name}}</a></td> - <td>{{user.last_seen|format_ago('%a %d %b à %Hh%M')|safe}}</td> - </tr> - {% endfor %} -</table> +{% for news in news %} -<h2>Derniers commentaires</h2> -<ul id="last-comments"> - {% for comment in comments %} - <li><a href="{{url_for('view_user', user_id=comment.user_id)}}">{{comment.user_name}}</a> - {{comment.date|format_ago('%a %d %b à %Hh%M')|safe}}<br/> - {{comment.content_cache|shortify|safe}} <a href="{{url_for('show_news', news_id=comment.news_id)}}#comments">[…]</a> - </li> - {% else %} - Pas de commentaires. - {% endfor %} -</ul> +<article> + <header> + <h2><a href="{{url_for('show_news', news_id = news.id)}}">{{ news.title }}</a></h2> + + {% if news.user_name==session.user_name %} + <p class="pull-right"> | <a href="{{url_for('edit_news', news_id = news.id)}}">Modifier</a> </p> + {% endif %} + + <p class="comments pull-right"> + <a href="{{url_for('show_news', news_id = news.id)}}#add">{{"Commentaire"|pluralize(news.ncomments)}}</a> + </p> + + <p>Posté par <a href="{{url_for('view_user', user_id=news.user_id)}}">{{news.user_name}}</a> le {{news.date|format_date}}</p> + </header> + + <div class="news_content"> + <p>{{ news.content_cache|safe }}</p> + </div> +</article> +<hr/> + +{% endfor %} </div> -<div class="news"> - {% for news in news %} - <div class="news_head"> - <h2><a href="{{url_for('show_news', news_id = news.id)}}">{{ news.title }}</a> - </h2> - {% if news.user_name==session.user_name %} - <div style="float:right"> - <a href="{{url_for('edit_news', news_id = news.id)}}">Modifier cette actualité</a> +<div class="col-md-4"> + + <div class="panel panel-default"> + <div class="panel-heading">Dernières visites</div> + <div class="panel-body"> + <table class="table table-condensed borderless"> + {% for user in users %} + <tr> + <td><a href="{{url_for('view_user', user_id=user.id)}}">{{user.user_name}}</a></td> + <td>{{user.last_seen|format_ago('%a %d %b à %Hh%M')|safe}}</td> + </tr> + {% endfor %} + </table> + </div> </div> - {% endif %} - <p>Posté par <a href="{{url_for('view_user', user_id = news.user_id)}}">{{ news.user_name }}</a> le {{news.date|format_date}}</p> - </div> - <p class="comments"> - <a href="{{url_for('show_news', news_id = news.id)}}#comments">{{"Commentaire"|pluralize(news.ncomments)}}</a> | - <a href="{{url_for('show_news', news_id = news.id)}}#add">Ajouter un commentaire</a> -</p> - <div class="news_content"> - <p>{{ news.content_cache|safe }}</p> - </div> - {% endfor %} + + + <div class="panel panel-default"> + <div class="panel-heading">Derniers commentaires</div> + <div class="panel-body"> + <ul id="last-comments" class="list-unstyled"> + {% for comment in comments %} + <li><a href="{{url_for('view_user', user_id=comment.user_id)}}">{{comment.user_name}}</a> + {{comment.date|format_ago('%a %d %b à %Hh%M')|safe}}<br/> + {{comment.content_cache|shortify|safe}} <a href="{{url_for('show_news', news_id=comment.news_id)}}#comments">[…]</a> + </li> + {% else %} + Pas de commentaires. + {% endfor %} + </ul> + </div> + </div> + </div> -<div style="clear:both"/> + +</div> + {% endblock %} |
