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.

223 lines
8.3 KiB

9 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress static hc_extras %}
  3. {% block title %}Account Settings - {{ site_name }}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1 class="settings-title">
  8. Settings
  9. <small>{{ request.user.email }}</small>
  10. </h1>
  11. </div>
  12. {% if messages %}
  13. <div class="col-sm-12">
  14. {% for message in messages %}
  15. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  16. {% endfor %}
  17. </div>
  18. {% endif %}
  19. </div>
  20. <div class="row">
  21. <div class="col-sm-3">
  22. <ul class="nav nav-pills nav-stacked">
  23. <li class="active"><a href="{% url 'hc-profile' %}">Account</a></li>
  24. {% if show_pricing %}
  25. <li><a href="{% url 'hc-billing' %}">Billing</a></li>
  26. {% endif %}
  27. <li><a href="{% url 'hc-notifications' %}">Email Reports</a></li>
  28. </ul>
  29. </div>
  30. <div class="col-sm-9 col-md-6">
  31. <div class="panel panel-default">
  32. <div class="panel-body settings-block">
  33. <form method="post">
  34. {% csrf_token %}
  35. <h2>Email and Password</h2>
  36. <p>
  37. Your account's email address is
  38. <code>{{ request.user.email }}</code>
  39. <button
  40. type="submit"
  41. name="change_email"
  42. class="btn btn-default pull-right">Change Email</button>
  43. </p>
  44. <p class="clearfix"></p>
  45. <p>
  46. Attach a password to your {{ site_name }} account
  47. <button
  48. type="submit"
  49. name="set_password"
  50. class="btn btn-default pull-right">Set Password</button>
  51. </p>
  52. </form>
  53. </div>
  54. </div>
  55. <div class="panel panel-{{ my_projects_status }}">
  56. <div class="panel-body settings-block">
  57. {% csrf_token %}
  58. <h2>My Projects</h2>
  59. {% if profile.projects.exists %}
  60. <table id="my-projects" class="table">
  61. <tr>
  62. <th>Project</th>
  63. <th>My role</th>
  64. <th></th>
  65. </tr>
  66. {% for project in request.user.project_set.all %}
  67. <tr>
  68. <td>
  69. <div class="name">
  70. <a href="{% url 'hc-checks' project.code %}">
  71. {{ project }}
  72. </a>
  73. </div>
  74. </td>
  75. <td>Owner</td>
  76. <td>
  77. <a
  78. href="{% url 'hc-project-settings' project.code %}"
  79. class="pull-right">Settings</a>
  80. </td>
  81. </tr>
  82. {% endfor %}
  83. {% for m in request.user.memberships.all %}
  84. <tr>
  85. <td>
  86. <div class="name">
  87. <a href="{% url 'hc-checks' m.project.code %}">
  88. {{ m.project }}
  89. </a>
  90. </div>
  91. </td>
  92. <td>
  93. {% if m.rw %}
  94. Member
  95. {% else %}
  96. Read-only
  97. {% endif %}
  98. </td>
  99. <td>
  100. <a
  101. href="#"
  102. data-name="{{ m.project }}"
  103. data-code="{{ m.project.code }}"
  104. class="pull-right leave-project">Leave</a>
  105. </td>
  106. </tr>
  107. {% endfor %}
  108. </table>
  109. {% else %}
  110. <p>You do not have any projects. Create one!</p>
  111. {% endif %}
  112. <a
  113. id="create-project"
  114. href="#"
  115. class="btn btn-default pull-right"
  116. data-toggle="modal"
  117. data-target="#add-project-modal">Create a New Project</a>
  118. </div>
  119. {% if left_project %}
  120. <div class="panel-footer">
  121. Left project <strong>{{ left_project }}</strong>.
  122. </div>
  123. {% endif %}
  124. </div>
  125. <div class="panel panel-default">
  126. <div class="panel-body settings-block">
  127. {% csrf_token %}
  128. <h2>Close Account</h2>
  129. <a
  130. id="close-account"
  131. href="#"
  132. class="btn btn-default pull-right"
  133. data-toggle="modal"
  134. data-target="#close-account-modal">Close Account</a>
  135. This will permanently remove your {{ site_name }} account
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <div id="close-account-modal" class="modal">
  141. <div class="modal-dialog">
  142. <form method="post" action="{% url 'hc-close' %}">
  143. {% csrf_token %}
  144. <div class="modal-content">
  145. <div class="modal-header">
  146. <button type="button" class="close" data-dismiss="modal">&times;</button>
  147. <h4>Close Account?</h4>
  148. </div>
  149. <div class="modal-body">
  150. <p></p>
  151. <p>You are about to permanently remove
  152. the account <strong>{{ request.user.email }}</strong> and all
  153. of its associated projects, checks and integrations. Are you sure?
  154. </p>
  155. </div>
  156. <div class="modal-footer">
  157. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  158. <button
  159. type="submit"
  160. class="btn btn-danger">Close Account</button>
  161. </div>
  162. </div>
  163. </form>
  164. </div>
  165. </div>
  166. <div id="leave-project-modal" class="modal">
  167. <div class="modal-dialog">
  168. <form id="leave-project-form" method="post">
  169. {% csrf_token %}
  170. <div class="modal-content">
  171. <div class="modal-header">
  172. <button type="button" class="close" data-dismiss="modal">&times;</button>
  173. <h4>Leave This Project?</h4>
  174. </div>
  175. <div class="modal-body">
  176. <p>
  177. You are about to leave the project <strong id="leave-project-name"></strong>.
  178. You will lose access to its checks and integrations.
  179. </p>
  180. <p>Are you sure?</p>
  181. <input
  182. type="hidden"
  183. name="code"
  184. id="leave-project-code" />
  185. </div>
  186. <div class="modal-footer">
  187. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  188. <button
  189. type="submit"
  190. name="leave_project"
  191. class="btn btn-danger">Leave Project</button>
  192. </div>
  193. </div>
  194. </form>
  195. </div>
  196. </div>
  197. {% include "accounts/add_project_modal.html" %}
  198. {% endblock %}
  199. {% block scripts %}
  200. {% compress js %}
  201. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  202. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  203. <script src="{% static 'js/add_project_modal.js' %}"></script>
  204. <script src="{% static 'js/profile.js' %}"></script>
  205. {% endcompress %}
  206. {% endblock %}