mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Removing ng-animate, changing our enterprise restriction
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $document, $rootScope, HashNavigation) ->
|
||||
$scope.Hubs = Hubs
|
||||
$scope.hubs = Hubs.hubs
|
||||
$scope.hubs = Hubs.visible
|
||||
|
||||
$rootScope.$on "$locationChangeSuccess", (newRoute, oldRoute) ->
|
||||
if HashNavigation.active "hubs"
|
||||
|
||||
@@ -6,7 +6,6 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource",
|
||||
'angular-flash.service',
|
||||
'templates',
|
||||
'ngSanitize',
|
||||
'ngAnimate',
|
||||
'google-maps',
|
||||
'duScroll',
|
||||
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
|
||||
|
||||
@@ -3,6 +3,8 @@ Darkswarm.factory 'Hubs', ($filter, Enterprises) ->
|
||||
constructor: ->
|
||||
@hubs = @order Enterprises.enterprises.filter (hub)->
|
||||
hub.is_distributor
|
||||
@visible = @hubs.filter (hub)->
|
||||
hub.visible
|
||||
|
||||
order: (hubs)->
|
||||
$filter('orderBy')(hubs, ['-active', '+orders_close_at'])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module SharedHelper
|
||||
def inject_enterprises
|
||||
inject_json_ams "enterprises", Enterprise.visible, Api::EnterpriseSerializer, active_distributors: @active_distributors
|
||||
inject_json_ams "enterprises", Enterprise.all, Api::EnterpriseSerializer, active_distributors: @active_distributors
|
||||
end
|
||||
|
||||
def inject_json(name, partial, opts = {})
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
class Api::AddressSerializer < ActiveModel::Serializer
|
||||
attributes :id
|
||||
attributes :id, :zipcode, :city, :state
|
||||
|
||||
def state
|
||||
object.state.abbr
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Api::EnterpriseSerializer < ActiveModel::Serializer
|
||||
attributes :name, :id, :description, :latitude, :longitude,
|
||||
:long_description, :website, :instagram, :linkedin, :twitter,
|
||||
:facebook, :is_primary_producer, :is_distributor, :phone,
|
||||
:facebook, :is_primary_producer, :is_distributor, :phone, :visible,
|
||||
:email, :hash, :logo, :promo_image, :icon, :path,
|
||||
:pickup, :delivery, :active, :orders_close_at
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
.row{bindonce: true}
|
||||
.small-12.columns
|
||||
.active_table
|
||||
%producer.active_table_node.row{id: "{{producer.path}}",
|
||||
%producer.active_table_node.row.animate-repeat{id: "{{producer.path}}",
|
||||
"scroll-after-load" => true,
|
||||
"ng-repeat" => "producer in filteredProducers = (Producers.producers | filterProducers:query)",
|
||||
"ng-controller" => "ProducerNodeCtrl",
|
||||
|
||||
@@ -5,6 +5,7 @@ feature 'Home', js: true do
|
||||
include UIComponentHelper
|
||||
|
||||
let!(:distributor) { create(:distributor_enterprise) }
|
||||
let!(:invisible_distributor) { create(:distributor_enterprise, visible: false) }
|
||||
let(:d1) { create(:distributor_enterprise) }
|
||||
let(:d2) { create(:distributor_enterprise) }
|
||||
let!(:order_cycle) { create(:order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) }
|
||||
@@ -15,12 +16,16 @@ feature 'Home', js: true do
|
||||
visit "/"
|
||||
end
|
||||
|
||||
it "shows all hubs" do
|
||||
it "shows hubs" do
|
||||
page.should have_content distributor.name
|
||||
expand_active_table_node distributor.name
|
||||
page.should have_content "Shop at #{distributor.name}"
|
||||
end
|
||||
|
||||
it "does not show invisible hubs" do
|
||||
page.should_not have_content invisible_distributor.name
|
||||
end
|
||||
|
||||
it "should grey out hubs that are not in an order cycle" do
|
||||
create(:simple_product, distributors: [d1, d2])
|
||||
visit root_path
|
||||
|
||||
Reference in New Issue
Block a user