posting.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. {% extends "sora/layout.html" %}
  2. {% load i18n %}
  3. {% load url from future %}
  4. {% import "_forms.html" as form_theme with context %}
  5. {% import "sora/editor.html" as editor with context %}
  6. {% import "sora/macros.html" as macros with context %}
  7. {% block title %}{% if thread -%}
  8. {{ macros.page_title(title=_(get_title()), parent=thread.name) }}
  9. {%- else -%}
  10. {{ macros.page_title(title=_(get_title()), parent=forum.name) }}
  11. {%- endif %}{% endblock %}
  12. {% block breadcrumb %}{{ super() }} <span class="divider">/</span></li>
  13. {% for parent in parents %}
  14. <li><a href="{{ parent.type|url(forum=forum.pk, slug=forum.slug) }}">{{ parent.name }}</a> <span class="divider">/</span></li>
  15. {% endfor %}
  16. {% if thread %}<li><a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider">/</span></li>{% endif %}
  17. <li class="active">{{ get_title() }}
  18. {%- endblock %}
  19. {% block content %}
  20. <div class="page-header">
  21. <ul class="breadcrumb">
  22. {{ self.breadcrumb() }}</li>
  23. </ul>
  24. <h1>{{ get_title() }} <small>{% if thread %}{{ thread.name }}{% else %}{{ forum.name }}{% endif %}</small></h1>
  25. {% if thread %}
  26. <ul class="unstyled thread-info">
  27. {% if thread.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
  28. <li><i class="icon-time"></i> {{ thread.last|reltimesince }}</li>
  29. <li><i class="icon-user"></i> {% if thread.start_poster_id %}<a href="{% url 'user' user=thread.start_poster_id, username=thread.start_poster_slug %}">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}</li>
  30. <li><i class="icon-comment"></i> {% if thread.replies > 0 -%}
  31. {% trans count=thread.replies, replies=thread.replies|intcomma %}One reply{% pluralize %}{{ replies }} replies{% endtrans %}
  32. {%- else -%}
  33. {% trans %}No replies{% endtrans %}
  34. {%- endif %}</li>
  35. </ul>
  36. {%- endif %}
  37. </div>
  38. {% if message %}{{ macros.draw_message(message, 'alert-form') }}{% endif %}
  39. <form action="{{ get_action() }}" method="post">
  40. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  41. {% if 'thread_name' in form.fields %}
  42. {{ form_theme.row_widget(form.fields.thread_name) }}
  43. {% endif %}
  44. {{ editor.editor(form.fields.post, get_button(), rows=8) }}
  45. </form>
  46. <div class="well well-small" id="md-border" style="display: none;">
  47. <div class="markdown" id="md-preview"></div>
  48. </div>
  49. {% endblock %}
  50. {% macro get_action() -%}
  51. {% if mode == 'new_thread' -%}
  52. {% url 'thread_new' forum=forum.pk, slug=forum.slug %}
  53. {%- elif mode == 'edit_thread' -%}
  54. NADA!
  55. {%- elif mode in ['new_post', 'new_post_quick'] -%}
  56. {%- if quote -%}
  57. {% url 'thread_reply' thread=thread.pk, slug=thread.slug, quote=quote.pk %}
  58. {%- else -%}
  59. {% url 'thread_reply' thread=thread.pk, slug=thread.slug %}
  60. {%- endif -%}
  61. {%- elif mode == 'edit_post' -%}
  62. NADA!
  63. {%- endif %}
  64. {%- endmacro %}
  65. {% macro get_title() -%}
  66. {% if mode == 'new_thread' -%}
  67. {% trans %}Post New Thread{% endtrans %}
  68. {%- elif mode == 'edit_thread' -%}
  69. {% trans %}Edit Thread{% endtrans %}
  70. {%- elif mode in ['new_post', 'new_post_quick'] -%}
  71. {% trans %}Post New Reply{% endtrans %}
  72. {%- elif mode == 'edit_post' -%}
  73. {% trans %}Edit Reply{% endtrans %}
  74. {%- endif %}
  75. {%- endmacro %}
  76. {% macro get_button() -%}
  77. {% if mode == 'new_thread' -%}
  78. {% trans %}Post Thread{% endtrans %}
  79. {%- elif mode == 'edit_thread' -%}
  80. {% trans %}Edit Thread{% endtrans %}
  81. {%- elif mode in ['new_post', 'new_post_quick'] -%}
  82. {% trans %}Post Reply{% endtrans %}
  83. {%- elif mode == 'edit_post' -%}
  84. {% trans %}Edit Reply{% endtrans %}
  85. {%- endif %}
  86. {%- endmacro %}