changelog_diff.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. {% for parent in parents %}
  6. <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>
  7. {% endfor %}
  8. <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>
  9. <li><a href="{% url 'thread_changelog' thread=thread.pk, slug=thread.slug, post=post.pk %}">{% trans post=post.pk %}Post #{{ post }} Changelog{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  10. <li class="active">{% trans date=change.date|reltimesince|low %}Edit from {{ date }}{% endtrans %}
  11. {%- endblock %}
  12. {% block container %}
  13. <div class="page-header header-primary">
  14. <div class="container">
  15. {{ messages_list(messages) }}
  16. <ul class="breadcrumb">
  17. {{ self.breadcrumb() }}</li>
  18. </ul>
  19. <h1>{% trans date=change.date|reltimesince|low %}Edit from {{ date }}{% endtrans %} <small>{% trans post=post.pk %}Post #{{ post }} Changelog{% endtrans %}</small></h1>
  20. <ul class="unstyled header-stats pull-left">
  21. <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>
  22. <li><i class="icon-user"></i> {% if change.user_id %}<a href="{% url 'user' user=change.user_id, username=change.user_slug %}">{{ change.user_name }}</a>{% else %}{{ change.user_name }}{% endif %}</li>
  23. {% if acl.users.can_see_users_trails() %}
  24. <li><i class="icon-globe"></i> {{ change.ip }}</li>
  25. <li><i class="icon-qrcode"></i> {{ change.agent }}</li>
  26. {% endif %}
  27. {% if change.change != 0 %}<li><i class="icon-{% if change.change > 0 %}plus{% elif change.change < 0 %}minus{% endif %}"></i> {% if change.change > 0 -%}
  28. {% trans chars=change.change %}Added one character{% pluralize %}Added {{ chars }} characters{% endtrans %}
  29. {%- elif change.change < 0 -%}
  30. {% trans chars=change.change|abs %}Removed one character{% pluralize %}Removed {{ chars }} characters{% endtrans %}
  31. {%- endif %}</li>{% endif %}
  32. </ul>
  33. </div>
  34. </div>
  35. <div class="container container-primary">
  36. <div class="post-diff">
  37. {% if message %}
  38. <div class="messages-list">
  39. {{ macros.draw_message(message) }}
  40. </div>
  41. {% endif %}
  42. {% if change.reason %}
  43. <p class="lead">{{ change.reason }}</p>
  44. {% endif %}
  45. {% if acl.threads.can_edit_reply(user, forum, thread, post) or prev or next %}
  46. <div class="diff-extra">
  47. {{ pager() }}
  48. {% if user.is_authenticated() and acl.threads.can_make_revert(forum, thread) %}
  49. <form class="form-inline pull-right" action="{% url 'thread_changelog_revert' thread=thread.pk, slug=thread.slug, post=post.pk, change=change.pk %}" method="post">
  50. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  51. <button type="submit" class="btn btn-danger">{% trans %}Revert this edit{% endtrans %}</button></li>
  52. </form>
  53. {%- endif %}
  54. </div>
  55. {% endif %}
  56. <div class="post-diff-details">
  57. <table>
  58. <tbody>
  59. {% for line in diff %}{% if line[0] != "?" %}
  60. <tr>
  61. <td class="line"><a href="#{{ l }}">{{ l }}.</a></td>
  62. <td class="{% if line[0] == '+' %}added{% elif line[0] == '-' %}removed{% else %}stag{% endif %}{% if l is even %} even{% endif %}">{% if line[2:] %}{{ line[2:] }}{% else %}&nbsp;{% endif %}</td>
  63. </tr>
  64. {% set l = l + 1 %}
  65. {% endif %}{% endfor %}
  66. </tbody>
  67. </table>
  68. </div>
  69. {% if prev or next %}
  70. <div class="diff-extra">
  71. {{ pager() }}
  72. </div>
  73. {% endif %}
  74. </div>
  75. </div>
  76. {% endblock %}
  77. {% macro pager() %}
  78. {% if prev or prev %}
  79. <div class="pagination pull-left">
  80. <ul>
  81. {% if prev %}<li><a href="{% url 'thread_changelog_diff' thread=thread.pk, slug=thread.slug, post=post.pk, change=prev.pk %}"><i class="icon-chevron-left"></i> {{ prev.date|reldate }}</a></li>{% endif %}
  82. {% if next %}<li><a href="{% url 'thread_changelog_diff' thread=thread.pk, slug=thread.slug, post=post.pk, change=next.pk %}">{{ next.date|reldate }} <i class="icon-chevron-right"></i></a></li>{% endif %}
  83. </ul>
  84. </div>
  85. {% endif %}
  86. {% endmacro %}