blob: 67820d3237820c47ec00de0b417552b25669b9fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module LeafletHelper
def json_marker_for(resource, section)
# Style according to requested section
marker = resource.to_geojson
marker['style'] = {
classes: "cat#{section.category_id} sec#{section.id}",
color: section.category.color
}
marker['icon'] = {
name: 'fa-neuter' || section.icon_name || 'fa-circle',
shape: 'penta' # TODO: change shape according to marker state
}
# Render HTML popup
marker['popup'] = popup_for(resource)
marker.to_json
end
def popup_for(resource)
render partial: 'resources/popup', locals: { resource: resource }, formats: [:html]
end
end
|