changelog_diff.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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=forum.pk, slug=forum.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 change.change != 0 %}<li><i class="icon-{% if change.change > 0 %}plus{% elif change.change < 0 %}minus{% endif %}"></i> {% if change.change > 0 -%}
  33. {% trans chars=change.change %}Added one character{% pluralize %}Added {{ chars }} characters{% endtrans %}
  34. {%- elif change.change < 0 -%}
  35. {% trans chars=change.change|abs %}Removed one character{% pluralize %}Removed {{ chars }} characters{% endtrans %}
  36. {%- endif %}</li>{% endif %}
  37. </ul>
  38. {% if change.reason %}
  39. <p class="lead">{{ change.reason }}</p>
  40. {% endif %}
  41. {% if acl.threads.can_edit_reply(user, forum, thread, post) or prev or next %}
  42. <div class="list-nav">
  43. {{ pager() }}
  44. {% if user.is_authenticated() and acl.threads.can_edit_reply(user, forum, thread, post) %}
  45. <form class="form-inline" action="{% url 'changelog_revert' thread=thread.pk, slug=thread.slug, post=post.pk, change=change.pk %}" method="post">
  46. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  47. <ul class="nav nav-pills pull-right">
  48. <li class="danger"><button type="submit" class="btn btn-danger">{% trans %}Revert this edit{% endtrans %}</button></li>
  49. </ul>
  50. </form>
  51. {%- endif %}
  52. </div>
  53. {% endif %}
  54. <div class="well diff">
  55. <table>
  56. {% for line in diff %}{% if line[0] != "?" %}
  57. <tr>
  58. <td class="line"><a href="#{{ l }}">{{ l }}.</a></td>
  59. <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>
  60. </tr>
  61. {% set l = l + 1 %}
  62. {% endif %}{% endfor %}
  63. </table>
  64. </div>
  65. {% if prev or next %}
  66. <div class="list-nav last">
  67. {{ pager() }}
  68. </div>
  69. {% endif %}
  70. {% endblock %}
  71. {% macro pager() %}
  72. <ul class="pager pull-left">
  73. {% 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 %}
  74. {% 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 %}
  75. </ul>
  76. {% endmacro %}