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.

304 satır
14KB

  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_practices">Add practices relationship(s) (hold Ctrl to select multiple options)</label>
  104. </div>
  105. <div class="mb-3 mt-3">
  106. <select name="linked_practices" id="linked_practices" aria-label="Add practices relationships" class="selectpicker" data-live-search="true" multiple>
  107. {% for resource_dropdown in resource_dropdown %}
  108. {% if resource_dropdown['type'] == 'practice' %}
  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. <div class="mb-3 mt-3">
  119. <label for="linked_books">Add books relationship(s) (hold Ctrl to select multiple options)</label>
  120. </div>
  121. <div class="mb-3 mt-3">
  122. <select name="linked_books" id="linked_books" aria-label="Add books relationships" class="selectpicker" data-live-search="true" multiple>
  123. {% for resource_dropdown in resource_dropdown %}
  124. {% if resource_dropdown['type'] == 'book' %}
  125. {% if relationships and resource_dropdown in relationships %}
  126. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  127. {% else %}
  128. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  129. {% endif %}
  130. {% endif %}
  131. {% endfor %}
  132. </select>
  133. </div>
  134. {% elif resource['type'] == 'practice' %}
  135. <div class="mb-3 mt-3">
  136. <label for="longDescription">Full description</label>
  137. <textarea name="longDescription" placeholder="Full description"
  138. class="form-control">{{ request.form['longDescription'] or resource['longDescription'] }}</textarea>
  139. </div>
  140. <div class="mb-3 mt-3">
  141. <label for="experimental">Experimental uses</label>
  142. <textarea name="experimental" placeholder="Experimental uses"
  143. class="form-control">{{ request.form['experimental'] or resource['experimental'] }}</textarea>
  144. </div>
  145. <div class="mb-3 mt-3">
  146. <label for="considerations">Considerations</label>
  147. <textarea name="considerations" placeholder="Considerations"
  148. class="form-control">{{ request.form['considerations'] or resource['considerations'] }}</textarea>
  149. </div>
  150. <div class="mb-3 mt-3">
  151. <label for="references">Further reading</label>
  152. <textarea name="references" placeholder="Further reading"
  153. class="form-control">{{ request.form['references'] or resource['references'] }}</textarea>
  154. </div>
  155. <div class="mb-3 mt-3">
  156. <label for="linked_tools">Add tools relationship(s) (hold Ctrl to select multiple options)</label>
  157. </div>
  158. <div class="mb-3 mt-3">
  159. <select name="linked_tools" id="linked_tools" aria-label="Add tools relationships" class="selectpicker" data-live-search="true" multiple>
  160. {% for resource_dropdown in resource_dropdown %}
  161. {% if resource_dropdown['type'] == 'tool' %}
  162. {% if relationships and resource_dropdown in relationships %}
  163. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  164. {% else %}
  165. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  166. {% endif %}
  167. {% endif %}
  168. {% endfor %}
  169. </select>
  170. </div>
  171. <div class="mb-3 mt-3">
  172. <label for="linked_books">Add books relationship(s) (hold Ctrl to select multiple options)</label>
  173. </div>
  174. <div class="mb-3 mt-3">
  175. <select name="linked_books" id="linked_books" aria-label="Add books relationships" class="selectpicker" data-live-search="true" multiple>
  176. {% for resource_dropdown in resource_dropdown %}
  177. {% if resource_dropdown['type'] == 'book' %}
  178. {% if relationships and resource_dropdown in relationships %}
  179. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  180. {% else %}
  181. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  182. {% endif %}
  183. {% endif %}
  184. {% endfor %}
  185. </select>
  186. </div>
  187. {% elif resource['type'] == 'book' %}
  188. <div class="mb-3 mt-3">
  189. <label for="author">Author</label>
  190. <input type="text" name="author" placeholder="Author"
  191. class="form-control"
  192. value="{{ request.form['author'] or resource['author'] }}">
  193. </input>
  194. </div>
  195. <div class="mb-3 mt-3">
  196. <label for="year">Publication year</label>
  197. <input type="text" name="year" placeholder="Publication year"
  198. class="form-control"
  199. value="{{ request.form['year'] or resource['year'] }}">
  200. </input>
  201. </div>
  202. <div class="mb-3 mt-3">
  203. <label for="typology">Typology category</label>
  204. <input type="text" name="typology" placeholder="Typology category"
  205. class="form-control"
  206. value="{{ request.form['typology'] or resource['typology'] }}">
  207. </input>
  208. </div>
  209. <div class="mb-3 mt-3">
  210. <label for="bookUrl">URL</label>
  211. <input type="text" name="bookUrl" placeholder="URL"
  212. class="form-control"
  213. value="{{ request.form['bookUrl'] or resource['bookUrl'] }}">
  214. </input>
  215. </div>
  216. <div class="mb-3 mt-3">
  217. <label for="isbn">ISBN</label>
  218. <input type="text" name="isbn" placeholder="ISBN"
  219. class="form-control"
  220. value="{{ request.form['isbn'] or resource['isbn'] }}">
  221. </input>
  222. </div>
  223. <div class="mb-3 mt-3">
  224. <label for="linked_tools">Add tools relationship(s) (hold Ctrl to select multiple options)</label>
  225. </div>
  226. <div class="mb-3 mt-3">
  227. <select name="linked_tools" id="linked_tools" aria-label="Add tools relationships" class="selectpicker" data-live-search="true" multiple>
  228. {% for resource_dropdown in resource_dropdown %}
  229. {% if resource_dropdown['type'] == 'tool' %}
  230. {% if relationships and resource_dropdown in relationships %}
  231. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  232. {% else %}
  233. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  234. {% endif %}
  235. {% endif %}
  236. {% endfor %}
  237. </select>
  238. </div>
  239. <div class="mb-3 mt-3">
  240. <label for="linked_practices">Add practices relationship(s) (hold Ctrl to select multiple options)</label>
  241. </div>
  242. <div class="mb-3 mt-3">
  243. <select name="linked_practices" id="linked_practices" aria-label="Add practices relationships" class="selectpicker" data-live-search="true" multiple>
  244. {% for resource_dropdown in resource_dropdown %}
  245. {% if resource_dropdown['type'] == 'practice' %}
  246. {% if relationships and resource_dropdown in relationships %}
  247. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  248. {% else %}
  249. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  250. {% endif %}
  251. {% endif %}
  252. {% endfor %}
  253. </select>
  254. </div>
  255. {% endif %}
  256. {% if relationships %}
  257. <div class="mb-3 mt-3">
  258. <label for="linked_practice_id">Remove relationship(s)</label>
  259. </div>
  260. <div class="mb-3 mt-3">
  261. <select name="remove_linked_resources" id="remove_linked_resources" aria-label="Remove link" class="selectpicker" data-live-search="true" multiple>
  262. {% for relationship in relationships %}
  263. <option value="{{ relationship['id'] }}">{{ relationship['name'] }}</option>
  264. {% endfor %}
  265. </select>
  266. </div>
  267. {% endif %}
  268. <div class="mb-3 mt-3">
  269. <button type="submit" class="btn btn-default">Submit</button>
  270. </div>
  271. </form>
  272. {% if resource['type'] == 'tool' %}
  273. <form action="{{ url_for('tool.delete_tool', tool_id=resource['id']) }}" method="POST">
  274. <input type="submit" value="Delete"
  275. class="btn btn-danger btn-sm"
  276. onclick="return confirm('Are you sure you want to delete this tool?')">
  277. </form>
  278. {% endif %}
  279. {% if resource['type'] == 'practice' %}
  280. <form action="{{ url_for('practice.delete_practice', practice_id=resource['id']) }}" method="POST">
  281. <input type="submit" value="Delete"
  282. class="btn btn-danger btn-sm"
  283. onclick="return confirm('Are you sure you want to delete this practice?')">
  284. </form>
  285. {% endif %}
  286. {% if resource['type'] == 'book' %}
  287. <form action="{{ url_for('book.delete_book', book_id=resource['id']) }}" method="POST">
  288. <input type="submit" value="Delete"
  289. class="btn btn-danger btn-sm"
  290. onclick="return confirm('Are you sure you want to delete this book?')">
  291. </form>
  292. {% endif %}
  293. {% endblock %}