changelog.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(title=(_("Post #%(post)s Changelog") % {'post': post.pk}),parent=thread.name) }}{% endblock %}
  4. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  5. <li><a href="{% url 'private_threads' %}">{% trans %}Private Threads{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  6. <li><a href="{% url 'private_thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li class="active">{% trans post=post.pk %}Post #{{ post }} Changelog{% endtrans %}
  8. {%- endblock %}
  9. {% block container %}
  10. <div class="page-header header-primary">
  11. <div class="container">
  12. {{ messages_list(messages) }}
  13. <ul class="breadcrumb">
  14. {{ self.breadcrumb() }}</li>
  15. </ul>
  16. <h1>{% trans post=post.pk %}Post #{{ post }} Changelog{% endtrans %} <small>{{ thread.name }}</small></h1>
  17. <ul class="unstyled header-stats">
  18. <li><i class="icon-time"></i> <a href="{% url 'private_thread_find' thread=thread.pk, slug=thread.slug, post=post.pk %}">{{ post.date|reltimesince }}</a></li>
  19. <li><i class="icon-user"></i> {% if post.user %}<a href="{% url 'user' user=post.user.pk, username=post.user.username_slug %}">{{ post.user.username }}</a>{% else %}{{ post.user_name }}{% endif %}</li>
  20. <li><i class="icon-pencil"></i> {% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</li>
  21. {% if post.protected %}<li><i class="icon-lock"></i> {% trans %}Protected{% endtrans %}</li>{% endif %}
  22. </ul>
  23. </div>
  24. </div>
  25. <div class="container container-primary">
  26. <div class="post-changelog">
  27. {% if edits %}
  28. <table class="table table-striped">
  29. <thead>
  30. <tr>
  31. <th style="width: 1%;">&nbsp;</th>
  32. <th>{% trans %}Change Log{% endtrans %}</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. {% for edit in edits %}
  37. <tr>
  38. <td>
  39. <span class="change-{% if edit.change > 0 %}added{% elif edit.change < 0 %}removed{% else %}none{% endif %}{% if not edit.reason %} change-small{% endif %}">
  40. {% if edit.change > 0 %}+{% endif %}{{ edit.change }}
  41. </span>
  42. </td>
  43. <td>
  44. <a href="{% url 'private_thread_changelog_diff' thread=thread.pk, slug=thread.slug, post=post.pk, change=edit.pk %}" class="change-no">#{{ loop.revindex }}</a>
  45. {% if edit.reason %}
  46. <div class="change-reason">
  47. <a href="{% url 'private_thread_changelog_diff' thread=thread.pk, slug=thread.slug, post=post.pk, change=edit.pk %}">{{ edit.reason }}</a>
  48. </div>{% endif %}
  49. <div class="change-description">
  50. <a href="{% url 'private_thread_changelog_diff' thread=thread.pk, slug=thread.slug, post=post.pk, change=edit.pk %}">
  51. {% if edit.change != 0 %}{% if edit.change > 0 -%}
  52. {% trans chars=edit.change %}Added one character to post.{% pluralize %}Added {{ chars }} characters to post.{% endtrans %}
  53. {%- elif edit.change < 0 -%}
  54. {% trans chars=edit.change|abs %}Removed one character from post.{% pluralize %}Removed {{ chars }} characters from post.{% endtrans %}
  55. {%- else -%}
  56. {% trans %}No change in message's length.{% endtrans %}
  57. {%- endif %}{% endif %}{% if edit.thread_name_old %} {% trans old=edit.thread_name_old, new=edit.thread_name_new %}Changed thread name from "{{ old }}" to "{{ new }}".{% endtrans %}{% endif %}{% if edit.thread_name_old %} {% trans old=edit.thread_name_old, new=edit.thread_name_new %}Renamed thread from "{{ old }}" to "{{ new }}".{% endtrans %}{% endif %}</a>
  58. <span class="change-details">
  59. {% trans user=edit_user(edit), date=edit.date|reldate|low %}By {{ user }} {{ date }}{% endtrans %}
  60. </span>
  61. </div>
  62. </td>
  63. </tr>
  64. {% endfor %}
  65. </tbody>
  66. </table>
  67. {% else %}
  68. <p class="lead">{% trans %}This post was never edited.{% endtrans %}</p>
  69. {% endif %}
  70. </div>
  71. </div>
  72. {% endblock %}
  73. {% macro edit_user(edit) -%}
  74. {% if edit.user_id %}<a href="{% url 'user' user=edit.user_id, username=edit.user_slug %}">{{ edit.user_name }}</a>{% else %}{{ edit.user_name }}{% endif %}
  75. {%- endmacro %}