fix some issues about test and variables name
This commit is contained in:
@@ -24,7 +24,7 @@ App.Map =
|
||||
longitudeInputSelector = $(element).data('longitude-input-selector')
|
||||
zoomInputSelector = $(element).data('zoom-input-selector')
|
||||
removeMarkerSelector = $(element).data('marker-remove-selector')
|
||||
addMarkerInvestemts = $(element).data('marker-investments-coordenates')
|
||||
addMarkerInvestments = $(element).data('marker-investments-coordinates')
|
||||
editable = $(element).data('marker-editable')
|
||||
marker = null;
|
||||
markerIcon = L.divIcon(
|
||||
@@ -78,7 +78,7 @@ App.Map =
|
||||
map = L.map(element.id).setView(mapCenterLatLng, zoom)
|
||||
L.tileLayer(mapTilesProvider, attribution: mapAttribution).addTo map
|
||||
|
||||
if markerLatitude && markerLongitude && !addMarkerInvestemts
|
||||
if markerLatitude && markerLongitude && !addMarkerInvestments
|
||||
marker = createMarker(markerLatitude, markerLongitude)
|
||||
|
||||
if editable
|
||||
@@ -86,8 +86,8 @@ App.Map =
|
||||
map.on 'zoomend', updateFormfields
|
||||
map.on 'click', moveOrPlaceMarker
|
||||
|
||||
if addMarkerInvestemts
|
||||
for i in addMarkerInvestemts
|
||||
if addMarkerInvestments
|
||||
for i in addMarkerInvestments
|
||||
add_marker=createMarker(i.lat , i.long)
|
||||
add_marker.bindPopup(contentPopup(i.investment_title, i.investment_id, i.budget_id))
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class BudgetsController < ApplicationController
|
||||
def index
|
||||
@budgets = @budgets.order(:created_at)
|
||||
budgets_map_locations = Budget.where.not(phase: 'drafting').map{ |budget| budget.investments.map{|investment| investment.map_location}}.flatten.compact
|
||||
@budgets_coordenates = budgets_map_locations.map{ |ml| {lat: ml.latitude, long: ml.longitude, investment_title: ml.investment.title , investment_id: ml.investment.id, budget_id: ml.investment.budget.id}}
|
||||
@budgets_coordinates = budgets_map_locations.map{ |ml| {lat: ml.latitude, long: ml.longitude, investment_title: ml.investment.title , investment_id: ml.investment.id, budget_id: ml.investment.budget.id}}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -24,12 +24,12 @@ module MapLocationsHelper
|
||||
"remove-marker-link-#{dom_id(map_location)}"
|
||||
end
|
||||
|
||||
def render_map(map_location, parent_class, editable, remove_marker_label,investments_coordenates=nil)
|
||||
def render_map(map_location, parent_class, editable, remove_marker_label, investments_coordinates=nil)
|
||||
map_location = MapLocation.new if map_location.nil?
|
||||
map = content_tag_for :div,
|
||||
map_location,
|
||||
class: "map",
|
||||
data: prepare_map_settings(map_location, editable, parent_class, investments_coordenates)
|
||||
data: prepare_map_settings(map_location, editable, parent_class, investments_coordinates)
|
||||
map += map_location_remove_marker(map_location, remove_marker_label) if editable
|
||||
map
|
||||
end
|
||||
@@ -45,27 +45,25 @@ module MapLocationsHelper
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def prepare_map_settings(map_location, editable, parent_class,marker_investments_coordenates=nil)
|
||||
def prepare_map_settings(map_location, editable, parent_class, investments_coordinates=nil)
|
||||
options = {
|
||||
map: "",
|
||||
map_tiles_provider: Rails.application.secrets.map_tiles_provider,
|
||||
map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution,
|
||||
marker_editable: editable,
|
||||
map_center_latitude: map_location_latitude(map_location),
|
||||
map_center_longitude: map_location_longitude(map_location),
|
||||
map_zoom: map_location_zoom(map_location),
|
||||
marker_latitude: map_location_latitude(map_location.latitude),
|
||||
marker_longitude: map_location_longitude(map_location.longitude),
|
||||
marker_investments_coordenates: marker_investments_coordenates,
|
||||
map_tiles_provider: Rails.application.secrets.map_tiles_provider,
|
||||
map_tiles_provider_attribution: Rails.application.secrets.map_tiles_provider_attribution,
|
||||
marker_editable: editable,
|
||||
marker_remove_selector: "##{map_location_remove_marker_link_id(map_location)}",
|
||||
latitude_input_selector: "##{map_location_input_id(parent_class, 'latitude')}",
|
||||
longitude_input_selector: "##{map_location_input_id(parent_class, 'longitude')}",
|
||||
zoom_input_selector: "##{map_location_input_id(parent_class, 'zoom')}",
|
||||
marker_investments_coordenates: marker_investments_coordenates
|
||||
marker_investments_coordinates: investments_coordinates
|
||||
}
|
||||
options[:marker_latitude] = map_location.latitude if map_location.latitude.present?
|
||||
options[:marker_longitude] = map_location.longitude if map_location.longitude.present?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<% end %>
|
||||
|
||||
<%= render "shared/section_header", i18n_namespace: "budgets.index.section_header", image: "budgets" %>
|
||||
<%= render_map(nil, "budgets",false,nil, @budgets_coordenates) %>
|
||||
<%= render_map(nil, "budgets", false, nil, @budgets_coordinates) %>
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 medium-9 column">
|
||||
<table>
|
||||
|
||||
Reference in New Issue
Block a user