edit.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. {% extends "misago/admin/generic/form.html" %}
  2. {% load i18n misago_admin_form misago_avatars %}
  3. {% block title %}
  4. {{ target }} | {{ active_link.name }} | {{ block.super }}
  5. {% endblock title %}
  6. {% block page-header %}
  7. {{ block.super }}
  8. <small>
  9. {{ target }}
  10. </small>
  11. {% endblock page-header %}
  12. {% block form-header %}
  13. {% trans "Edit user" %}
  14. {% endblock form-header %}
  15. {% block form-body %}
  16. <div class="media py-1">
  17. <a href="{{ target.get_absolute_url }}" class="mr-3">
  18. <img src="{{ target|avatar:56 }}" class="rounded" alt="{% trans 'Avatar' %}" width="56" height="56">
  19. </a>
  20. <div class="media-body">
  21. <h5 class="mt-0">
  22. {{ target }}
  23. {% if target.is_superuser %}
  24. <span class="badge badge-danger" data-tooltip="top" title="{% trans 'Can use admin control panel and manage other administrators' %}">
  25. {% trans "Super Admin" %}
  26. </span>
  27. {% elif target.is_staff %}
  28. <span class="badge badge-danger" data-tooltip="top" title="{% trans 'Can use admin control panel' %}">
  29. {% trans "Admin" %}
  30. </span>
  31. {% endif %}
  32. {% if target.requires_activation_by_admin %}
  33. <span class="badge badge-primary" data-tooltip="top" title="{% trans 'Requires activation by administrator' %}">
  34. {% trans "Inactive" %}
  35. </span>
  36. {% elif target.requires_activation_by_user %}
  37. <span class="badge badge-primary" data-tooltip="top" title="{% trans 'Has to activate their account' %}">
  38. {% trans "Inactive" %}
  39. </span>
  40. {% endif %}
  41. {% if target.is_deleting_account %}
  42. <span class="badge badge-warning" data-tooltip="top" title="{% trans 'Account scheduled for deletion' %}">
  43. {% trans "Deleted" %}
  44. </span>
  45. {% elif not target.is_active %}
  46. <span class="badge badge-dark" data-tooltip="top" title="{% trans 'Account disabled' %}">
  47. {% trans "Disabled" %}
  48. </span>
  49. {% endif %}
  50. </h5>
  51. <ul class="list-inline">
  52. <li class="list-inline-item">
  53. <a href="mailto:{{ target.email }}">
  54. {{ target.email }}
  55. </a>
  56. </li>
  57. <li class="list-inline-item">
  58. <span class="">
  59. {{ target.rank }}
  60. </li>
  61. <li class="list-inline-item">
  62. <span data-timestamp="{{ target.joined_on.isoformat }}" data-format="LL">
  63. {{ target.joined_on }}
  64. </span>
  65. </li>
  66. {% if item.joined_from_ip %}
  67. <li class="list-inline-item">
  68. {{ item.joined_from_ip }}
  69. </li>
  70. {% endif %}
  71. <li class="list-inline-item">
  72. {% blocktrans trimmed count posts=target.posts %}
  73. {{ posts }} post
  74. {% plural %}
  75. {{ posts }} posts
  76. {% endblocktrans %}
  77. </li>
  78. <li class="list-inline-item">
  79. {% blocktrans trimmed count threads=target.threads %}
  80. {{ threads }} thread
  81. {% plural %}
  82. {{ threads }} threads
  83. {% endblocktrans %}
  84. </li>
  85. </ul>
  86. </div>
  87. </div>
  88. <div class="fieldset-border">
  89. <fieldset>
  90. <legend>{% trans "Basic account settings" %}</legend>
  91. {% form_row form.username %}
  92. {% if 'rank' in form.fields %}
  93. {% form_row form.rank %}
  94. {% endif %}
  95. {% form_row form.title %}
  96. {% form_row form.roles %}
  97. {% if 'staff_level' in form.fields %}
  98. {% form_row form.staff_level %}
  99. {% endif %}
  100. </fieldset>
  101. </div>
  102. <div class="fieldset-border">
  103. <fieldset>
  104. <legend>{% trans "Administrator status" %}</legend>
  105. {% if 'is_staff' in form.fields %}
  106. {% form_row form.is_staff %}
  107. {% form_row form.is_superuser %}
  108. {% else %}
  109. <div id="div_id_is_staff" class="form-group">
  110. <label for="id_is_staff_0" class="control-label {{ label_class }}">
  111. {{ form.IS_STAFF_LABEL }}:
  112. </label>
  113. <div class="{{ field_class }}">
  114. <p class="form-control-static">
  115. {% if target.is_staff %}
  116. <strong class="text-primary">{% trans "Yes" %}</strong>
  117. {% else %}
  118. <strong class="text-muted">{% trans "No" %}</strong>
  119. {% endif %}
  120. </p>
  121. <small class="form-text text-muted" id="hint_id_is_staff">
  122. {{ form.IS_STAFF_HELP_TEXT }}
  123. </small>
  124. </div>
  125. </div>
  126. <div id="div_id_is_superuser" class="form-group">
  127. <label for="id_is_superuser_0" class="control-label {{ label_class }}">
  128. {{ form.IS_SUPERUSER_LABEL }}:
  129. </label>
  130. <div class="{{ field_class }}">
  131. <p class="form-control-static">
  132. {% if target.is_superuser %}
  133. <strong class="text-primary">{% trans "Yes" %}</strong>
  134. {% else %}
  135. <strong class="text-muted">{% trans "No" %}</strong>
  136. {% endif %}
  137. </p>
  138. <small class="form-text text-muted" id="hint_id_is_superuser">
  139. {{ form.IS_SUPERUSER_HELP_TEXT }}
  140. </small>
  141. </div>
  142. </div>
  143. <p class="text-center">
  144. <strong>{% trans "Note" %}:</strong>
  145. {% trans "Only superusers can change other users administrator status." %}
  146. </p>
  147. {% endif %}
  148. </fieldset>
  149. </div>
  150. <div class="fieldset-border">
  151. <fieldset>
  152. <legend>{% trans "Sign-in credentials" %}</legend>
  153. {% form_row form.email %}
  154. {% form_row form.new_password %}
  155. {% if not target.has_usable_password %}
  156. <div id="div_id_has_usable_password" class="form-group">
  157. <div class="{{ field_class }} col-md-offset-3">
  158. <p class="form-control-static">
  159. {% trans "This user has not set account password and uses other service to authenticate." %}
  160. </p>
  161. </div>
  162. </div>
  163. {% endif %}
  164. </fieldset>
  165. </div>
  166. <div class="fieldset-border">
  167. <fieldset>
  168. <legend>{% trans "Avatar" %}</legend>
  169. {% form_row form.is_avatar_locked %}
  170. {% form_row form.avatar_lock_user_message %}
  171. {% form_row form.avatar_lock_staff_message %}
  172. </fieldset>
  173. </div>
  174. <div class="fieldset-border">
  175. <fieldset>
  176. <legend>{% trans "Signature" %}</legend>
  177. {% form_row form.signature %}
  178. {% form_row form.is_signature_locked %}
  179. {% form_row form.signature_lock_user_message %}
  180. {% form_row form.signature_lock_staff_message %}
  181. </fieldset>
  182. </div>
  183. {% for group in form.get_profile_fields_groups %}
  184. <div class="fieldset-border">
  185. <fieldset>
  186. <legend>{% trans group.name %}</legend>
  187. {% for field in group.fields %}
  188. {% form_row field %}
  189. {% endfor %}
  190. </fieldset>
  191. </div>
  192. {% endfor %}
  193. <div class="fieldset-border">
  194. <fieldset>
  195. <legend>{% trans "Forum options" %}</legend>
  196. {% form_row form.is_hiding_presence %}
  197. {% form_row form.limits_private_thread_invites_to %}
  198. </fieldset>
  199. </div>
  200. <div class="fieldset-border">
  201. <fieldset>
  202. <legend>{% trans "Automatic subscription preferences" %}</legend>
  203. {% form_row form.subscribe_to_started_threads %}
  204. {% form_row form.subscribe_to_replied_threads %}
  205. </fieldset>
  206. </div>
  207. <div class="fieldset-border">
  208. <fieldset>
  209. <legend>{% trans "Account status" %}</legend>
  210. {% if target.is_deleting_account %}
  211. <div id="div_id_is_deleting_account" class="form-group">
  212. <label for="id_is_ais_deleting_account_0" class="control-label {{ label_class }}">
  213. {{ form.IS_ACTIVE_LABEL }}:
  214. </label>
  215. <div class="{{ field_class }}">
  216. <p class="form-control-static">
  217. <strong class="text-danger">
  218. {% trans "This user is deleting their account. It has been deactivated for the duration of the process." %}
  219. </strong>
  220. </p>
  221. <small class="form-text text-muted" id="div_id_is_deleting_account">
  222. {% trans "No additional action is required. This account will be deleted automatically." %}
  223. </small>
  224. </div>
  225. </div>
  226. {% else %}
  227. {% if 'is_active' in form.fields %}
  228. {% form_row form.is_active %}
  229. {% form_row form.is_active_staff_message %}
  230. {% else %}
  231. <div id="div_id_is_active" class="form-group">
  232. <label for="id_is_active_0" class="control-label {{ label_class }}">
  233. {{ form.IS_ACTIVE_LABEL }}:
  234. </label>
  235. <div class="{{ field_class }}">
  236. <p class="form-control-static">
  237. {% if target.is_active %}
  238. <strong class="text-success">{% trans "Yes" %}</strong>
  239. {% else %}
  240. <strong class="text-danger">{% trans "No" %}</strong>
  241. {% endif %}
  242. </p>
  243. <small class="form-text text-muted" id="hint_id_is_active">
  244. {{ form.IS_ACTIVE_HELP_TEXT }}
  245. </small>
  246. </div>
  247. </div>
  248. <div id="div_id_is_superuser" class="form-group">
  249. <label for="id_is_superuser_0" class="control-label {{ label_class }}">
  250. {{ form.IS_ACTIVE_STAFF_MESSAGE_LABEL }}:
  251. </label>
  252. <div class="{{ field_class }}">
  253. <div class="form-control-static">
  254. {% if target.is_active_staff_message %}
  255. {{ target.is_active_staff_message|force_escape|urlize|linebreaks }}
  256. {% else %}
  257. <em>{% trans "No staff message is available." %}</em>
  258. {% endif %}
  259. </div>
  260. <small class="form-text text-muted" id="hint_id_is_superuser">
  261. {{ form.IS_ACTIVE_STAFF_MESSAGE_HELP_TEXT }}
  262. </small>
  263. </div>
  264. </div>
  265. {% endif %}
  266. {% endif %}
  267. </fieldset>
  268. </div>
  269. <div class="fieldset-border">
  270. <fieldset>
  271. <legend>{% trans "Agreements" %}</legend>
  272. <div class="card card-admin-table">
  273. <table class="table">
  274. <thead>
  275. <tr>
  276. <th>{% trans "Agreement" %}</th>
  277. <th style="width: 250px;">{% trans "Type" %}</th>
  278. <th style="width: 250px;">{% trans "Accepted on" %}</th>
  279. </tr>
  280. </thead>
  281. <tbody>
  282. {% for agreement in target.useragreement_set.select_related.iterator %}
  283. <tr>
  284. <td class="small">
  285. <a href="{% url 'misago:admin:users:agreements:edit' pk=agreement.agreement_id %}" class="item-name">
  286. {{ agreement.agreement.get_final_title }}
  287. </a>
  288. </td>
  289. <td class="small">
  290. {{ agreement.agreement.get_type_display }}
  291. </td>
  292. <td class="small">
  293. <abbr data-timestamp="{{ agreement.accepted_on.isoformat }}" data-format="LL">
  294. {{ agreement.accepted_on }}
  295. </abbr>
  296. </td>
  297. </tr>
  298. {% empty %}
  299. <tr>
  300. <td colspan="3">
  301. {% trans "This user didn't accept any agreements." %}
  302. </td>
  303. </tr>
  304. {% endfor %}
  305. </tbody>
  306. </table>
  307. </div>
  308. </fieldset>
  309. </div>
  310. {% endblock form-body %}