diff options
| -rw-r--r-- | app/assets/stylesheets/main/stop_areas.css.scss | 24 | ||||
| -rw-r--r-- | app/views/stop_areas/_form.html.erb | 31 |
2 files changed, 24 insertions, 31 deletions
diff --git a/app/assets/stylesheets/main/stop_areas.css.scss b/app/assets/stylesheets/main/stop_areas.css.scss index 28a7a9c3c..74f8e0277 100644 --- a/app/assets/stylesheets/main/stop_areas.css.scss +++ b/app/assets/stylesheets/main/stop_areas.css.scss @@ -4,6 +4,7 @@ #workspace.stop_areas.index { + #country_codes { display: none; } .stop_area { @@ -22,27 +23,24 @@ } } -#workspace.stop_areas.edit { +#workspace.stop_areas.edit, #workspace.stop_areas.new { legend { padding-bottom: 20px; } + #prefetch { + padding: 10px 10px 30px 10px; + + label{ + font-size: 18px; + margin-right: 20px; + } + } + #map{ float:none; width: 100%; } } -#workspace.stop_areas.new { - legend { padding-bottom: 20px; } - #prefetch { - padding: 10px 10px 30px 10px; - - label{ - font-size: 18px; - margin-right: 20px; - } - } -} - #workspace.stop_areas.show { .geo_data { diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb index 1282606f5..eefae9c16 100644 --- a/app/views/stop_areas/_form.html.erb +++ b/app/views/stop_areas/_form.html.erb @@ -60,8 +60,6 @@ <script> var addressesEngine = new Bloodhound({ - // datumTokenizer: Bloodhound.tokenizers.obj.whitespace('the_key'), - // queryTokenizer: Bloodhound.tokenizers.whitespace, datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.id+" : "+d.road); }, @@ -70,7 +68,7 @@ }, limit: 10, remote: { - url: 'addresses?q=%QUERY', + url: '<%= addresses_referential_stop_areas_path(@referential, :format => 'json') %>?q=%QUERY', filter: function(list) { return $.map(list, function(d) { return { postcode: d.postcode, road: d.road, lon: d.lon, lat: d.lat, city: d.city, postcode: d.postcode, the_key: d.house_number+" "+d.road+", "+d.postcode+" "+d.city+", "+d.country }; }); }, @@ -79,24 +77,21 @@ // kicks off the loading/processing of `local` and `prefetch` var promise = addressesEngine.initialize(); - - // promise.done(function() { console.log('success!'); }); - // promise.fail(function() { console.log('err!'); }); // passing in `null` for the `options` arguments will result in the default // options being used - $('#prefetch .typeahead').typeahead({ - hint: true, - highlight: true, - minLength: 1 - }, - { - name: 'addresses', - displayKey: 'the_key', - // `ttAdapter` wraps the suggestion engine in an adapter that - // is compatible with the typeahead jQuery plugin - source: addressesEngine.ttAdapter(), - }); + $('#prefetch .typeahead').typeahead( + { + hint: true, + highlight: true, + minLength: 1 + }, + { + name: 'addresses', + displayKey: 'the_key', + source: addressesEngine.ttAdapter(), + } + ); $('.typeahead').on('typeahead:selected', function($e, datum) { $('input[name="stop_area[longitude]"]').val(datum.lon); |
