Skip to content

Commit

Permalink
app: moved roc wait action to app.controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
kylefinley committed Sep 11, 2012
1 parent e78b3b1 commit 8d83f9b
Showing 1 changed file with 37 additions and 26 deletions.
63 changes: 37 additions & 26 deletions app/scripts/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,45 @@

// Define the application level controllers
angular.module('app.controllers', [])
// the AppCtrl is used in index.html (see app/assets/index.jade)
.controller('AppCtrl',
['$scope',
'$location',

function ($scope, $location) {
// Uses the url to determine if the selected
// menu item should have the class active.
$scope.$location = $location;
$scope.$watch('$location.path()', function (path) {
$scope.activeNavId = path || '/';
}
);

// getClass compares the current url with the id.
// If the current url starts with the id it returns 'active'
// otherwise it will return '' an empty string. E.g.
//
// # current url = '/products/1'
// getClass('/products') # returns 'active'
// getClass('/orders') # returns ''
$scope.getClass = function (id) {
if($scope.activeNavId.substring(0, id.length) == id)
return 'active';
else
return '';
// the AppCtrl is used in index.html (see app/assets/index.html)
.controller('AppCtrl', [
'$scope',
'$location',

function ($scope, $location) {

// TODO moved these to directives

// 'rpc.status' is a channel used to broadcast messages. It's defined in rpc/services.js
$scope.$on('rpc.status', function (e, d) {
if (d === 'waiting')
$scope.WaitText = 'Working...';
else
$scope.WaitText = false;
});

// Uses the url to determine if the selected
// menu item should have the class active.
$scope.$location = $location;
$scope.$watch('$location.path()', function (path) {
$scope.activeNavId = path || '/';
}
);

// getClass compares the current url with the id.
// If the current url starts with the id it returns 'active'
// otherwise it will return '' an empty string. E.g.
//
// # current url = '/products/1'
// getClass('/products') # returns 'active'
// getClass('/orders') # returns ''
$scope.getClass = function (id) {
if($scope.activeNavId.substring(0, id.length) == id)
return 'active';
else
return '';
}
}
])

// Just placeholders controllers. To be filled with your own logic.
Expand Down

0 comments on commit 8d83f9b

Please sign in to comment.