diff --git a/app/assets/images/map-marker.svg b/app/assets/images/map-marker.svg new file mode 100644 index 0000000000000000000000000000000000000000..af0ee6abed009e8b906eb4477f6343b17fed1560 --- /dev/null +++ b/app/assets/images/map-marker.svg @@ -0,0 +1,4 @@ +<svg width="18" height="26" viewBox="0 0 18 26" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M17.5676 8.7551C17.5676 13.5904 8.78378 26 8.78378 26C8.78378 26 0 13.5904 0 8.7551C0 3.91979 3.93263 0 8.78378 0C13.6349 0 17.5676 3.91979 17.5676 8.7551Z" fill="black"/> +<circle cx="9.13516" cy="8.43252" r="4.21622" fill="white"/> +</svg> diff --git a/app/views/admin/communication/blocks/_preview.html.erb b/app/views/admin/communication/blocks/_preview.html.erb index 49e415f91dcd0642602e0a2fc322e4d18d7c0dd2..bd26dfe7acf4a9579b6cae270b2b5c53423d96b8 100644 --- a/app/views/admin/communication/blocks/_preview.html.erb +++ b/app/views/admin/communication/blocks/_preview.html.erb @@ -1,4 +1,18 @@ +<% is_leaflet_needed = true; %> + <% about.blocks.published.ordered.each do |block| %> <% @block = block %> <%= render "admin/communication/blocks/templates/#{@block.template_kind}/preview" %> -<% end %> \ No newline at end of file + <% if block.template_kind == "partners" && block.data[:layout] == "map" %> + <% is_leaflet_needed = true; %> + <% end %> +<% end %> + +<% if is_leaflet_needed %> + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" + integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" + crossorigin=""/> + <script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" + integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" + crossorigin=""></script> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb index 920293c19953917792f3ce2725d1300e453e3a7b..948bf083d80599c5a83fc675d3a5ab1774409855 100644 --- a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -1,12 +1,11 @@ <% - $class = "block block-partners" + class_name = "block block-partners" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end - $class += " block-partners--" + @block.template.layout + class_name += " block-partners--" + @block.template.layout %> - <section class="<%= class_name %>"> <div class="container"> <div class="block-content"> @@ -42,11 +41,10 @@ </article> <% end %> </div> - <% else %> <div class="map" id="map"> <% @block.template.elements.each do |element| %> - <article class="organization"> + <article class="organization" data-latitude="<%= element.organization.latitude %>" data-longitude="<%= element.organization.longitude %>"> <h3> <% if element.best_url %> <a href="<%= element.best_url %>" target="_blank"> @@ -63,6 +61,6 @@ <% end %> </div> <% end %> - + </div> </div> -</section> \ No newline at end of file +</section>