More optimsations: removing unwanted code

This commit is contained in:
Manvil George
2020-05-07 22:58:09 +10:00
parent a629e1ecb7
commit 63a1a6fefa
3 changed files with 9 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -83,8 +83,6 @@ a.action--disabled {
}
form.order_cycle {
padding-bottom: 50px;
h2 {
margin-top: 2em;
}