Merge pull request #6275 from TheHollidayInn/tasks-add-push-to-bottom

Tasks add push to bottom
This commit is contained in:
Sabe Jones
2015-12-01 14:20:02 -06:00
6 changed files with 22 additions and 8 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!",
"sureDelete": "Are you sure you want to delete this task?",
"streakCoins": "Streak Bonus!",
"pushTaskToTop": "Push task to top",
"pushTaskToBottom": "Push task to bottom",
"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 %>.",

View File

@@ -261,7 +261,7 @@ habitrpg.controller("InventoryCtrl",
}
};
$scope.$on("habit:keyup", function (e, keyEvent) {
$scope.$on("habit:keydown", function (e, keyEvent) {
if (keyEvent.keyCode == "27") {
$scope.deselectItem();
}

View File

@@ -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;
}
});
}
]);

View File

@@ -76,7 +76,7 @@ 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') ? -1 : 0;
var to = (location === 'bottom' || $scope.ctrlPressed) ? -1 : 0;
User.user.ops.sortTask({params:{id:task.id},query:{from:index, to:to}})
};

View File

@@ -1,6 +1,6 @@
doctype html
//html(ng-app="habitrpg", ng-controller="RootCtrl", ng-class='{"applying-action":applyingAction}', ui-keypress="{27:'castCancel()'}")
html(ng-app="habitrpg", ng-controller="RootCtrl", ng-class='{"applying-action":applyingAction}', ui-keyup="{27:'castCancel()'}", ng-keydown="$broadcast('habit:keyup', $event)")
html(ng-app="habitrpg", ng-controller="RootCtrl", ng-class='{"applying-action":applyingAction}', ui-keyup="{27:'castCancel()'}", ng-keydown="$broadcast('habit:keydown', $event)", ng-keyup="$broadcast('habit:keyup', $event)")
head
title=env.t('titleIndex')
// ?v=1 needed to force refresh

View File

@@ -13,8 +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'))
span.glyphicon.glyphicon-open
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