From 63a1a6fefade8309e024ec83bb9741c87934855f Mon Sep 17 00:00:00 2001 From: Manvil George Date: Thu, 7 May 2020 22:58:09 +1000 Subject: [PATCH] More optimsations: removing unwanted code --- .../services/enterprise_list_modal.js.coffee | 1 - .../darkswarm/services/map.js.coffee | 17 +++++++++-------- .../stylesheets/admin/openfoodnetwork.css.scss | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/darkswarm/services/enterprise_list_modal.js.coffee b/app/assets/javascripts/darkswarm/services/enterprise_list_modal.js.coffee index 676ea38c02..62412f7e59 100644 --- a/app/assets/javascripts/darkswarm/services/enterprise_list_modal.js.coffee +++ b/app/assets/javascripts/darkswarm/services/enterprise_list_modal.js.coffee @@ -2,7 +2,6 @@ Darkswarm.factory "EnterpriseListModal", ($modal, $rootScope, $http, EnterpriseM new class EnterpriseListModal open: (enterprises)-> scope = $rootScope.$new(true) - scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1 scope.enterprises = enterprises scope.openModal = EnterpriseModal.open if Object.keys(enterprises).length > 1 diff --git a/app/assets/javascripts/darkswarm/services/map.js.coffee b/app/assets/javascripts/darkswarm/services/map.js.coffee index bd4f007b53..2758f299f8 100644 --- a/app/assets/javascripts/darkswarm/services/map.js.coffee +++ b/app/assets/javascripts/darkswarm/services/map.js.coffee @@ -6,7 +6,6 @@ Darkswarm.factory "OfnMap", (Enterprises, EnterpriseListModal, MapConfiguration) # Remove enterprises w/o lat or long enterprise.latitude != null || enterprise.longitude != null @enterprises = @enterprise_markers(@enterprises) - self = this enterprise_markers: (enterprises) -> @extend(enterprise) for enterprise in enterprises @@ -15,24 +14,26 @@ Darkswarm.factory "OfnMap", (Enterprises, EnterpriseListModal, MapConfiguration) hash[enterprise.id] = { id: enterprise.id, name: enterprise.name, icon: enterprise.icon_font } hash + extend_marker: (marker, enterprise) -> + marker.latitude = enterprise.latitude + marker.longitude = enterprise.longitude + marker.icon = enterprise.icon + marker.id = [enterprise.id] + marker.enterprises = @enterprise_hash({}, enterprise) + # Adding methods to each enterprise extend: (enterprise) -> marker = @coordinates[[enterprise.latitude, enterprise.longitude]] - self = this if marker marker.icon = MapConfiguration.options.cluster_icon - self.enterprise_hash(marker.enterprises, enterprise) + @enterprise_hash(marker.enterprises, enterprise) marker.id.push(enterprise.id) else marker = new class MapMarker # We cherry-pick attributes because GMaps tries to crawl # our data, and our data is cyclic, so it breaks - latitude: enterprise.latitude - longitude: enterprise.longitude - icon: enterprise.icon - id: [enterprise.id] - enterprises: self.enterprise_hash({}, enterprise) reveal: => EnterpriseListModal.open this.enterprises + @extend_marker(marker, enterprise) @coordinates[[enterprise.latitude, enterprise.longitude]] = marker marker diff --git a/app/assets/stylesheets/admin/openfoodnetwork.css.scss b/app/assets/stylesheets/admin/openfoodnetwork.css.scss index 6934805292..99f4a849bb 100644 --- a/app/assets/stylesheets/admin/openfoodnetwork.css.scss +++ b/app/assets/stylesheets/admin/openfoodnetwork.css.scss @@ -83,8 +83,6 @@ a.action--disabled { } form.order_cycle { - padding-bottom: 50px; - h2 { margin-top: 2em; }