Removing some garbage, adding admin link

This commit is contained in:
Will Marshall
2014-05-08 11:24:37 +10:00
parent a7ef1295e4
commit d5648bd993
5 changed files with 25 additions and 51 deletions

View File

@@ -1,15 +0,0 @@
Darkswarm.controller "AccountSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
$scope.path = "/account"
Navigation.paths.push $scope.path
$scope.active = ->
$location.path() == $scope.path
$scope.select = ->
Navigation.navigate($scope.path)
$scope.emptyCart = (href, ev)->
if $(ev.delegateTarget).hasClass "empties-cart"
location.href = href if confirm "Changing your Hub will clear your cart."
else
location.href = href

View File

@@ -1,2 +0,0 @@
Darkswarm.controller "SidebarCtrl", ($scope, $location, Sidebar) ->
$scope.Sidebar = Sidebar

View File

@@ -1,20 +1,20 @@
#account{"ng-controller" => "AccountSidebarCtrl"}
.row
.panel
%p
%strong= link_to "Manage my account", account_path
- if enterprise_user?
%strong= link_to "Enterprise admin", admin_path
- if order = last_completed_order
%dl
%dt Current Hub:
%dd= link_to current_distributor.name, main_app.shop_path
%br
%dt Last hub:
%dd
- if order.distributor != current_distributor
= link_to "#{order.distributor.name}".html_safe, "",
{class: distributor_link_class(order.distributor),
"ng-click" => "emptyCart('#{main_app.shop_enterprise_path(order.distributor)}', $event)"}
- else
= order.distributor.name
-##account{"ng-controller" => "AccountSidebarCtrl"}
-#.row
-#.panel
-#%p
-#%strong= link_to "Manage my account", account_path
-#- if enterprise_user?
-#%strong= link_to "Enterprise admin", admin_path
-#- if order = last_completed_order
-#%dl
-#%dt Current Hub:
-#%dd= link_to current_distributor.name, main_app.shop_path
-#%br
-#%dt Last hub:
-#%dd
-#- if order.distributor != current_distributor
-#= link_to "#{order.distributor.name}".html_safe, "",
-#{class: distributor_link_class(order.distributor),
-#"ng-click" => "emptyCart('#{main_app.shop_enterprise_path(order.distributor)}', $event)"}
-#- else
-#= order.distributor.name

View File

@@ -19,6 +19,11 @@
%a
%span.nav-primary{href: ""} Groups
%li.divider
- if spree_current_user.andand.has_spree_role? 'admin'
%li
%a
%span.nav-primary{href: spree_admin_path} Admin
%li.divider
%section.top-bar-section
%ul.right{"ng-controller" => "AuthenticationCtrl"}
%li.divider

View File

@@ -1,14 +0,0 @@
describe "SidebarCtrl", ->
ctrl = null
scope = null
location = null
beforeEach ->
module("Darkswarm")
location =
path: ->
"/login"
inject ($controller, $rootScope) ->
scope = $rootScope
ctrl = $controller 'SidebarCtrl', {$scope: scope, $location: location}
scope.$apply()