Fixed task push text and move ctrlPressed logic to rootScope.

This commit is contained in:
Keith Holliday
2015-11-28 12:06:34 -06:00
parent 274f4ab4d2
commit 0dcba276a6
4 changed files with 19 additions and 19 deletions

View File

@@ -88,8 +88,7 @@
"fortifyText": "Fortify will return all your tasks to a neutral (yellow) state, as if you'd just added them, and top your Health off to full. This is great if all your red tasks are making the game too hard, or all your blue tasks are making the game too easy. If starting fresh sounds much more motivating, spend the Gems and catch a reprieve!", "fortifyText": "Fortify will return all your tasks to a neutral (yellow) state, as if you'd just added them, and top your Health off to full. This is great if all your red tasks are making the game too hard, or all your blue tasks are making the game too easy. If starting fresh sounds much more motivating, spend the Gems and catch a reprieve!",
"sureDelete": "Are you sure you want to delete this task?", "sureDelete": "Are you sure you want to delete this task?",
"streakCoins": "Streak Bonus!", "streakCoins": "Streak Bonus!",
"pushTaskToTop": "Push task to top", "pushTaskToTop": "Push task to top. Hold ctrl or cmd to push to bottom.",
"pushTaskToBottom": "Push task to bottom. Hold ctrl or cmd to push to top.",
"emptyTask": "Enter the task's title first.", "emptyTask": "Enter the task's title first.",
"dailiesRestingInInn": "You're Resting in the Inn! Your Dailies will NOT hurt you tonight, but they WILL still refresh every day. If you're in a quest, you won't deal damage/collect items until you check out of the Inn, but you can still be injured by a Boss if your Party mates skip their own Dailies.", "dailiesRestingInInn": "You're Resting in the Inn! Your Dailies will NOT hurt you tonight, but they WILL still refresh every day. If you're in a quest, you won't deal damage/collect items until you check out of the Inn, but you can still be injured by a Boss if your Party mates skip their own Dailies.",
"habitHelp1": "Good Habits are things that you do often. They award Gold and Experience every time you click the <%= plusIcon %>.", "habitHelp1": "Good Habits are things that you do often. They award Gold and Experience every time you click the <%= plusIcon %>.",

View File

@@ -327,5 +327,19 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
}); });
// error will be handled via $http interceptor // error will be handled via $http interceptor
} }
// Global Keyevents
var ctrlKeys = [17, 224, 91];
$scope.$on("habit:keydown", function (e, keyEvent) {
if (ctrlKeys.indexOf(keyEvent.keyCode) !== -1) {
$scope.ctrlPressed = true;
}
});
$scope.$on("habit:keyup", function (e, keyEvent) {
if (ctrlKeys.indexOf(keyEvent.keyCode) !== -1) {
$scope.ctrlPressed = false;
}
});
} }
]); ]);

View File

@@ -76,23 +76,10 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
* Pushes task to top or bottom of list * Pushes task to top or bottom of list
*/ */
$scope.pushTask = function(task, index, location) { $scope.pushTask = function(task, index, location) {
var to = (location === 'bottom' || $scope.pushLocation === 'bottom') ? -1 : 0; var to = (location === 'bottom' || $scope.ctrlPressed) ? -1 : 0;
User.user.ops.sortTask({params:{id:task.id},query:{from:index, to:to}}) User.user.ops.sortTask({params:{id:task.id},query:{from:index, to:to}})
}; };
var ctrlKeys = [17, 224, 91];
$scope.$on("habit:keydown", function (e, keyEvent) {
if (ctrlKeys.indexOf(keyEvent.keyCode) !== -1) {
$scope.pushLocation = "bottom";
}
});
$scope.$on("habit:keyup", function (e, keyEvent) {
if (ctrlKeys.indexOf(keyEvent.keyCode) !== -1) {
$scope.pushLocation = "top";
}
});
/** /**
* This is calculated post-change, so task.completed=true if they just checked it * This is calculated post-change, so task.completed=true if they just checked it
*/ */

View File

@@ -13,9 +13,9 @@
// Icons only available if you own the tasks (aka, hidden from challenge stats) // Icons only available if you own the tasks (aka, hidden from challenge stats)
span(ng-if='!obj._locked') span(ng-if='!obj._locked')
a(ng-click='pushTask(task,$index,"top")', tooltip=env.t('pushTaskToTop'), ng-class="{'push-down': pushLocation == 'bottom'}") a(ng-click='pushTask(task,$index,"top")', tooltip=env.t('pushTaskToTop'), ng-class="{'push-down': ctrlPressed}")
span(ng-hide="pushLocation == 'bottom'").glyphicon.glyphicon-open span(ng-hide="ctrlPressed").glyphicon.glyphicon-open
span(ng-show="pushLocation == 'bottom'").glyphicon.glyphicon-save span(ng-show="ctrlPressed").glyphicon.glyphicon-save
// a(ng-click='pushTask(task,$index,"bottom")', tooltip=env.t('pushTaskToBottom')) // a(ng-click='pushTask(task,$index,"bottom")', tooltip=env.t('pushTaskToBottom'))
// span.glyphicon.glyphicon-import // span.glyphicon.glyphicon-import
// // glyphicon-import or glyphicon-save or glyphicon-sort-by-attributes // // glyphicon-import or glyphicon-save or glyphicon-sort-by-attributes