mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Smooth scrolling, svg support via directive
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $anchorScroll, $rootScope, HashNavigation) ->
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $document, $rootScope, HashNavigation) ->
|
||||
$scope.Hubs = Hubs
|
||||
$scope.hubs = Hubs.hubs
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Darkswarm.directive "renderSvg", ()->
|
||||
restrict: 'E'
|
||||
priority: 99
|
||||
template: "<svg-wrapper></svg-wrapper>"
|
||||
link: (scope, elem, attr)->
|
||||
if /.svg/.test attr.path # Only do this if we've got an svg
|
||||
$.ajax
|
||||
url: attr.path
|
||||
success: (html)->
|
||||
elem.html($(html).find("svg"))
|
||||
@@ -4,5 +4,7 @@ Darkswarm.directive 'scrollAfterLoad', ($timeout, $location, $document)->
|
||||
if scope.$last is true
|
||||
$(window).load ->
|
||||
$timeout ->
|
||||
$document.scrollTo $("##{$location.hash()}"), 100, 200, (x)->
|
||||
x * (2 - x)
|
||||
elem = $("##{$location.hash()}")
|
||||
if elem.length > 0
|
||||
$document.scrollTo elem , 100, 200, (x)->
|
||||
x * (2 - x)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Shop for
|
||||
%p.trans-sentence
|
||||
%span.fat-taxons{"ng-repeat" => "taxon in hub.taxons"}
|
||||
%object.taxon{"ng-attr-data" => "{{taxon.icon}}", type: "image/svg+xml"}
|
||||
%render-svg{path: "{{taxon.icon}}"}
|
||||
{{taxon.name}}
|
||||
.columns.small-4
|
||||
%h5 Delivery options
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
%img{"bo-src" => "product.master.images[0].small_url"}
|
||||
|
||||
.small-4.columns.summary-header
|
||||
%object.taxon{"ng-attr-data" => "{{product.primary_taxon.icon}}", type: "image/svg+xml",
|
||||
"ng-click" => "ordering.order = 'primary_taxon.name'"}
|
||||
{{taxon.name}}
|
||||
%render-svg{path: "{{product.primary_taxon.icon}}"}
|
||||
= render partial: "modals/product"
|
||||
|
||||
.small-5.columns
|
||||
|
||||
@@ -36,6 +36,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
exchange.variants << product.master
|
||||
|
||||
visit shop_path
|
||||
save_screenshot "/users/willmarshall/Desktop/wtsvg.png"
|
||||
find("#tab_producers a").click
|
||||
page.should have_content supplier.name
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user