changelog_diff.html 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {% extends "sora/layout.html" %}
  2. {% load i18n %}
  3. {% load url from future %}
  4. {% import "sora/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">/</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">/</span></li>
  9. {% endfor %}
  10. <li><a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider">/</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">/</span></li>
  12. <li class="active">{% trans date=change.date|reltimesince|low %}Edit from {{ date }}{% endtrans %}
  13. {%- endblock %}
  14. {% block content %}
  15. <div class="page-header">
  16. <ul class="breadcrumb">
  17. {{ self.breadcrumb() }}</li>
  18. </ul>
  19. <h1>{% trans post=post.pk %}Post #{{ post }} Changelog{% endtrans %} <small>{{ thread.name }}</small></h1>
  20. <ul class="unstyled thread-info">
  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 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>
  23. <li><i class="icon-pencil"></i> {% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</li>
  24. {% if post.protected %}<li><i class="icon-lock"></i> {% trans %}Protected{% endtrans %}</li>{% endif %}
  25. </ul>
  26. </div>
  27. {% if message %}{{ macros.draw_message(message, 'alert-form') }}{% endif %}
  28. <h2>{% trans date=change.date|reltimesince|low %}Edit from {{ date }}{% endtrans %} <small>#{{ change.pk }}</small></h2>
  29. <ul class="unstyled thread-info">
  30. <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>
  31. <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>
  32. {% if acl.users.can_see_users_trails() %}
  33. <li><i class="icon-globe"></i> {{ change.ip }}</li>
  34. <li><i class="icon-qrcode"></i> {{ change.agent }}</li>
  35. {% endif %}
  36. {% if change.change != 0 %}<li><i class="icon-{% if change.change > 0 %}plus{% elif change.change < 0 %}minus{% endif %}"></i> {% if change.change > 0 -%}
  37. {% trans chars=change.change %}Added one character{% pluralize %}Added {{ chars }} characters{% endtrans %}
  38. {%- elif change.change < 0 -%}
  39. {% trans chars=change.change|abs %}Removed one character{% pluralize %}Removed {{ chars }} characters{% endtrans %}
  40. {%- endif %}</li>{% endif %}
  41. </ul>
  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="list-nav">
  47. {{ pager() }}
  48. {% if user.is_authenticated() and acl.threads.can_make_revert(forum, thread) %}
  49. <form class="form-inline" action="{% url '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. <ul class="nav nav-pills pull-right">
  52. <li class="danger"><button type="submit" class="btn btn-danger">{% trans %}Revert this edit{% endtrans %}</button></li>
  53. </ul>
  54. </form>
  55. {%- endif %}
  56. </div>
  57. {% endif %}
  58. <div class="well diff">
  59. <table>
  60. {% for line in diff %}{% if line[0] != "?" %}
  61. <tr>
  62. <td class="line"><a href="#{{ l }}">{{ l }}.</a></td>
  63. <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>
  64. </tr>
  65. {% set l = l + 1 %}
  66. {% endif %}{% endfor %}
  67. </table>
  68. </div>
  69. {% if prev or next %}
  70. <div class="list-nav last">
  71. {{ pager() }}
  72. </div>
  73. {% endif %}
  74. {% endblock %}
  75. {% macro pager() %}
  76. <ul class="pager pull-left">
  77. {% 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 %}
  78. {% 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 %}
  79. </ul>
  80. {% endmacro %}