angular-foundation tabs directive on shop pages is closed by default

This commit is contained in:
Rob Harrington
2016-04-17 14:09:37 +10:00
parent 02be661163
commit fe739f6a8d
10 changed files with 27 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
Darkswarm.controller "ForgotCtrl", ($scope, $http, $location, AuthenticationService) ->
$scope.path = "/forgot"
$scope.active = $scope.isActive($scope.path)
$scope.sent = false
$scope.submit = ->

View File

@@ -1,5 +1,6 @@
Darkswarm.controller "LoginCtrl", ($scope, $http, $window, AuthenticationService, Redirections, Loading) ->
$scope.path = "/login"
$scope.active = $scope.isActive($scope.path)
$scope.submit = ->
Loading.message = t 'logging_in'

View File

@@ -1,5 +1,7 @@
Darkswarm.controller "SignupCtrl", ($scope, $http, $window, $location, Redirections, AuthenticationService) ->
$scope.path = "/signup"
$scope.active = $scope.isActive($scope.path)
$scope.errors =
email: null
password: null

View File

@@ -3,5 +3,5 @@ Darkswarm.controller "AuthenticationCtrl", ($scope, AuthenticationService, Spree
$scope.toggle = AuthenticationService.toggle
$scope.spree_user = SpreeUser.spree_user
$scope.active = AuthenticationService.active
$scope.isActive = AuthenticationService.isActive
$scope.select = AuthenticationService.select

View File

@@ -22,7 +22,7 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir
@selectedPath = path
Navigation.navigate @selectedPath
active: Navigation.active
isActive: Navigation.isActive
close: ->
if location.pathname in ["/", "/checkout"]

View File

@@ -1,9 +1,9 @@
Darkswarm.factory 'Navigation', ($location, $window) ->
new class Navigation
path: null
path: null
active: (path)->
$location.path() == path
isActive: (path)->
$location.path() == path
navigate: (path)=>
@path = path

View File

@@ -1,6 +1,6 @@
%tab#forgot{"ng-controller" => "ForgotCtrl",
heading: "{{'forgot_password' | t}}",
active: "active(path)",
active: "active",
select: "select(path)"}
%form{"ng-submit" => "submit()"}
@@ -13,18 +13,18 @@
%div{"ng-show" => "!sent"}
.alert-box.alert{"ng-show" => "errors != null"}
{{ errors }}
.row
.large-12.columns
%label{for: "email"} {{'signup_email' | t}}
%input.title.input-text{name: "email",
%input.title.input-text{name: "email",
type: "email",
id: "email",
tabindex: 1,
"ng-model" => "spree_user.email"}
.row
.large-12.columns
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
value: "{{'reset_password' | t}}"}

View File

@@ -1,6 +1,6 @@
%tab#login-content{"ng-controller" => "LoginCtrl",
%tab#login-content{"ng-controller" => "LoginCtrl",
heading: "{{'label_login' | t}}",
active: "active(path)",
active: "active",
select: "select(path)"}
%form{"ng-submit" => "submit()"}
.row
@@ -10,7 +10,7 @@
.row
.large-12.columns
%label{for: "email"} {{'email' | t}}
%input.title.input-text{name: "email",
%input.title.input-text{name: "email",
type: "email",
id: "email",
tabindex: 1,
@@ -18,7 +18,7 @@
.row
.large-12.columns
%label{for: "password"} {{'password' | t}}
%input.title.input-text{name: "password",
%input.title.input-text{name: "password",
type: "password",
id: "password",
autocomplete: "off",
@@ -26,15 +26,15 @@
"ng-model" => "spree_user.password"}
.row
.large-12.columns
%input{name: "remember_me",
type: "checkbox",
id: "remember_me",
%input{name: "remember_me",
type: "checkbox",
id: "remember_me",
value: "1",
"ng-model" => "spree_user.remember_me"}
%label{for: "remember_me"} {{'remember_me' | t}}
.row
.large-12.columns
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
%input.button.primary{name: "commit",
tabindex: "3",
type: "submit",
value: "{{'label_login' | t}}"}

View File

@@ -1,6 +1,6 @@
%tab#sign-up-content{"ng-controller" => "SignupCtrl",
heading: "{{'label_signup' | t}}",
active: "active(path)",
active: 'active',
select: "select(path)"}
%form{"ng-submit" => "submit()"}
.row

View File

@@ -1,6 +1,6 @@
#tabs{"ng-controller" => "TabsCtrl", "ng-cloak" => true}
.row
%tabset
%tabset{ 'open-on-load' => 'false' }
-# Build all tabs.
- for name, heading_cols in { about: [t(:shopping_tabs_about, distributor: current_distributor.name), 6],
producers: [t(:label_producers),2],
@@ -10,7 +10,6 @@
- heading, cols = heading_cols
%tab.columns{heading: heading,
id: "tab_#{name}",
active: "active(\'#{name}\')",
select: "toggle(\'#{name}\')",
class: "small-12 medium-#{cols}" }
= render "shopping_shared/#{name}"