fix site ui

This commit is contained in:
Laura Klünder 2016-12-16 15:07:18 +01:00
parent 3269394c42
commit d84d3d6323
2 changed files with 6 additions and 6 deletions

View file

@ -2,13 +2,13 @@ c3nav = {
init: function() {
c3nav._typeahead_locations = new Bloodhound({
datumTokenizer: function(data) {
var result = [data.name]
var result = [data.id]
result = result.concat(data.title.split(' '));
return result
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
identify: function(data) {
return data.name;
return data.id;
},
prefetch: {
url: '/api/locations/',
@ -37,7 +37,7 @@ c3nav = {
_locationselect_reset: function(e) {
e.preventDefault();
var locationselect = $(this).closest('.locationselect');
locationselect.find('.name-field').val('');
locationselect.find('.id-field').val('');
locationselect.removeClass('selected').find('.tt-input').focus().keyup().removeData('enter_item');
c3nav.update_history_state();
},
@ -66,7 +66,7 @@ c3nav = {
var selected = locationselect.find('.locationselect-selected');
selected.find('.title').text(item.title);
selected.find('.subtitle').text(item.subtitle);
selected.find('.name-field').val(item.name);
selected.find('.id-field').val(item.id);
e.target.blur();
c3nav.update_history_state();

View file

@ -3,7 +3,7 @@
<label for="{ name }}_input">{{ heading }}</label>
<div class="locationselect {% if location %} selected{% endif %}">
<div class="locationselect-input">
<input type="text" class="form-control input-lg" id="{ name }}_input" name="{{ name }}_search" placeholder="{% trans 'Search any Location…' %}">
<input type="text" class="form-control input-lg" id="{{ name }}_input" name="{{ name }}_search" placeholder="{% trans 'Search any Location…' %}">
</div>
<div class="locationselect-selected">
<div class="location form-control input-lg">
@ -13,7 +13,7 @@
<div class="icons">
<a href="" class="reset"></a>
</div>
<input type="hidden" name="{{ name }}" value="{{ location.name }}" class="name-field">
<input type="hidden" name="{{ name }}" value="{{ location.location_id }}" class="id-field">
</div>
</div>
</div>