From b7f28c8d82248ded01443a190b75164ea1638ffc Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Fri, 25 Apr 2014 12:11:09 +1000 Subject: [PATCH] Popup dialog when changing hub: --- .../darkswarm/controllers/hub_node_controller.js.coffee | 4 ++++ .../javascripts/darkswarm/services/navigation.js.coffee | 3 +++ app/views/home/_fat.html.haml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee index c53d61e4d3..f17d985434 100644 --- a/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/hub_node_controller.js.coffee @@ -11,6 +11,10 @@ Darkswarm.controller "HubNodeCtrl", ($scope, Navigation, $location, $anchorScrol $scope.emptiesCart = -> CurrentHub.id isnt undefined and !$scope.current() + $scope.changeHub = -> + if confirm "Are you sure? This will change your selected Hub and remove any items in you shopping cart." + Navigation.go $scope.hub.path + if $scope.open() $anchorScroll() diff --git a/app/assets/javascripts/darkswarm/services/navigation.js.coffee b/app/assets/javascripts/darkswarm/services/navigation.js.coffee index 53d3c1a38f..923aa9cf0d 100644 --- a/app/assets/javascripts/darkswarm/services/navigation.js.coffee +++ b/app/assets/javascripts/darkswarm/services/navigation.js.coffee @@ -9,3 +9,6 @@ Darkswarm.factory 'Navigation', ($location) -> $location.path("/") else $location.path(@path) + + go: (path)-> + window.location.pathname = path diff --git a/app/views/home/_fat.html.haml b/app/views/home/_fat.html.haml index fe3898773b..c7901da91b 100644 --- a/app/views/home/_fat.html.haml +++ b/app/views/home/_fat.html.haml @@ -19,7 +19,7 @@ %a{"bo-href" => "hub.path", "ng-show" => "!emptiesCart()"} Shop at %strong {{ hub.name }} - %a{"bo-href" => "hub.path", "ng-show" => "emptiesCart()"} + %a{"ng-click" => "changeHub()", "ng-show" => "emptiesCart()"} Change hub to %strong {{ hub.name }}