Commit Graph

14 Commits

Author SHA1 Message Date
Pierre Mesure
e5a6a5bf1d Adding clustering 2024-01-29 17:56:54 +01:00
Javi Martín
629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00
Matheus Miranda
de13e789dd Add polygon geographies to Budgets' map
Note that in the budgets wizard test we now create district with no
associated geozone, so the text "all city" will appear in the districts
table too, meaning we can't use `within "section", text: "All city" do`
anymore since it would result in an ambiguous match.

Co-Authored-By: Julian Herrero <microweb10@gmail.com>
Co-Authored-By: Javi Martín <javim@elretirao.net>
2023-05-31 16:56:15 +02:00
Javi Martín
8b14522bf5 Use a button instead of a link to remove a marker
Using a button for interactive elements is better, as explained in
commit 5311daadf.

Since buttons with "type=button" do nothing by default, we no longer
need to call `preventDefault()` when clicking it.
2023-05-04 15:32:33 +02:00
Javi Martín
59ed975f81 Set remove marker link margin-bottom in CSS
We were setting the margin-top property in CSS but the margin-bottom
property by adding a div with a `.margin-bottom` HTML class.
2023-05-04 15:32:33 +02:00
Javi Martín
a145fdb8a8 Make map location HTML class names consistent
We were using `map_location` in one place and
`location-map-remove-marker` in another one. We usually use dashes in
HTML class names, we don't say "location map" anywhere else.
2023-05-04 15:32:33 +02:00
Javi Martín
f4ef6412b6 Remove unused HTML class in link to remove marker
It isn't used since commit c34aa5412.
2023-05-04 15:32:33 +02:00
Javi Martín
e75211125a Remove duplicate i18n text to remove marker
We had two different keys with the same text and were passing it as a
parameter. Since the text is the same in any case, we don't need a
parameter for it.

Note we are using the `proposals` i18n key instead of creating a new one
in a `shared` namespace one because creating a new key would mean that
we'd lose the already existing translations in Crowdin.
2023-05-04 15:27:15 +02:00
Javi Martín
b9518d64e1 Use Rails methods to get map location input IDs
We were manually generating the IDs in order to pass them as data
attributes in the HTML in a component where we don't have access to the
form which has the inputs.

However, these data attributes only make sense when there's a form
present, so we can pass the form as a parameter and use it to get the
IDs.

We can now define a map as editable when there's an associated form,
which makes sense IMHO.
2023-05-04 15:27:15 +02:00
Javi Martín
84fff2e9fb Simplify code setting marker data in maps
We were probably setting them separately to avoid having blank data
attributes in the HTML. However, when a data attribute is `nil`, Rails
doesn't write it in the HTML in the first place.
2023-05-04 15:27:15 +02:00
Javi Martín
e00aa807b9 Make remove marker label parameter optional
We were passing `nil` in some calls, which was confusing.

Since now we've got two optional parameters, we're using named
parameters.
2023-05-04 15:27:15 +02:00
Javi Martín
deb965bcce Remove editable parameter in render_map
The calls to `render_map` are confusing since there are so many
parameters. We can assume that the map is editable if we pass the remove
marker label.
2023-05-04 15:27:15 +02:00
Javi Martín
19adae993e Simplify method names in map component
Since we aren't using helpers anymore, we don't need the `map_location`
prefix.
2023-05-04 15:27:15 +02:00
Javi Martín
9cc3c553ff Extract component to render a map
This way it'll be easier to refactor it.
2023-05-04 15:27:15 +02:00