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.

151 lines
6.1KB

  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {{linked_resources}}
  4. <h1>{% block title %} Edit "{{ resource['name'] }}" {% endblock %}</h1>
  5. <form method="post">
  6. <div class="mb-3 mt-3">
  7. <label for="name">Name</label>
  8. <input type="text" name="name" placeholder="Name"
  9. class="form-control"
  10. value="{{ request.form['name'] or resource['name'] }}">
  11. </input>
  12. </div>
  13. <div class="mb-3 mt-3">
  14. <label for="description">Description</label>
  15. <textarea name="description" placeholder="Description"
  16. class="form-control">{{ request.form['description'] or resource['description'] }}</textarea>
  17. </div>
  18. {% if resource['type'] == 'tool' %}
  19. <div class="mb-3 mt-3">
  20. <label for="projectUrl">Project URL</label>
  21. <input type="text" name="projectUrl" placeholder="Project URL"
  22. class="form-control"
  23. value="{{ request.form['projectUrl'] or resource['projectUrl'] }}">
  24. </input>
  25. </div>
  26. <div class="mb-3 mt-3">
  27. <label for="repositoryUrl">Repository URL</label>
  28. <input type="text" name="repositoryUrl" placeholder="Repository URL"
  29. class="form-control"
  30. value="{{ request.form['repositoryUrl'] or resource['repositoryUrl'] }}">
  31. </input>
  32. </div>
  33. <div class="mb-3 mt-3">
  34. <label for="expertiseToUse">Expertise required to use</label>
  35. <input type="text" name="expertiseToUse" placeholder="Expertise required to use"
  36. class="form-control"
  37. value="{{ request.form['expertiseToUse'] or resource['expertiseToUse'] }}">
  38. </input>
  39. </div>
  40. <div class="mb-3 mt-3">
  41. <label for="expertiseToHost">Expertise required to host</label>
  42. <input type="text" name="expertiseToHost" placeholder="Expertise required to host"
  43. class="form-control"
  44. value="{{ request.form['expertiseToHost'] or resource['expertiseToHost'] }}">
  45. </input>
  46. </div>
  47. <div class="mb-3 mt-3">
  48. <label for="dependencies">Technical dependencies</label>
  49. <input type="text" name="dependencies" placeholder="Technical dependencies"
  50. class="form-control"
  51. value="{{ request.form['dependencies'] or resource['dependencies'] }}">
  52. </input>
  53. </div>
  54. <div class="mb-3 mt-3">
  55. <label for="ingestFormats">Import / ingest formats</label>
  56. <input type="text" name="ingestFormats" placeholder="Import / ingest formats"
  57. class="form-control"
  58. value="{{ request.form['ingestFormats'] or resource['ingestFormats'] }}">
  59. </input>
  60. </div>
  61. <div class="mb-3 mt-3">
  62. <label for="outputFormats">Output formats</label>
  63. <input type="text" name="outputFormats" placeholder="Output formats"
  64. class="form-control"
  65. value="{{ request.form['outputFormats'] or resource['outputFormats'] }}">
  66. </input>
  67. </div>
  68. <div class="mb-3 mt-3">
  69. <label for="status">Platform status</label>
  70. <input type="text" name="status" placeholder="Platform status"
  71. class="form-control"
  72. value="{{ request.form['status'] or resource['status'] }}">
  73. </input>
  74. </div>
  75. <div class="mb-3 mt-3">
  76. <label for="linked_practice_id">Linked resources</label>
  77. </div>
  78. <div class="mb-3 mt-3">
  79. <select name="linked_resources" id="linked_resources" aria-label="Linked resources" class="selectpicker" data-live-search="true" multiple>
  80. {% for resource_dropdown in resource_dropdown %}
  81. {% if resource_dropdown['type'] != 'tool' %}
  82. {% if links and resource_dropdown in links %}
  83. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  84. {% else %}
  85. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  86. {% endif %}
  87. {% endif %}
  88. {% endfor %}
  89. </select>
  90. </div>
  91. {% elif resource['type'] == 'practice' %}
  92. <div class="mb-3 mt-3">
  93. <label for="linked_practice_id">Linked resources</label>
  94. </div>
  95. <div class="mb-3 mt-3">
  96. <select name="linked_resources" id="linked_resources" aria-label="Linked resources" class="selectpicker" data-live-search="true" multiple>
  97. {% for resource_dropdown in resource_dropdown %}
  98. {% if resource_dropdown['type'] != 'practice' %}
  99. {% if links and resource_dropdown in links %}
  100. <option value="{{ resource_dropdown['id'] }}" selected>{{ resource_dropdown['name'] }}</option>
  101. {% else %}
  102. <option value="{{ resource_dropdown['id'] }}">{{ resource_dropdown['name'] }}</option>
  103. {% endif %}
  104. {% endif %}
  105. {% endfor %}
  106. </select>
  107. </div>
  108. {% endif %}
  109. {% if links %}
  110. <div class="mb-3 mt-3">
  111. <label for="linked_practice_id">Remove linked resources</label>
  112. </div>
  113. <div class="mb-3 mt-3">
  114. <select name="remove_linked_resources" id="remove_linked_resources" aria-label="Remove linked resources" class="selectpicker" data-live-search="true" multiple>
  115. {% for link in links %}
  116. <option value="{{ link['id'] }}">{{ link['name'] }}</option>
  117. {% endfor %}
  118. </select>
  119. </div>
  120. {% endif %}
  121. <div class="mb-3 mt-3">
  122. <button type="submit" class="btn btn-primary">Submit</button>
  123. </div>
  124. </form>
  125. <hr>
  126. {% if resource['type'] == 'tool' %}
  127. <form action="{{ url_for('tool.delete_tool', tool_id=resource['id']) }}" method="POST">
  128. <input type="submit" value="Delete"
  129. class="btn btn-danger btn-sm"
  130. onclick="return confirm('Are you sure you want to delete this tool?')">
  131. </form>
  132. {% endif %}
  133. {% if resource['type'] == 'practice' %}
  134. <form action="{{ url_for('practice.delete_practice', practice_id=resource['id']) }}" method="POST">
  135. <input type="submit" value="Delete"
  136. class="btn btn-danger btn-sm"
  137. onclick="return confirm('Are you sure you want to delete this practice?')">
  138. </form>
  139. {% endif %}
  140. {% endblock %}