changelog.html 4.5 KB

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