From 3cb182fb53ec0d7f79b8e1006e42a58dbf2b2fb3 Mon Sep 17 00:00:00 2001 From: Verabird Date: Fri, 23 Jan 2015 12:02:32 -0500 Subject: [PATCH 1/3] Add dateFormat choice to charts and other hardcoded MM/DD/YYYY --- public/js/controllers/groupsCtrl.js | 2 +- public/js/controllers/rootCtrl.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/controllers/groupsCtrl.js b/public/js/controllers/groupsCtrl.js index 376c25d810..e43742bbde 100644 --- a/public/js/controllers/groupsCtrl.js +++ b/public/js/controllers/groupsCtrl.js @@ -111,7 +111,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' .controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', function($scope, $rootScope, Members, Shared, $http, Notification, Groups) { $scope.timestamp = function(timestamp){ - return moment(timestamp).format('MM/DD/YYYY'); + return moment(timestamp).format(User.user.preferences.dateFormat.toUpperCase()); } // We watch Members.selectedMember because it's asynchronously set, so would be a hassle to handle updates here $scope.$watch( function() { return Members.selectedMember; }, function (member) { diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index 9360daf469..d708545679 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -166,7 +166,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ } matrix = [['Date', 'Score']]; _.each(history, function(obj) { - matrix.push([moment(obj.date).format('MM/DD/YY'), obj.value]); + matrix.push([moment(obj.date).format(User.user.preferences.dateFormat.toUpperCase()), obj.value]); }); data = google.visualization.arrayToDataTable(matrix); options = { From fecba8f9f50bd0ba93eaa7e73b11ee02f48dd02f Mon Sep 17 00:00:00 2001 From: Verabird Date: Fri, 23 Jan 2015 13:19:59 -0500 Subject: [PATCH 2/3] Shorten dateFormat string in graphs --- public/js/controllers/rootCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index d708545679..7602d51dd7 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -166,7 +166,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ } matrix = [['Date', 'Score']]; _.each(history, function(obj) { - matrix.push([moment(obj.date).format(User.user.preferences.dateFormat.toUpperCase()), obj.value]); + matrix.push([moment(obj.date).format(User.user.preferences.dateFormat.toUpperCase().replace('YYYY','YY') ), obj.value]); }); data = google.visualization.arrayToDataTable(matrix); options = { From d7b0bd5b7203d0e0dca69cf7cfe8046d595b6985 Mon Sep 17 00:00:00 2001 From: Verabird Date: Wed, 4 Feb 2015 20:15:18 -0500 Subject: [PATCH 3/3] Add access to .User in MemberModalCtrl --- public/js/controllers/groupsCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/controllers/groupsCtrl.js b/public/js/controllers/groupsCtrl.js index e43742bbde..c911b1e2f2 100644 --- a/public/js/controllers/groupsCtrl.js +++ b/public/js/controllers/groupsCtrl.js @@ -111,7 +111,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' .controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', function($scope, $rootScope, Members, Shared, $http, Notification, Groups) { $scope.timestamp = function(timestamp){ - return moment(timestamp).format(User.user.preferences.dateFormat.toUpperCase()); + return moment(timestamp).format($rootScope.User.user.preferences.dateFormat.toUpperCase()); } // We watch Members.selectedMember because it's asynchronously set, so would be a hassle to handle updates here $scope.$watch( function() { return Members.selectedMember; }, function (member) {