Commit f2f3ed21 authored by Josh Adam's avatar Josh Adam

Fixed select2 for adding a sample

parent c2b7ec3c
Pipeline #6708 failed with stage
in 44 minutes and 54 seconds
......@@ -6,6 +6,8 @@
<head>
<title th:text="#{project.samples.new.title(${project.label})}">__NEW_SAMPLE__</title>
<link rel="stylesheet" th:href="@{/resources/dist/css/project-add-sample.bundle.css}">
<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2.css}">
<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2-bootstrap.css}">
<script th:inline="javascript">
var PAGE = {
urls: {
......@@ -43,7 +45,7 @@
<div class="form-group">
<label for="organism" th:text="#{samples.details.organism}">ORGANISM_</label>
<small class="text-muted pull-right">(Optional)</small>
<select id="organism" name="organism" class="form-control" th:field="*{organism}"></select>
<input id="organism" name="organism" class="form-control" th:field="*{organism}" />
</div>
<button id="save-btn" class="btn btn-primary pull-right" type="submit" disabled="disabled"
th:text="#{project.samples.new.submit.form}">
......@@ -57,6 +59,7 @@
</div>
<th:block layout:fragment="scripts">
<script th:src="@{/resources/bower_components/select2/select2.min.js}"></script>
<script th:src="@{/resources/dist/js/project-add-sample.bundle.js}"></script>
</th:block>
</body>
......
import $ from "jquery";
import "jquery-validation";
import "./../../vendor/plugins/jquery/select2";
import {
validationConfig,
sampleNameCharacterValidation
......@@ -47,12 +46,13 @@ organismInput.select2({
url: window.PAGE.urls.taxonomy,
dataType: "json",
delay: 250,
data(params) {
data(searchTerm) {
return {
searchTerm: params.term
searchTerm
};
},
processResults(data) {
results(data) {
console.log(data);
return {
results: data
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment