settings.html 12 KB

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