Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Em prof injection fix #392

Merged
merged 5 commits into from
Feb 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion client/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
<img class="img-navbar-avatar" src="images/img-demo.png">
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown"> {{user_first}} {{user_last}} <span class="caret"></span></a>
<a class="button dropdown-toggle" data-toggle="dropdown">
<span username></span>
<span class="caret"></span>

</a>
<ul class="dropdown-menu" role="menu">
<li><a href="#/profile">My Profile</a></li>
<li><a href="#/account">My Account</a></li>
Expand Down Expand Up @@ -184,6 +188,7 @@ <h6>Made by Amida Technology Solutions | Licensed under Creative Commons</h6>
<script src="scripts/services/login.js"></script>
<script src="scripts/services/logout.js"></script>
<script src="scripts/directives/profile.js"></script>
<script src="scripts/directives/username.js"></script>
<script src="scripts/controllers/files.js"></script>
<script src="scripts/services/files.js"></script>
<script src="scripts/directives/breadcrumb.js"></script>
Expand Down
12 changes: 1 addition & 11 deletions client/app/scripts/controllers/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,12 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('AccountCtrl', function ($scope, $location, profile) {
.controller('AccountCtrl', function ($scope, $location) {

$scope.resetPassword = function () {
$location.path('/home');

};

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}

showUserInfo();

});
12 changes: 1 addition & 11 deletions client/app/scripts/controllers/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* # BillingClaimsCtrl
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp').controller('BillingCtrl', function($scope, $location, $anchorScroll, claims, insurance, format, profile, billing) {
angular.module('phrPrototypeApp').controller('BillingCtrl', function($scope, $location, $anchorScroll, claims, insurance, format, billing) {
$scope.entryType = 'all';
$scope.masterEntries = [];
$scope.entries = [];
Expand All @@ -15,16 +15,6 @@ angular.module('phrPrototypeApp').controller('BillingCtrl', function($scope, $lo
'starred': false
};

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}
showUserInfo();

function getUpdateDate() {
//Should grab from files/update history. Stubbed for now.
$scope.updateDate = '12/1/2014';
Expand Down
12 changes: 1 addition & 11 deletions client/app/scripts/controllers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('FilesCtrl', function ($scope, files, profile) {
.controller('FilesCtrl', function ($scope, files) {



Expand Down Expand Up @@ -59,15 +59,5 @@ angular.module('phrPrototypeApp')
}
};

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}

showUserInfo();

});
21 changes: 1 addition & 20 deletions client/app/scripts/controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,13 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('HomeCtrl', function($scope, history, record, profile) {
.controller('HomeCtrl', function($scope, history, record) {

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
//$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}

showUserInfo();

$scope.accountHistory = {
"lastLogin": "01/01/2980"
};
$scope.noteCount = 0;
$scope.user_first = '';

function countNotes() {
//notes.noteCount(function(err, results) {
Expand All @@ -42,14 +31,6 @@ angular.module('phrPrototypeApp')
countNotes();
//countUpdates();

function showUser() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
});
}

showUser();


function getHistory() {
history.getHistory(function(err, history) {
Expand Down
14 changes: 2 additions & 12 deletions client/app/scripts/controllers/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('NavbarCtrl', function($rootScope, $scope, $location, authentication, logout, profile) {
.controller('NavbarCtrl', function($rootScope, $scope, $location, authentication, logout) {

$scope.loginStatus = false;

Expand All @@ -33,24 +33,14 @@ angular.module('phrPrototypeApp')
checkAuthStatus();
});

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
//$scope.email = profileInfo.email[0].email;
});
}

showUserInfo();


//TODO: isValid is not used??
$scope.logout = function(isValid) {
console.log("navbar controller, logout()", isValid);
logout.logout(function(err) {
if (err) {
$scope.error = err;
} else {
// $scope.loginStatus = false;
$location.path('/');
}
});
Expand Down
13 changes: 1 addition & 12 deletions client/app/scripts/controllers/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* # NotesCtrl
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp').controller('NotesCtrl', function($scope, notes, profile) {
angular.module('phrPrototypeApp').controller('NotesCtrl', function($scope, notes) {

$scope.notes = [];

Expand Down Expand Up @@ -94,16 +94,5 @@ angular.module('phrPrototypeApp').controller('NotesCtrl', function($scope, notes
}
};

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}

showUserInfo();

getNotes();
});
11 changes: 7 additions & 4 deletions client/app/scripts/controllers/pagetitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('titleController', function ($rootScope, $scope, $location) {

$scope.user_first="Kevin";
$scope.user_last="Bacon";
.controller('titleController', function ($rootScope, $scope, $location, profile) {

// profile.getProfile(function(err, profileInfo) {
// if (profileInfo.name.first) {
// $scope.user_first = profileInfo.name.first;
// $scope.user_last = profileInfo.name.last;
// }
// });

$scope.pageTitle = 'My PHR';
var routeMap = {
Expand Down
7 changes: 1 addition & 6 deletions client/app/scripts/controllers/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ angular.module('phrPrototypeApp')
if (profileInfo.dob.date) {
var tmpDOB = moment(profileInfo.dob.date).format('YYYY-MM-DD');
$scope.profile.dob = tmpDOB;
} else {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
}
}
});
}

Expand Down
13 changes: 1 addition & 12 deletions client/app/scripts/controllers/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@
* # RecordCtrl
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp').controller('RecordCtrl', function($scope, $window, record, format, profile) {
angular.module('phrPrototypeApp').controller('RecordCtrl', function($scope, $window, record, format) {

function showUserInfo() {
profile.getProfile(function(err, profileInfo) {
$scope.user_first = profileInfo.name.first;
$scope.user_last = profileInfo.name.last;
$scope.user_email = profileInfo.email[0].email;
$scope.user_dob = profileInfo.dob;
});
}

showUserInfo();

function pageRender(data) {
$scope.dashMetrics = {};
$scope.tabs = [{
Expand Down
2 changes: 1 addition & 1 deletion client/app/scripts/controllers/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Controller of the phrPrototypeApp
*/
angular.module('phrPrototypeApp')
.controller('RegisterCtrl', function($scope, $location, registration, login, profile, username) {
.controller('RegisterCtrl', function($scope, $location, registration, login, username) {

$scope.step = 0;

Expand Down
12 changes: 8 additions & 4 deletions client/app/scripts/directives/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ angular.module('phrPrototypeApp')
//$scope.user_first="blah";

profile.getProfile(function(err, profileInfo) {
scope.user_first = profileInfo.name.first;
scope.user_last = profileInfo.name.last;
//scope.user_email = profileInfo.email[0].email;
scope.user_dob = profileInfo.dob;
if (profileInfo) {
if (!angular.isUndefined(profileInfo.email)) {
scope.user_email = profileInfo.email[0].email;
}
if (profileInfo.dob) {
scope.user_dob = profileInfo.dob;
}
}
});

}
Expand Down
28 changes: 28 additions & 0 deletions client/app/scripts/directives/username.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

/**
* @ngdoc directive
* @name phrPrototypeApp.directive:username
* @description
* # username
*/
angular.module('phrPrototypeApp')
.directive('username', function(profile) {


return {
template: '{{user_first}} {{user_last}}',
restrict: 'EA',
link: function postLink(scope, element, attrs) {
//$scope.user_first="blah";

profile.getProfile(function(err, profileInfo) {
if (profileInfo&&!angular.isUndefined(profileInfo.name)) {
scope.user_first = profileInfo.name.first;
scope.user_last = profileInfo.name.last;
}
});

}
};
});
1 change: 1 addition & 0 deletions client/app/scripts/services/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ angular.module('phrPrototypeApp')
.success(function(data) {
if (data && data.authenticated){
callback(null, true);
// console.log(data, data.authenticated);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion client/app/scripts/services/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ angular.module('phrPrototypeApp')

$http.post('api/v1/logout')
.success(function() {
console.log("logout successfull");
console.log("logout successful");
//$rootScope.isAuthenticated = false;
//$location.path('/home');
callback(null);
Expand Down
11 changes: 6 additions & 5 deletions client/app/views/templates/profile.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<div class="profile">
<div class="profile-body">
<div class="profile-image">
<img class="img-responsive center-block" src="images/img-demo.png"></div>
<img class="img-responsive center-block" src="images/img-demo.png">
</div>
<div class="profile-content">
<h4>{{user_first}} {{user_last}}</h4>
<p>{{user_email}}</p>
<p>Born: {{user_dob}}</p>
<h4 username></h4>
<p ng-show="user_email">{{user_email}}</p>
<p ng-show="user_dob">Born: {{user_dob}}</p>
</div>
</div>
</div>
</div>