You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
6.1 KiB

  1. {% extends "base.html" %}
  2. {% load compress humanize static hc_extras %}
  3. {% block title %}Zulip Integration for {{ site_name }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1>Zulip</h1>
  8. <p>
  9. <a href="https://zulipchat.com/">Zulip</a> is an open-source group chat app
  10. with an email threading model. If you use or plan on using Zulip,
  11. you can can integrate it
  12. with your {{ site_name }} account in few simple steps.
  13. </p>
  14. <h2>Setup Guide</h2>
  15. <div class="row ai-step">
  16. <div class="col-sm-6">
  17. <span class="step-no"></span>
  18. <p>
  19. Log into your Zulip account,
  20. click on the <strong>gear icon</strong> in the upper right corner,
  21. and select <strong>Settings</strong>.
  22. </p>
  23. </div>
  24. <div class="col-sm-6">
  25. <img
  26. class="ai-guide-screenshot"
  27. alt="Screenshot"
  28. src="{% static 'img/integrations/setup_zulip_1.png' %}">
  29. </div>
  30. </div>
  31. <div class="row ai-step">
  32. <div class="col-sm-6">
  33. <span class="step-no"></span>
  34. <p>
  35. Got to <strong>Your bots › Add a new bot </strong> and fill
  36. out the fields.
  37. </p>
  38. <p>
  39. For <strong>Bot Type</strong>,
  40. select "Incoming webhook". You can choose your own preferred values
  41. for bot's name and email.
  42. </p>
  43. <p>
  44. For the profile picture, feel free to use the {{ site_name }} logo:
  45. </p>
  46. <p>
  47. <img src="{% static 'img/logo.png'%}" alt="{{ site_name }} logo">
  48. </p>
  49. <p>
  50. After you have filled out the values,
  51. click on <strong>Create Bot</strong>.
  52. </p>
  53. </div>
  54. <div class="col-sm-6">
  55. <img
  56. class="ai-guide-screenshot"
  57. alt="Screenshot"
  58. src="{% static 'img/integrations/setup_zulip_2.png' %}">
  59. </div>
  60. </div>
  61. <div class="row ai-step">
  62. <div class="col-sm-6">
  63. <span class="step-no"></span>
  64. <p>
  65. Download the bot's <code>zuliprc</code> file by clicking on the
  66. <strong>cyan download icon</strong>, and upload it in the form below.
  67. Also specify the stream or the private user you want {{ site_name }}
  68. to post notifications to.
  69. </p>
  70. <p>
  71. Save the integration and you are done!
  72. </p>
  73. </div>
  74. <div class="col-sm-6">
  75. <img
  76. class="ai-guide-screenshot"
  77. alt="Screenshot"
  78. src="{% static 'img/integrations/setup_zulip_3.png' %}">
  79. </div>
  80. </div>
  81. <h2>Integration Settings</h2>
  82. <form method="post" class="form-horizontal">
  83. {% csrf_token %}
  84. <input type="hidden" name="api_key" id="zulip-api-key">
  85. <input type="hidden" name="bot_email" id="zulip-bot-email">
  86. <input type="hidden" name="site" id="zulip-site">
  87. <div class="form-group">
  88. <label for="zuliprc" class="col-sm-2 control-label">The zuliprc File</label>
  89. <div class="col-sm-4">
  90. <input id="zuliprc" type="file">
  91. <div id="zuliprc-help" class="help-block">
  92. {% if form.api_key.errors or form.bot_email.errors or form.site.errors %}
  93. Invalid file format.
  94. {% endif %}
  95. </div>
  96. </div>
  97. </div>
  98. <div id="z-mtype-group" class="form-group {{ form.mtype.css_classes }}">
  99. <label class="col-sm-2 control-label">Post To</label>
  100. <div class="col-sm-4">
  101. <label class="radio-container">
  102. <input
  103. type="radio"
  104. name="mtype"
  105. value="stream"
  106. {% if form.mtype.value != "private" %} checked {% endif %}>
  107. <span class="radiomark"></span>
  108. Stream
  109. </label>
  110. <label class="radio-container">
  111. <input
  112. type="radio"
  113. name="mtype"
  114. value="private"
  115. {% if form.mtype.value == "private" %} checked {% endif %}>
  116. <span class="radiomark"></span>
  117. Private user
  118. </label>
  119. </div>
  120. </div>
  121. <div class="form-group {{ form.to.css_classes }}">
  122. <label id="z-to-label" for="z-to" class="col-sm-2 control-label">
  123. {% if form.mtype.value == "private" %}
  124. User's Email
  125. {% else %}
  126. Stream Name
  127. {% endif %}
  128. </label>
  129. <div class="col-sm-4">
  130. <input
  131. id="z-to"
  132. type="text"
  133. class="form-control"
  134. name="to"
  135. value="{{ form.to.value|default:"" }}">
  136. <div id="z-to-help" class="help-block">
  137. {% if form.to.errors %}
  138. {{ form.to.errors|join:"" }}
  139. {% else %}
  140. Example: "{% if form.mtype.value == "private" %}[email protected]{% else %}general{% endif%}"
  141. {% endif %}
  142. </div>
  143. </div>
  144. </div>
  145. <div class="form-group">
  146. <div class="col-sm-offset-2 col-sm-10">
  147. <button
  148. id="save-integration"
  149. type="submit"
  150. disabled
  151. class="btn btn-primary">Save Integration</button>
  152. </div>
  153. </div>
  154. </form>
  155. </div>
  156. </div>
  157. {% endblock %}
  158. {% block scripts %}
  159. {% compress js %}
  160. <script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
  161. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  162. <script src="{% static 'js/add_zulip.js' %}"></script>
  163. {% endcompress %}
  164. {% endblock %}