settings.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <!-- Template taken from https://www.bootdey.com/snippets/view/profile-with-data-and-skills#html -->
  4. <div class="container-fluid text-black">
  5. <div class="main-body" style="padding: 15px">
  6. <div class="row g-5">
  7. <div class="col-md-4 mb-3">
  8. <div class="card bg-dark text-white">
  9. <div class="card-body">
  10. <!--
  11. <div class="d-flex flex-column align-items-center text-center">
  12. <img src="https://robohash.org/{{ user.username }}.png?set=set3" alt="{{ user.username }}" class="border border-5 border-primary rounded-circle" width="150">
  13. <div class="mt-3">
  14. <h4>{{ user.get_full_name }}</h4>
  15. <p class="text-white-50 mb-1">Full Stack Developer</p>
  16. <p class="text-white-50 font-size-sm">Bay Area, San Francisco, CA</p>
  17. <button class="btn btn-primary"><i class="fas fa-pencil-alt"></i></button>
  18. </div>
  19. </div>
  20. -->
  21. <div class="row">
  22. <div class="col-sm-3">
  23. <h6 class="mb-0">Pick a picture:</h6>
  24. </div>
  25. <div class="col-sm-9 text-white-50">
  26. <img src="https://robohash.org/{{ user.username }}.png?set=set1" alt="{{ user.username }}" class="border border-3 {% if user.profile.robohash_set == 1 %}border-primary{% endif %} rounded-circle" width="65">
  27. <input class="form-check-input visually-hidden" type="radio" name="profilePicRadio" id="flexRadioDefault1">
  28. <img src="https://robohash.org/{{ user.username }}.png?set=set2" alt="{{ user.username }}" class="border border-3 {% if user.profile.robohash_set == 2 %}border-primary{% endif %} rounded-circle" width="65">
  29. <input class="form-check-input visually-hidden" type="radio" name="profilePicRadio" id="flexRadioDefault2">
  30. <img src="https://robohash.org/{{ user.username }}.png?set=set3" alt="{{ user.username }}" class="border border-3 {% if user.profile.robohash_set == 3 %}border-primary{% endif %} rounded-circle" width="65">
  31. <input class="form-check-input visually-hidden" type="radio" name="profilePicRadio" id="flexRadioDefault3">
  32. <img src="https://robohash.org/{{ user.username }}.png?set=set4" alt="{{ user.username }}" class="border border-3 {% if user.profile.robohash_set == 4 %}border-primary{% endif %} rounded-circle" width="65">
  33. <input class="form-check-input visually-hidden" type="radio" name="profilePicRadio" id="flexRadioDefault4">
  34. </div>
  35. </div>
  36. <hr>
  37. <div class="row">
  38. <div class="col-sm-3">
  39. <h6 class="mb-0">Summary</h6>
  40. </div>
  41. <div class="col-sm-9 text-white-50">
  42. <textarea class="form-control form-text" id="summary">{{ user.profile.user_summary }}</textarea>
  43. </div>
  44. </div>
  45. <hr>
  46. <div class="row">
  47. <div class="col-sm-3">
  48. <h6 class="mb-0">Location</h6>
  49. </div>
  50. <div class="col-sm-9 text-white-50">
  51. <input type="text" class="form-control" id="location" value="{{ user.profile.user_location }}">
  52. </div>
  53. </div>
  54. <hr>
  55. <a href="#navbar" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Update</a>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="col-md-8">
  60. <div id="settings-status-div" class="text-dark">
  61. </div>
  62. <div class="card bg-dark text-white mb-3">
  63. <div class="card-body">
  64. <div id="settings-form">
  65. <div class="row">
  66. <div class="col-sm-3">
  67. <h6 class="mb-0">Username</h6>
  68. </div>
  69. <div class="col-sm-9 text-white-50">
  70. <input type="text" class="form-control" name="username" id="username" value="{{ user.username }}">
  71. </div>
  72. </div>
  73. <hr>
  74. <div class="row">
  75. <div class="col-sm-3">
  76. <h6 class="mb-0">Full Name</h6>
  77. </div>
  78. <div class="col-sm-9 text-white-50">
  79. <input type="text" class="form-control" id="fullname" value="{{ user.get_full_name }}" disabled>
  80. </div>
  81. </div>
  82. <hr>
  83. <div class="row">
  84. <div class="col-sm-3">
  85. <h6 class="mb-0">Email</h6>
  86. </div>
  87. <div class="col-sm-9 text-white-50">
  88. <input type="email" class="form-control" id="email" aria-describedby="emailHelp" value="{{ user.email }}" disabled>
  89. <div id="emailHelp" class="form-text">This is the google account you logged in with.</div>
  90. </div>
  91. </div>
  92. <hr>
  93. <div class="row">
  94. <div class="col-sm-3">
  95. <h6 class="mb-0">Global Preferences</h6>
  96. </div>
  97. <div class="col-sm-9 text-white">
  98. <div class="mb-3 form-check form-switch">
  99. <input class="form-check-input" name="open search in new tab" type="checkbox" id="openSearchCheckDefault" {% if user.profile.open_search_new_tab %} checked {% endif %}>
  100. <label class="form-check-label" for="openSearchCheckDefault">Open Search in new tab</label>
  101. </div>
  102. <div class="mb-3 form-check form-switch">
  103. <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
  104. <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit (this can abruptly refresh the page)</label>
  105. </div>
  106. <div class="mb-3 form-check form-switch">
  107. <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" {% if profile.hide_unavailable_videos %}checked{% endif %}>
  108. <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
  109. </div>
  110. <div class="mb-3 form-check form-switch">
  111. <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" {% if profile.confirm_before_deleting %}checked{% endif %}>
  112. <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
  113. </div>
  114. </div>
  115. </div>
  116. <hr>
  117. </div>
  118. <div class="row">
  119. <div class="col-sm-12">
  120. <a href="#navbar" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Save</a>
  121. <a class="btn btn-outline-danger" href="{% url 'delete_account' %}">Delete account</a>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="card mt-3 bg-dark ">
  127. <ul class="list-group list-group-flush">
  128. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  129. <h6 class="mb-0 text-white">Access Token</h6>
  130. <span class="text-white-50">{{ user.profile.access_token }}</span>
  131. </li>
  132. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  133. <h6 class="mb-0 text-white">
  134. Refresh Token</h6>
  135. <span class="text-white-50">{{ user.profile.refresh_token }}</span>
  136. </li>
  137. <li class="list-group-item bg-dark d-flex justify-content-between align-items-center flex-wrap">
  138. <h6 class="mb-0 text-white">Expires At</h6>
  139. <span class="text-white-50">{{ user.profile.expires_at }}</span>
  140. </li>
  141. </ul>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <!--
  148. <div class="container-fluid">
  149. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  150. <h1 class="h2">Settings</h1>
  151. <span><small>Logged in as <b>{{ user.username }}</b></small></span>
  152. </div>
  153. <div id="settings-status-div" class="text-dark">
  154. </div>
  155. <div id="settings-form">
  156. <div class="mb-3">
  157. <label for="username" class="form-label">Username</label>
  158. <input type="text" class="form-control" name="username" id="username" value="{{ user.username }}">
  159. </div>
  160. <fieldset disabled>
  161. <div class="mb-3">
  162. <label for="email" class="form-label">Email Address</label>
  163. <input type="email" class="form-control" id="email" aria-describedby="emailHelp" value="{{ user.email }}">
  164. <div id="emailHelp" class="form-text">This is the google account you logged in with.</div>
  165. </div>
  166. <div class="mb-3">
  167. <label for="fullname" class="form-label">Full Name</label>
  168. <input type="text" class="form-control" id="fullname" value="{{ user.get_full_name }}">
  169. </div>
  170. <div class="mb-3">
  171. <label for="ytchannelid" class="form-label">YouTube Channel ID</label>
  172. <input type="text" class="form-control" id="ytchannelid" aria-describedby="emailHelp" value="{{ user.profile.yt_channel_id }}">
  173. </div>
  174. <div class="mb-3">
  175. <label for="accesstoken" class="form-label">Access Token</label>
  176. <input type="text" class="form-control" id="accesstoken" value="{{ user.profile.access_token }}">
  177. </div>
  178. <div class="mb-3">
  179. <label for="refreshtoken" class="form-label">Refresh Token</label>
  180. <input type="text" class="form-control" id="refreshtoken" value="{{ user.profile.refresh_token }}">
  181. </div>
  182. <div class="mb-3">
  183. <label for="expiresat" class="form-label">Expires At</label>
  184. <input type="datetime-local" class="form-control" id="expiresat" value="{{ user.profile.expires_at }}">
  185. </div>
  186. </fieldset>
  187. <div class="mb-3 form-check form-switch">
  188. <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
  189. <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
  190. </div>
  191. <div class="mb-3 form-check form-switch">
  192. <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
  193. <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
  194. </div>
  195. <div class="mb-3 form-check form-switch">
  196. <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
  197. <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
  198. </div>
  199. </div>
  200. <div>
  201. <a class="btn btn-outline-danger" href="{% url 'delete_account' %}">Delete account</a>
  202. <button type="button" hx-post="{% url 'update_settings' %}" hx-include="[id='settings-form']" hx-target="#settings-status-div" class="btn btn-success">Save</button>
  203. </div>
  204. </div>
  205. -->
  206. {% endblock %}