changelog_diff.html 4.5 KB

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