aboutsummaryrefslogtreecommitdiffstats
path: root/templates/news/show.html
blob: 905463d889cc70d7804df21f2473935afee7a880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{% extends 'layout.html' %}

{% block content %}

<div class="row">
  <div class="col-md-8">
    <h2>{{news.title}}</h2>
    <p class="new_content">
      {{news.content_cache|safe}}
    </p>
    <hr/>

    <h3 id="comments">Commentaires</h3>
    {% if not comments %}
    Pas de commentaires pour l'instant.
    {% endif %}
    {% for comment in comments %}
    <div class="media comment" style="width:100%">
      <div class="media-left">
        <img src="{{ url_for('static', filename=
                  'gfx/'+comment.user_name+'.jpg') }}" alt="{{comment.user_name}}" class="img-circle">
      </div>
      <div class="media-body" style="width:100%">
        <h4 class="media-heading"><p class="pull-right date">
            {% if comment.user_id==session.user_id %}
            <a class="edit" href="#">Modifier</a>
            {% endif %}
            {{comment.date|format_date}}
            </p>
        <a href="{{url_for('view_user', user_id=comment.user_id)}}">{{comment.user_name}}</a></h4>
        <div class="comment-content">
        {{comment.content_cache|safe}}
        </div>
        {% if comment.user_id==session.user_id %}
        <form class="comment-source" data-id="{{comment.id}}">
            <div class="form-group">
                <textarea name="content" class="form-control" rows="3">{{comment.content}}</textarea>
            </div>
            <button type="submit" class="btn btn-primary">Modifier</button>
        </form>
        {% endif %}
      </div>
    </div>
    {% endfor %}


    <h3 id="add">Ajouter un commentaire</h3>

    <form class="comment_add" role="form" method="post" action="{{url_for('show_news', news_id=news.id)}}">
      <div class="form-group">
        <textarea name="content" class="form-control" cols="90" rows="10"></textarea>
      </div>
      <button type="submit" class="btn btn-primary">Ajouter</button>
    </form>
  </div>

  <div class="col-md-4">
    <div class="panel panel-default">
      <div class="panel-heading">Détails</div>
      <div class="panel-body">
        <ul class="list-unstyled">
          <li>Auteur : <a href="{{url_for('view_user', user_id=news.user_id)}}">{{news.user_name}}</a></li>
          <li>Date : {{news.date|format_date}}</li>
          <li><a href="#comments">{{"Commentaire"|pluralize(comments|count)}}</a></li>
        </ul>
      </div>
    </div>
  </div>

{% endblock %}