Removing ng-animate, changing our enterprise restriction

This commit is contained in:
Will Marshall
2014-06-26 14:36:16 +10:00
parent a1789a8058
commit 8862fd555c
8 changed files with 17 additions and 7 deletions

View File

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

View File

@@ -6,7 +6,6 @@ window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'angular-flash.service',
'templates',
'ngSanitize',
'ngAnimate',
'google-maps',
'duScroll',
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->

View File

@@ -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'])

View File

@@ -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 = {})

View File

@@ -1,3 +1,7 @@
class Api::AddressSerializer < ActiveModel::Serializer
attributes :id
attributes :id, :zipcode, :city, :state
def state
object.state.abbr
end
end

View File

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

View File

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

View File

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