mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
first draft of bulk add
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
"beeminderDeleteWarning": "Beeminder users: <strong>First</strong> read <a href=\"http://habitrpg.wikia.com/wiki/Beeminder#Deleting_Completed_To-Dos_Without_Confusing_Beeminder\">Deleting Completed To-Dos Without Confusing Beeminder</a>!",
|
"beeminderDeleteWarning": "Beeminder users: <strong>First</strong> read <a href=\"http://habitrpg.wikia.com/wiki/Beeminder#Deleting_Completed_To-Dos_Without_Confusing_Beeminder\">Deleting Completed To-Dos Without Confusing Beeminder</a>!",
|
||||||
"habits": "Habits",
|
"habits": "Habits",
|
||||||
"newHabit": "New Habit",
|
"newHabit": "New Habit",
|
||||||
|
"newHabitBulk": "New Habits (one per line)",
|
||||||
"yellowred": "Weak",
|
"yellowred": "Weak",
|
||||||
"greenblue": "Strong",
|
"greenblue": "Strong",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
@@ -30,11 +31,13 @@
|
|||||||
"progress": "Progress",
|
"progress": "Progress",
|
||||||
"dailies": "Dailies",
|
"dailies": "Dailies",
|
||||||
"newDaily": "New Daily",
|
"newDaily": "New Daily",
|
||||||
|
"newDailyBulk": "New Dailies (one per line)",
|
||||||
"streakCounter": "Streak Counter",
|
"streakCounter": "Streak Counter",
|
||||||
"repeat": "Repeat",
|
"repeat": "Repeat",
|
||||||
"restoreStreak": "Restore Streak",
|
"restoreStreak": "Restore Streak",
|
||||||
"todos": "To-Dos",
|
"todos": "To-Dos",
|
||||||
"newTodo": "New To-Do",
|
"newTodo": "New To-Do",
|
||||||
|
"newTodoBulk": "New To-Dos (one per line)",
|
||||||
"dueDate": "Due Date",
|
"dueDate": "Due Date",
|
||||||
"remaining": "Active",
|
"remaining": "Active",
|
||||||
"complete": "Done",
|
"complete": "Done",
|
||||||
@@ -48,6 +51,7 @@
|
|||||||
"gold": "Gold",
|
"gold": "Gold",
|
||||||
"silver": "Silver (100 silver = 1 gold)",
|
"silver": "Silver (100 silver = 1 gold)",
|
||||||
"newReward": "New Reward",
|
"newReward": "New Reward",
|
||||||
|
"newRewardBulk": "New Rewards (one per line)",
|
||||||
"price": "Price",
|
"price": "Price",
|
||||||
"tags": "Tags",
|
"tags": "Tags",
|
||||||
"editTags": "Edit",
|
"editTags": "Edit",
|
||||||
|
|||||||
@@ -105,10 +105,12 @@ $hrpg-button-with-input
|
|||||||
@extend $hrpg-button-master
|
@extend $hrpg-button-master
|
||||||
border: none
|
border: none
|
||||||
border-radius: 0.382em
|
border-radius: 0.382em
|
||||||
input, a, button
|
input, a, button, textarea
|
||||||
display: block
|
display: block
|
||||||
float: left
|
float: left
|
||||||
height: 2em
|
height: 2em
|
||||||
|
textarea
|
||||||
|
height: auto
|
||||||
input
|
input
|
||||||
border: 1px solid #ccc
|
border: 1px solid #ccc
|
||||||
border-radius: 0.382em 0em 0em 0.382em !important
|
border-radius: 0.382em 0em 0em 0.382em !important
|
||||||
|
|||||||
@@ -23,18 +23,37 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
User.user.ops.score({params:{id: task.id, direction:direction}})
|
User.user.ops.score({params:{id: task.id, direction:direction}})
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addTask = function(addTo, listDef) {
|
function addTask(addTo, listDef, task) {
|
||||||
var newTask = {
|
var newTask = {
|
||||||
text: listDef.newTask,
|
text: task,
|
||||||
type: listDef.type,
|
type: listDef.type,
|
||||||
tags: _.transform(User.user.filters, function(m,v,k){
|
tags: _.transform(User.user.filters, function(m,v,k){
|
||||||
if (v) m[k]=v;
|
if (v) m[k]=v;
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
User.user.ops.addTask({body:newTask});
|
User.user.ops.addTask({body:newTask});
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.addTask = function(addTo, listDef) {
|
||||||
|
if (listDef.bulk) {
|
||||||
|
var tasks = listDef.newTask.split(/[\n\r]+/);
|
||||||
|
_.each(tasks, function(t) {
|
||||||
|
addTask(addTo, listDef, t);
|
||||||
|
});
|
||||||
|
listDef.bulk = false;
|
||||||
|
} else {
|
||||||
|
addTask(addTo, listDef, listDef.newTask);
|
||||||
|
}
|
||||||
delete listDef.newTask;
|
delete listDef.newTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.toggleBulk = function(list) {
|
||||||
|
if (typeof list.bulk === 'undefined') {
|
||||||
|
list.bulk = false;
|
||||||
|
}
|
||||||
|
list.bulk = !list.bulk;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the new task to the actions log
|
* Add the new task to the actions log
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -73,21 +73,25 @@ habitrpg
|
|||||||
header: window.env.t('habits'),
|
header: window.env.t('habits'),
|
||||||
type: 'habit',
|
type: 'habit',
|
||||||
placeHolder: window.env.t('newHabit'),
|
placeHolder: window.env.t('newHabit'),
|
||||||
|
placeHolderBulk: window.env.t('newHabitBulk'),
|
||||||
view: "all"
|
view: "all"
|
||||||
}, {
|
}, {
|
||||||
header: window.env.t('dailies'),
|
header: window.env.t('dailies'),
|
||||||
type: 'daily',
|
type: 'daily',
|
||||||
placeHolder: window.env.t('newDaily'),
|
placeHolder: window.env.t('newDaily'),
|
||||||
|
placeHolderBulk: window.env.t('newDailyBulk'),
|
||||||
view: dailiesView
|
view: dailiesView
|
||||||
}, {
|
}, {
|
||||||
header: window.env.t('todos'),
|
header: window.env.t('todos'),
|
||||||
type: 'todo',
|
type: 'todo',
|
||||||
placeHolder: window.env.t('newTodo'),
|
placeHolder: window.env.t('newTodo'),
|
||||||
|
placeHolderBulk: window.env.t('newTodoBulk'),
|
||||||
view: "remaining"
|
view: "remaining"
|
||||||
}, {
|
}, {
|
||||||
header: window.env.t('rewards'),
|
header: window.env.t('rewards'),
|
||||||
type: 'reward',
|
type: 'reward',
|
||||||
placeHolder: window.env.t('newReward'),
|
placeHolder: window.env.t('newReward'),
|
||||||
|
placeHolderBulk: window.env.t('newRewardBulk'),
|
||||||
view: "all"
|
view: "all"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -24,9 +24,14 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||||||
|
|
||||||
// Add New
|
// Add New
|
||||||
form.task-add(name='new{{list.type}}form', ng-hide='obj._locked', ng-submit='addTask(obj[list.type+"s"],list)')
|
form.task-add(name='new{{list.type}}form', ng-hide='obj._locked', ng-submit='addTask(obj[list.type+"s"],list)')
|
||||||
input(type='text', ng-model='list.newTask', placeholder='{{list.placeHolder}}', required)
|
textarea(rows='6', ng-model='list.newTask', placeholder='{{list.placeHolderBulk}}', ng-if='list.bulk', required)
|
||||||
|
input(type='text', ng-model='list.newTask', placeholder='{{list.placeHolder}}', ng-if='!list.bulk', required)
|
||||||
button(type='submit', ng-disabled='new{{list.type}}form.$invalid')
|
button(type='submit', ng-disabled='new{{list.type}}form.$invalid')
|
||||||
span.glyphicon.glyphicon-plus
|
span.glyphicon.glyphicon-plus
|
||||||
|
span.help-block
|
||||||
|
a(ng-click='toggleBulk(list)')
|
||||||
|
span.add-multiple(ng-if='!list.bulk') Add Multiple
|
||||||
|
span.add-single(ng-if='list.bulk') Add Single
|
||||||
|
|
||||||
mixin taskColumnTabs(position)
|
mixin taskColumnTabs(position)
|
||||||
// Habits Tabs
|
// Habits Tabs
|
||||||
|
|||||||
Reference in New Issue
Block a user