Remove redundant HTML map classes

The `map` class is applied to the map element by LeafletJS; using it in
the container led to hacks like adding an `inline` class to fix the fact
that the container was using the `height` rule of the `.map` elements.

Even though we don't add styles for them, I'm adding the `budgets-map`
and `budget-investments-map` HTML classes so these elements can still be
easily selected with CSS and JavaScript.
This commit is contained in:
Javi Martín
2023-05-23 17:57:03 +02:00
parent 727e849fd4
commit 106dee0040
4 changed files with 4 additions and 3 deletions

View File

@@ -1,3 +1,3 @@
<div class="map">
<div class="budget-investments-map">
<%= render_map(map_location, investments_coordinates: coordinates) %>
</div>

View File

@@ -1,5 +1,6 @@
class Budgets::Investments::MapComponent < ApplicationComponent
attr_reader :heading, :investments
delegate :render_map, to: :helpers
def initialize(investments, heading:)
@investments = investments

View File

@@ -1,4 +1,4 @@
<div class="map inline">
<div class="budgets-map">
<h2><%= t("budgets.index.map") %></h2>
<%= render_map(nil, investments_coordinates: coordinates) %>
</div>

View File

@@ -10,7 +10,7 @@ describe Budgets::MapComponent do
render_inline Budgets::MapComponent.new(budget)
expect(page.first("div.map")).to have_content "located geographically"
expect(page.find(".budgets-map")).to have_content "located geographically"
end
it "is not rendered during the informing phase" do