changelog_diff.html 4.6 KB

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