{% extends "base.html" %}
{% block content %}
<div class="container container-table">
<div class="row vertical-center-row">
<div class="text-center col-md-6 col-md-offset-3">
<div>I just need a pieces of information from you so I can match you with your other half.</div>
<br>
<form role="form">
<div class="form-group">
<label for="interests">What are your interests (you may select more than one)?</label>
<select class="form-control" id="interests" multiple>
<option value="running">Running</option>
<option value="anime">Anime</option>
<option value="programming">Programming</option>
<option value="android">Android</option>
<option value="apple">Apple</option>
<option value="math">Math</option>
<option value="aliens">Aliens</option>
<option value="reddit">Reddit</option>
</select>
</div>
<div class="form-group">
<label>Or enter a custom interest:</label>
<input type="text" id="customInterest"> <button id="interestAdd" type="button" class="btn btn-primary">Add</button>
</div>
<nav>
<ul class="pager">
<li><a href="./main/info/2">Next</a></li>
</ul>
</nav>
</form>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$("#interests").select2();
$("#interests").on("change", function () {
$.post("./main/sessionset/interests/", {"interests": $(this).val()});
});
function addInterest() {
var value = $("#customInterest").val();
if (value) {
$("#interests").append($("<option/>", {
value: value.toLowerCase(),
text: value.toLowerCase(),
selected: "selected"
}));
var original = $("#interests").val();
var newval = $.merge([value], original);
$("#interests").val(newval).change();
$("#customInterest").val("");
}
}
$("#customInterest").keyup(function (e) {
if (e.which == $.ui.keyCode.ENTER) {
addInterest();
}
});
$("#interestAdd").click(function () {
addInterest();
});
});
</script>
{% endblock %}