Ingen beskrivning

counterTemplate.html 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {% extends 'baseTemplate.html' %}
  2. {% block title %}{{counter.trigramme}}{% endblock %}
  3. {% block content %}
  4. {% load i18n %}
  5. {% load hashtags %}
  6. <div class="text-center">
  7. <h1>
  8. <a class="counter-link" href="{% url 'home' %}"><b>{{ counter.trigramme }}</b> <small>{{ counter.name }}</small></a>
  9. </h1>
  10. </div>
  11. <div class="container-fluid">
  12. <div class="row">
  13. <div class="col-md-3">
  14. <div class="panel panel-primary">
  15. <div class="panel-heading">
  16. <form action="{% url 'like' %}" method="POST" name="like{{counter.id}}">
  17. {% csrf_token %}
  18. <input type="hidden" name="liker" value="{{myCounter.id}}" />
  19. <input type="hidden" name="reset" value="{{counter.lastReset.id}}" <h2 class="panel-title" />
  20. <input type="hidden" name="redirect" value="{% url 'counter' id_counter=counter.id %}" />
  21. <a class="counter-link" href="{% url 'counter' id_counter=counter.id %}">
  22. <b>{{ counter.trigramme }}</b> <small>{{ counter.name }}</small>
  23. </a>
  24. {% if not counter.lastReset.noSeum %}
  25. {% if counter.alreadyLiked %}
  26. <span class="pull-right badge" {% if counter.likes_count > 0 %} data-toggle="tooltip" data-placement="top" title="{{ counter.likersString }}" {% endif %}>
  27. <span class="glyphicon glyphicon-ok"></span>&emsp;{{ counter.likes_count }}
  28. </span>
  29. {% elif counter.id == myCounter.id or counter.lastReset.who.id == myCounter.id %}
  30. <span class="pull-right badge" {% if counter.likes_count > 0 %} data-toggle="tooltip" data-placement="top" title="{{ counter.likersString }}" {% endif %}>
  31. <span class="glyphicon glyphicon-heart"></span>&emsp;{{ counter.likes_count }}
  32. </span>
  33. {% else %}
  34. <a class="pull-right badge" onclick="document.forms['like{{counter.id}}'].submit();">
  35. <span class="glyphicon glyphicon-heart"></span>&emsp;{{ counter.likes_count }}
  36. </a>
  37. {% endif %}
  38. {% endif %}
  39. </h2>
  40. </form>
  41. </div>
  42. <div class="seum-counter panel-body" style="height:125px" id="container{{counter.id}}">
  43. <div style="width:100%">
  44. {% if counter.lastReset.noSeum %}
  45. <strong>{% trans "No seum yet" %}.</strong><br />
  46. {% else %}
  47. <strong>
  48. {% if counter.lastReset.selfSeum %}
  49. {% trans "Got the seum" %} {{ counter.lastReset.formatted_delta }}.
  50. {% else %}{% blocktrans with trigram=counter.lastReset.who.trigramme time_ago=counter.lastReset.formatted_delta %}Seum thrown by {{ trigram }} {{ time_ago }}.{% endblocktrans %}
  51. {% endif %}
  52. </strong><br />
  53. {% endif %}
  54. <p>{{ counter.lastReset.reason | hashtag }}</p>
  55. <div class="text-center">
  56. <button id="button{{counter.id}}" class="btn btn-default btn-danger" type="button" onclick="revealSeumForm({{counter.id}})">
  57. {% trans "Reset the counter" %}
  58. </button>
  59. </div>
  60. <form style="display:none" id="counter{{counter.id}}" action="{% url 'reset-counter' %}" method="post">
  61. {% csrf_token %}
  62. <div class="form-group">
  63. <label for="reason">{% trans "Motive for the seum:" %}</label>
  64. <input id="reason{{counter.id}}" type="text" class="form-control" name="reason"></input>
  65. </div>
  66. <input type="hidden" name="counter" value="{{counter.id}}"></input>
  67. <input type="hidden" name="redirect" value="{% url 'counter' id_counter=counter.id %}"></input>
  68. <input type="hidden" name="who" value="{{myCounter.id}}"></input>
  69. <div class="text-center">
  70. <button type="submit" class="btn btn-default btn-success">{% trans "Throw the seum" %}</button>
  71. </div>
  72. </form>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="col-md-9">
  78. <div class="panel panel-info">
  79. <div class="panel-heading">
  80. <h2 class="panel-title">{% trans "Timeline of the seum" %}</h2>
  81. </div>
  82. <div class="graphs timeline panel-body">
  83. {% if counter.lastReset.noSeum %}
  84. <div class="text-center text-muted">
  85. <p>{% trans "No timeline of the seum yet..." %}</p>
  86. </div>
  87. {% else %}
  88. {{ chart.as_html }}
  89. {% endif %}
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="row">
  95. <div class="col-sm-12">
  96. <div class="panel panel-default">
  97. <div class="panel-heading">
  98. <h2 class="panel-title">
  99. {% trans "Seum history" %}
  100. <small class="badge pull-right">{{ seumFrequency }}/seum</small>
  101. </h2>
  102. </div>
  103. <div class="panel-body">
  104. <table class="table table-striped">
  105. <thead>
  106. <tr>
  107. <th>{% trans "Date" %}</th>
  108. <th>{% trans "Motive" %}</th>
  109. <th>{% trans "Seum thrower" %}</th>
  110. <th>{% trans "Number of likes" %}</th>
  111. </tr>
  112. </thead>
  113. <tbody>
  114. {% for reset in resets %}
  115. <tr>
  116. <td><b>{{ reset.date | date:"SHORT_DATETIME_FORMAT" }}</b></td>
  117. <td>{{ reset.reason | hashtag }}</td>
  118. <td>
  119. {% if not reset.selfSeum %}
  120. {{ reset.who.trigramme }}
  121. {% endif %}
  122. </td>
  123. <td>{{ reset.likes_count }}</td>
  124. </tr>
  125. {% endfor %}
  126. </tbody>
  127. </table>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="row">
  134. <div class="text-center">
  135. <a class="btn btn-success" href="{% url 'home' %}">{% trans "Back to counters list" %}</a>
  136. </div>
  137. </div>
  138. </div>
  139. {% endblock %}