您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <h1>{% block title %} Edit "{{ resource['name'] }}" {% endblock %}</h1>
  4. <form method="post">
  5. <div class="mb-3 mt-3">
  6. <label for="name">Name</label>
  7. <input type="text" name="name" placeholder="Name"
  8. class="form-control"
  9. value="{{ request.form['name'] or resource['name'] }}">
  10. </input>
  11. </div>
  12. <div class="mb-3 mt-3">
  13. <label for="description">Description</label>
  14. <textarea name="description" placeholder="Description"
  15. class="form-control">{{ request.form['description'] or resource['description'] }}</textarea>
  16. </div>
  17. {% if resource['type'] == 'tool' %}
  18. <div class="mb-3 mt-3">
  19. <label for="developer">Developer</label>
  20. <input type="text" name="developer" placeholder="Developer"
  21. class="form-control"
  22. value="{{ request.form['developer'] or resource['developer'] }}">
  23. </input>
  24. </div>
  25. <div class="mb-3 mt-3">
  26. <label for="developerUrl">Developer URL</label>
  27. <input type="text" name="developerUrl" placeholder="Developer URL"
  28. class="form-control"
  29. value="{{ request.form['developerUrl'] or resource['developerUrl'] }}">
  30. </input>
  31. </div>
  32. <div class="mb-3 mt-3">
  33. <label for="projectUrl">Project URL</label>
  34. <input type="text" name="projectUrl" placeholder="Project URL"
  35. class="form-control"
  36. value="{{ request.form['projectUrl'] or resource['projectUrl'] }}">
  37. </input>
  38. </div>
  39. <div class="mb-3 mt-3">
  40. <label for="repositoryUrl">Repository URL</label>
  41. <input type="text" name="repositoryUrl" placeholder="Repository URL"
  42. class="form-control"
  43. value="{{ request.form['repositoryUrl'] or resource['repositoryUrl'] }}">
  44. </input>
  45. </div>
  46. <div class="mb-3 mt-3">
  47. <label for="license">Software license</label>
  48. <input type="text" name="license" placeholder="Software license"
  49. class="form-control"
  50. value="{{ request.form['license'] or resource['license'] }}">
  51. </input>
  52. </div>
  53. <div class="mb-3 mt-3">
  54. <label for="scriptingLanguage">Software language(s)</label>
  55. <input type="text" name="scriptingLanguage" placeholder="Software language(s)"
  56. class="form-control"
  57. value="{{ request.form['scriptingLanguage'] or resource['scriptingLanguage'] }}">
  58. </input>
  59. </div>
  60. <div class="mb-3 mt-3">
  61. <label for="expertiseToUse">Expertise required to use</label>
  62. <input type="text" name="expertiseToUse" placeholder="Expertise required to use"
  63. class="form-control"
  64. value="{{ request.form['expertiseToUse'] or resource['expertiseToUse'] }}">
  65. </input>
  66. </div>
  67. <div class="mb-3 mt-3">
  68. <label for="expertiseToHost">Expertise required to host</label>
  69. <input type="text" name="expertiseToHost" placeholder="Expertise required to host"
  70. class="form-control"
  71. value="{{ request.form['expertiseToHost'] or resource['expertiseToHost'] }}">
  72. </input>
  73. </div>
  74. <div class="mb-3 mt-3">
  75. <label for="dependencies">Technical dependencies</label>
  76. <input type="text" name="dependencies" placeholder="Technical dependencies"
  77. class="form-control"
  78. value="{{ request.form['dependencies'] or resource['dependencies'] }}">
  79. </input>
  80. </div>
  81. <div class="mb-3 mt-3">
  82. <label for="ingestFormats">Import / ingest formats</label>
  83. <input type="text" name="ingestFormats" placeholder="Import / ingest formats"
  84. class="form-control"
  85. value="{{ request.form['ingestFormats'] or resource['ingestFormats'] }}">
  86. </input>
  87. </div>
  88. <div class="mb-3 mt-3">
  89. <label for="outputFormats">Output formats</label>
  90. <input type="text" name="outputFormats" placeholder="Output formats"
  91. class="form-control"
  92. value="{{ request.form['outputFormats'] or resource['outputFormats'] }}">
  93. </input>
  94. </div>
  95. <div class="mb-3 mt-3">
  96. <label for="status">Platform status</label>
  97. <input type="text" name="status" placeholder="Platform status"
  98. class="form-control"
  99. value="{{ request.form['status'] or resource['status'] }}">
  100. </input>
  101. </div>
  102. <div class="mb-3 mt-3">
  103. <label for="linked_practice_id">Linked resources</label>
  104. </div>
  105. <div class="mb-3 mt-3">
  106. <select name="linked_resources" id="linked_resources" aria-label="Linked resources" class="selectpicker" data-live-search="true" multiple>
  107. {% for resource_dropdown in resource_dropdown %}
  108. {% if resource_dropdown['type'] != 'tool' %}
  109. {% if relationships and resource_dropdown in relationships %}
  110. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  111. {% else %}
  112. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  113. {% endif %}
  114. {% endif %}
  115. {% endfor %}
  116. </select>
  117. </div>
  118. {% elif resource['type'] == 'practice' %}
  119. <div class="mb-3 mt-3">
  120. <label for="experimental">How is this / Can this be an experimental practice?</label>
  121. <textarea name="experimental" placeholder="How is this / Can this be an experimental practice?"
  122. class="form-control">{{ request.form['experimental'] or resource['experimental'] }}</textarea>
  123. </div>
  124. <div class="mb-3 mt-3">
  125. <label for="lessonsLearned">How has it been applied experimentally (lessons learned for authors and publishers)?</label>
  126. <textarea name="lessonsLearned" placeholder="How has it been applied experimentally (lessons learned for authors and publishers)?"
  127. class="form-control">{{ request.form['lessonsLearned'] or resource['lessonsLearned'] }}</textarea>
  128. </div>
  129. <div class="mb-3 mt-3">
  130. <label for="references">References</label>
  131. <textarea name="references" placeholder="References"
  132. class="form-control">{{ request.form['references'] or resource['references'] }}</textarea>
  133. </div>
  134. <div class="mb-3 mt-3">
  135. <label for="linked_practice_id">Linked resources</label>
  136. </div>
  137. <div class="mb-3 mt-3">
  138. <select name="linked_resources" id="linked_resources" aria-label="Linked resources" class="selectpicker" data-live-search="true" multiple>
  139. {% for resource_dropdown in resource_dropdown %}
  140. {% if resource_dropdown['type'] != 'practice' %}
  141. {% if relationships and resource_dropdown in relationships %}
  142. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  143. {% else %}
  144. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  145. {% endif %}
  146. {% endif %}
  147. {% endfor %}
  148. </select>
  149. </div>
  150. {% elif resource['type'] == 'book' %}
  151. <div class="mb-3 mt-3">
  152. <label for="author">Author</label>
  153. <input type="text" name="author" placeholder="Author"
  154. class="form-control"
  155. value="{{ request.form['author'] or resource['author'] }}">
  156. </input>
  157. </div>
  158. <div class="mb-3 mt-3">
  159. <label for="year">Publication year</label>
  160. <input type="text" name="year" placeholder="Publication year"
  161. class="form-control"
  162. value="{{ request.form['year'] or resource['year'] }}">
  163. </input>
  164. </div>
  165. <div class="mb-3 mt-3">
  166. <label for="bookUrl">URL</label>
  167. <input type="text" name="bookUrl" placeholder="URL"
  168. class="form-control"
  169. value="{{ request.form['bookUrl'] or resource['bookUrl'] }}">
  170. </input>
  171. </div>
  172. <div class="mb-3 mt-3">
  173. <label for="isbn">ISBN</label>
  174. <input type="text" name="isbn" placeholder="ISBN"
  175. class="form-control"
  176. value="{{ request.form['isbn'] or resource['isbn'] }}">
  177. </input>
  178. </div>
  179. <div class="mb-3 mt-3">
  180. <label for="linked_practice_id">Linked resources</label>
  181. </div>
  182. <div class="mb-3 mt-3">
  183. <select name="linked_resources" id="linked_resources" aria-label="Linked resources" class="selectpicker" data-live-search="true" multiple>
  184. {% for resource_dropdown in resource_dropdown %}
  185. {% if resource_dropdown['type'] != 'book' %}
  186. {% if relationships and resource_dropdown in relationships %}
  187. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  188. {% else %}
  189. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  190. {% endif %}
  191. {% endif %}
  192. {% endfor %}
  193. </select>
  194. </div>
  195. {% endif %}
  196. {% if relationships %}
  197. <div class="mb-3 mt-3">
  198. <label for="linked_practice_id">Remove linked resources</label>
  199. </div>
  200. <div class="mb-3 mt-3">
  201. <select name="remove_linked_resources" id="remove_linked_resources" aria-label="Remove linked resources" class="selectpicker" data-live-search="true" multiple>
  202. {% for relationship in relationships %}
  203. <option value="{{ relationship['id'] }}">{{ relationship['name'] }}</option>
  204. {% endfor %}
  205. </select>
  206. </div>
  207. {% endif %}
  208. <div class="mb-3 mt-3">
  209. <button type="submit" class="btn btn-primary">Submit</button>
  210. </div>
  211. </form>
  212. <hr>
  213. {% if resource['type'] == 'tool' %}
  214. <form action="{{ url_for('tool.delete_tool', tool_id=resource['id']) }}" method="POST">
  215. <input type="submit" value="Delete"
  216. class="btn btn-danger btn-sm"
  217. onclick="return confirm('Are you sure you want to delete this tool?')">
  218. </form>
  219. {% endif %}
  220. {% if resource['type'] == 'practice' %}
  221. <form action="{{ url_for('practice.delete_practice', practice_id=resource['id']) }}" method="POST">
  222. <input type="submit" value="Delete"
  223. class="btn btn-danger btn-sm"
  224. onclick="return confirm('Are you sure you want to delete this practice?')">
  225. </form>
  226. {% endif %}
  227. {% if resource['type'] == 'book' %}
  228. <form action="{{ url_for('book.delete_book', book_id=resource['id']) }}" method="POST">
  229. <input type="submit" value="Delete"
  230. class="btn btn-danger btn-sm"
  231. onclick="return confirm('Are you sure you want to delete this book?')">
  232. </form>
  233. {% endif %}
  234. {% endblock %}