fix site ui
This commit is contained in:
parent
3269394c42
commit
d84d3d6323
2 changed files with 6 additions and 6 deletions
|
@ -2,13 +2,13 @@ c3nav = {
|
||||||
init: function() {
|
init: function() {
|
||||||
c3nav._typeahead_locations = new Bloodhound({
|
c3nav._typeahead_locations = new Bloodhound({
|
||||||
datumTokenizer: function(data) {
|
datumTokenizer: function(data) {
|
||||||
var result = [data.name]
|
var result = [data.id]
|
||||||
result = result.concat(data.title.split(' '));
|
result = result.concat(data.title.split(' '));
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||||
identify: function(data) {
|
identify: function(data) {
|
||||||
return data.name;
|
return data.id;
|
||||||
},
|
},
|
||||||
prefetch: {
|
prefetch: {
|
||||||
url: '/api/locations/',
|
url: '/api/locations/',
|
||||||
|
@ -37,7 +37,7 @@ c3nav = {
|
||||||
_locationselect_reset: function(e) {
|
_locationselect_reset: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var locationselect = $(this).closest('.locationselect');
|
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');
|
locationselect.removeClass('selected').find('.tt-input').focus().keyup().removeData('enter_item');
|
||||||
c3nav.update_history_state();
|
c3nav.update_history_state();
|
||||||
},
|
},
|
||||||
|
@ -66,7 +66,7 @@ c3nav = {
|
||||||
var selected = locationselect.find('.locationselect-selected');
|
var selected = locationselect.find('.locationselect-selected');
|
||||||
selected.find('.title').text(item.title);
|
selected.find('.title').text(item.title);
|
||||||
selected.find('.subtitle').text(item.subtitle);
|
selected.find('.subtitle').text(item.subtitle);
|
||||||
selected.find('.name-field').val(item.name);
|
selected.find('.id-field').val(item.id);
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
c3nav.update_history_state();
|
c3nav.update_history_state();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<label for="{ name }}_input">{{ heading }}</label>
|
<label for="{ name }}_input">{{ heading }}</label>
|
||||||
<div class="locationselect {% if location %} selected{% endif %}">
|
<div class="locationselect {% if location %} selected{% endif %}">
|
||||||
<div class="locationselect-input">
|
<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>
|
||||||
<div class="locationselect-selected">
|
<div class="locationselect-selected">
|
||||||
<div class="location form-control input-lg">
|
<div class="location form-control input-lg">
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
<a href="" class="reset"></a>
|
<a href="" class="reset"></a>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue