Scroll past header on shops page if user is logged in

This commit is contained in:
Rohan Mitchell
2015-06-25 12:24:13 +10:00
parent 4da367a94b
commit 9f8fa575b3
3 changed files with 9 additions and 11 deletions

View File

@@ -2,10 +2,9 @@ Darkswarm.directive 'scrollAfterLoad', ($timeout, $location, $document)->
# Scroll to an element on page load
restrict: "A"
link: (scope, element, attr) ->
if scope.$last is true
$(window).load ->
$timeout ->
elem = $("##{$location.hash()}")
if elem.length > 0
$document.scrollTo elem , 100, 200, (x)->
x * (2 - x)
elem = element
$(window).load ->
$timeout ->
if elem?
$document.scrollTo elem, 100, 200, (x) ->
x * (2 - x)

View File

@@ -1,8 +1,9 @@
= inject_enterprises
= inject_enterprises
#hubs.hubs{"ng-controller" => "EnterprisesCtrl"}
.row
.small-12.columns
%h1 Shop in your local area
%h1{"scroll-after-load" => (spree_current_user ? true : nil)} Shop in your local area
= render partial: "shared/components/enterprise_search"
= render partial: "home/filters"
@@ -12,7 +13,6 @@
.active_table
%hub.active_table_node.row.animate-repeat{"ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | visible | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | showHubProfiles:show_profiles | orderBy:['-active', '+orders_close_at'])",
"ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
"scroll-after-load" => true,
"ng-controller" => "HubNodeCtrl",
id: "{{hub.hash}}"}
.small-12.columns

View File

@@ -15,7 +15,6 @@
.small-12.columns
.active_table
%producer.active_table_node.row.animate-repeat{id: "{{producer.path}}",
"scroll-after-load" => true,
"ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | visible | searchEnterprises:query | taxons:activeTaxons)",
"ng-controller" => "ProducerNodeCtrl",
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}",