Skip to content

Commit

Permalink
Move error messages out of a directive
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Nov 3, 2012
1 parent 288ee0b commit 51f2a7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ angular.module('app').constant('MONGOLAB_CONFIG', {
angular.module('app').constant('I18N.MESSAGES', {
'errors.route.changeError':'Route change error',
'crud.user.save.success':"A user with id '{{id}}' was saved successfully.",
'crud.user.save.error':"Something went wrong when saving a user..."
'crud.user.save.error':"Something went wrong when saving a user...",
'login.error.notAuthorized':"You do not have the necessary access permissions. Do you want to login as someone else?",
'login.error.notAuthenticated':"You must be logged in to access this part of the application."
});

angular.module('app').config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
Expand Down
6 changes: 3 additions & 3 deletions src/app/login/login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('login', ['services.authentication', 'directives.modal']).directive('loginForm', ['AuthenticationService', 'currentUser', function(AuthenticationService, currentUser) {
angular.module('login', ['services.authentication', 'services.localizedMessages', 'directives.modal']).directive('loginForm', ['AuthenticationService', 'localizedMessages', 'currentUser', function(AuthenticationService, localizedMessages, currentUser) {
var directive = {
templateUrl: 'login/form.tpl.html',
restrict: 'E',
Expand Down Expand Up @@ -39,9 +39,9 @@ angular.module('login', ['services.authentication', 'directives.modal']).directi
case 'unauthorized-client':
case 'unauthorized-server':
if ( isAuthenticated ) {
message = "You do not have the necessary access permissions. Do you want to login as someone else?";
message = localizedMessages.get('login.error.notAuthorized');
} else {
message = "You must be logged in to access this part of the application.";
message = localizedMessages.get('login.error.notAuthenticated');
}
break;
default:
Expand Down

0 comments on commit 51f2a7d

Please sign in to comment.