Skip to content

Commit

Permalink
Extract repeated map code to new partial
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley committed May 25, 2020
1 parent e03005e commit a3660df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
9 changes: 2 additions & 7 deletions app/views/groups/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@
%tab{heading: t(:label_map),
active: "tabs.map.active",
select: "select(\'map\')"}
.map-container
%map{"ng-controller" => "MapCtrl", "ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"}
%ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
%map-osm-tiles
%map-search
%ui-gmap-markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}
%div{"ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"}
= render partial: "shared/map"
%tab{heading: t(:groups_about),
active: "tabs.about.active",
Expand Down
8 changes: 1 addition & 7 deletions app/views/map/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
- content_for :injection_data do
= inject_enterprise_shopfront_list

.map-container{"fill-vertical" => true}
%map{"ng-controller" => "MapCtrl"}
%ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom", styles: "map.styles", draggable: "true"}
%map-osm-tiles
%map-search
%ui-gmap-markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}
= render partial: "shared/map"

.map-footer
%a{:href => "http://www.openstreetmap.org/copyright"} © OpenStreetMap contributors
8 changes: 8 additions & 0 deletions app/views/shared/_map.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.map-container
%map{"ng-controller" => "MapCtrl"}
%ui-gmap-google-map{options: "map.additional_options", center: "map.center", zoom: "map.zoom",
styles: "map.styles", draggable: "true"}
%map-osm-tiles
%map-search
%ui-gmap-markers{models: "OfnMap.enterprises", fit: "true",
coords: "'self'", icon: "'icon'", click: "'reveal'"}

0 comments on commit a3660df

Please sign in to comment.