-
Notifications
You must be signed in to change notification settings - Fork 25
/
find.js.erb
29 lines (25 loc) · 1.08 KB
/
find.js.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// j is an alias for escape_javascript
var html;
$("#find_item").mx_spinner('show');
html = $('<%= j(render(partial: 'result_list',
locals: {collection_objects: @collection_objects})) %>');
$("#show_list").html(html);
$("#find_item").mx_spinner('hide');
var paging;
paging = $('<%= j(render(partial: 'paging_data')) %>');
$("#paging_span").html(paging);
var message, collection_objects_count, feature_collection;
message = $('<%= 'No collection objects found.' if @collection_objects.count == 0 %>').selector;
if (message.length == 0) {
collection_objects_count = $('<%= @collection_objects.total_count.to_s %>').selector;
$("#result_span").text(collection_objects_count);
}
else {
$("#result_span").text(message);
}
result_collection = <%= ::Gis::GeoJSON.feature_collection(Georeference.joins(:collection_objects).where(collection_objects: {id: @collection_objects})).to_json.html_safe %>;
if (result_collection) {
if ($("#show_map").attr("hidden") != "hidden") {
result_map = TW.vendor.lib.google.maps.initializeMap('simple_map_canvas', result_collection);
}
}