mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Fixed task push text and move ctrlPressed logic to rootScope.
This commit is contained in:
@@ -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!",
|
||||
"sureDelete": "Are you sure you want to delete this task?",
|
||||
"streakCoins": "Streak Bonus!",
|
||||
"pushTaskToTop": "Push task to top",
|
||||
"pushTaskToBottom": "Push task to bottom. Hold ctrl or cmd to push to top.",
|
||||
"pushTaskToTop": "Push task to top. Hold ctrl or cmd to push to bottom.",
|
||||
"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.",
|
||||
"habitHelp1": "Good Habits are things that you do often. They award Gold and Experience every time you click the <%= plusIcon %>.",
|
||||
|
||||
@@ -327,5 +327,19 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
});
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -76,23 +76,10 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
||||
* Pushes task to top or bottom of list
|
||||
*/
|
||||
$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}})
|
||||
};
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
// Icons only available if you own the tasks (aka, hidden from challenge stats)
|
||||
span(ng-if='!obj._locked')
|
||||
a(ng-click='pushTask(task,$index,"top")', tooltip=env.t('pushTaskToTop'), ng-class="{'push-down': pushLocation == 'bottom'}")
|
||||
span(ng-hide="pushLocation == 'bottom'").glyphicon.glyphicon-open
|
||||
span(ng-show="pushLocation == 'bottom'").glyphicon.glyphicon-save
|
||||
a(ng-click='pushTask(task,$index,"top")', tooltip=env.t('pushTaskToTop'), ng-class="{'push-down': ctrlPressed}")
|
||||
span(ng-hide="ctrlPressed").glyphicon.glyphicon-open
|
||||
span(ng-show="ctrlPressed").glyphicon.glyphicon-save
|
||||
// a(ng-click='pushTask(task,$index,"bottom")', tooltip=env.t('pushTaskToBottom'))
|
||||
// span.glyphicon.glyphicon-import
|
||||
// // glyphicon-import or glyphicon-save or glyphicon-sort-by-attributes
|
||||
|
||||
Reference in New Issue
Block a user