mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Review Comments incorporation
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseBox, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
|
||||
Darkswarm.controller "EnterprisesCtrl", ($scope, $rootScope, $timeout, $location, Enterprises, Search, $document, HashNavigation, FilterSelectorsService, EnterpriseModal, enterpriseMatchesNameQueryFilter, distanceWithinKmFilter) ->
|
||||
$scope.Enterprises = Enterprises
|
||||
$scope.producers_to_filter = Enterprises.producers
|
||||
$scope.filterSelectors = FilterSelectorsService.createSelectors()
|
||||
$scope.query = Search.search()
|
||||
$scope.openModal = EnterpriseBox.open
|
||||
$scope.openModal = EnterpriseModal.open
|
||||
$scope.activeTaxons = []
|
||||
$scope.show_profiles = false
|
||||
$scope.show_closed = false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Darkswarm.controller "GroupEnterprisesCtrl", ($scope, Search, FilterSelectorsService, EnterpriseBox) ->
|
||||
Darkswarm.controller "GroupEnterprisesCtrl", ($scope, Search, FilterSelectorsService, EnterpriseModal) ->
|
||||
$scope.filterSelectors = FilterSelectorsService.createSelectors()
|
||||
$scope.query = Search.search()
|
||||
$scope.openModal = EnterpriseBox.open
|
||||
$scope.openModal = EnterpriseModal.open
|
||||
$scope.activeTaxons = []
|
||||
$scope.show_profiles = false
|
||||
$scope.filtersActive = false
|
||||
|
||||
@@ -7,4 +7,4 @@ Darkswarm.directive "enterpriseModal", (EnterpriseModal) ->
|
||||
elem.on "click", (event) =>
|
||||
event.stopPropagation()
|
||||
|
||||
scope.modalInstance = EnterpriseModal.open [scope.enterprise]
|
||||
scope.modalInstance = EnterpriseModal.open scope.enterprise
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
Darkswarm.factory "EnterpriseBox", ($modal, $rootScope, $http)->
|
||||
# Build a modal popup for an enterprise.
|
||||
new class EnterpriseBox
|
||||
open: (enterprise)->
|
||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||
scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1
|
||||
|
||||
$http.get("/api/shops/" + enterprise.id).success (data) ->
|
||||
scope.enterprise = data
|
||||
$modal.open(templateUrl: "enterprise_box.html", scope: scope)
|
||||
.error (data) ->
|
||||
console.error(data)
|
||||
@@ -0,0 +1,13 @@
|
||||
Darkswarm.factory "EnterpriseListModal", ($modal, $rootScope, $http, EnterpriseModal)->
|
||||
# Build a modal popup for an enterprise.
|
||||
new class EnterpriseListModal
|
||||
open: (enterprises)->
|
||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||
scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1
|
||||
scope.enterprises = enterprises
|
||||
scope.openModal = EnterpriseModal.open
|
||||
len = Object.keys(enterprises).length
|
||||
if len > 1
|
||||
$modal.open(templateUrl: "enterprise_list_modal.html", scope: scope)
|
||||
else
|
||||
EnterpriseModal.open enterprises[Object.keys(enterprises)[0]]
|
||||
@@ -1,13 +1,12 @@
|
||||
Darkswarm.factory "EnterpriseModal", ($modal, $rootScope, $http, EnterpriseBox)->
|
||||
Darkswarm.factory "EnterpriseModal", ($modal, $rootScope, $http)->
|
||||
# Build a modal popup for an enterprise.
|
||||
new class EnterpriseModal
|
||||
open: (enterprises)->
|
||||
open: (enterprise)->
|
||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||
scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1
|
||||
scope.enterprises = enterprises
|
||||
scope.EnterpriseBox = EnterpriseBox
|
||||
len = Object.keys(enterprises).length
|
||||
if len > 1
|
||||
|
||||
$http.get("/api/shops/" + enterprise.id).success (data) ->
|
||||
scope.enterprise = data
|
||||
$modal.open(templateUrl: "enterprise_modal.html", scope: scope)
|
||||
else
|
||||
EnterpriseBox.open enterprises[Object.keys(enterprises)[0]]
|
||||
.error (data) ->
|
||||
console.error(data)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Darkswarm.factory "OfnMap", (Enterprises, EnterpriseModal, MapConfiguration) ->
|
||||
Darkswarm.factory "OfnMap", (Enterprises, EnterpriseListModal, MapConfiguration) ->
|
||||
new class OfnMap
|
||||
constructor: ->
|
||||
@coordinates = {}
|
||||
@@ -7,9 +7,6 @@ Darkswarm.factory "OfnMap", (Enterprises, EnterpriseModal, MapConfiguration) ->
|
||||
enterprise.latitude != null || enterprise.longitude != null
|
||||
@enterprises = @enterprise_markers(@enterprises)
|
||||
self = this
|
||||
@enterprises = @enterprises.filter (enterprise) ->
|
||||
# Remove enterprises w/o lat or long
|
||||
enterprise.latitude != null || enterprise.longitude != null
|
||||
|
||||
enterprise_markers: (enterprises) ->
|
||||
@extend(enterprise) for enterprise in enterprises
|
||||
@@ -33,7 +30,7 @@ Darkswarm.factory "OfnMap", (Enterprises, EnterpriseModal, MapConfiguration) ->
|
||||
id: [enterprise.id]
|
||||
enterprises: self.enterprise_hash({}, enterprise)
|
||||
reveal: =>
|
||||
EnterpriseModal.open this.enterprises
|
||||
EnterpriseListModal.open this.enterprises
|
||||
@coordinates[[enterprise.latitude, enterprise.longitude]] = marker
|
||||
else
|
||||
marker.icon = MapConfiguration.options.cluster_icon
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
%ng-include{src: "'partials/enterprise_header.html'"}
|
||||
%ng-include{src: "'partials/enterprise_details.html'"}
|
||||
%ng-include{src: "'partials/hub_details.html'"}
|
||||
%ng-include{src: "'partials/producer_details.html'"}
|
||||
%ng-include{src: "'partials/close.html'"}
|
||||
@@ -0,0 +1,2 @@
|
||||
%ng-include{src: "'partials/enterprise_listing.html'"}
|
||||
%ng-include{src: "'partials/close.html'"}
|
||||
@@ -1,2 +1,5 @@
|
||||
%ng-include{src: "'partials/enterprise_listing.html'"}
|
||||
%ng-include{src: "'partials/enterprise_header.html'"}
|
||||
%ng-include{src: "'partials/enterprise_details.html'"}
|
||||
%ng-include{src: "'partials/hub_details.html'"}
|
||||
%ng-include{src: "'partials/producer_details.html'"}
|
||||
%ng-include{src: "'partials/close.html'"}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
.highlight-top.row.enterprise
|
||||
.small-12.medium-12.large-12.columns
|
||||
%h4
|
||||
%a.heading{"ng-click" => "::EnterpriseBox.open(enterprise)"}
|
||||
%a.heading{"ng-click" => "::openModal(enterprise)"}
|
||||
%i{"ng-class" => "enterprise.icon"}
|
||||
%span{"ng-bind" => "enterprise.name"}
|
||||
%img.hero-img{"ng-src" => "{{::enterprise.promo_image}}"}
|
||||
|
||||
@@ -332,11 +332,15 @@ feature '
|
||||
select 'My supplier', from: 'new_supplier_id'
|
||||
click_button 'Add supplier'
|
||||
expect(page).to have_selector("table.exchanges tr.supplier", text: "My supplier")
|
||||
page.all("table.exchanges tr.supplier td.products").each(&:click)
|
||||
|
||||
page.all("table.exchanges tr.supplier td.products").each do |tab|
|
||||
tab.click
|
||||
sleep 1
|
||||
end
|
||||
|
||||
expect(page).to have_selector "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}", visible: true
|
||||
page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}", visible: true).click # uncheck (with visible:true filter)
|
||||
expect(page).to have_selector "#order_cycle_incoming_exchange_2_variants_#{v1.id}", visible: true
|
||||
check "order_cycle_incoming_exchange_2_variants_#{v1.id}"
|
||||
check "order_cycle_incoming_exchange_2_variants_#{v2.id}"
|
||||
|
||||
@@ -886,6 +890,7 @@ feature '
|
||||
# Open the products list for managed_supplier's incoming exchange
|
||||
within "tr.distributor-#{distributor_managed.id}" do
|
||||
page.find("td.products").click
|
||||
sleep 3
|
||||
end
|
||||
|
||||
# I should be able to see and toggle v1
|
||||
|
||||
Reference in New Issue
Block a user