Improve subtask toggle status and timer

This commit is contained in:
Frederic Guillot
2016-02-05 18:30:16 -05:00
parent 9c15658089
commit 4e07ad6555
12 changed files with 92 additions and 61 deletions

View File

@@ -8,6 +8,7 @@ function App() {
this.popover = new Popover(this);
this.task = new Task();
this.project = new Project();
this.subtask = new Subtask();
this.keyboardShortcuts();
this.chosen();
this.poll();
@@ -37,23 +38,11 @@ App.prototype.listen = function() {
this.search.listen();
this.task.listen();
this.swimlane.listen();
this.subtask.listen();
this.search.focus();
this.autoComplete();
this.datePicker();
this.focus();
$(document).on("click", ".ajax-replace", function(e) {
e.preventDefault();
var el = $(this);
$.ajax({
cache: false,
url: el.attr("href"),
success: function(data) {
el.replaceWith(data);
}
});
});
};
App.prototype.refresh = function() {

34
assets/js/src/Subtask.js Normal file
View File

@@ -0,0 +1,34 @@
function Subtask() {
}
Subtask.prototype.listen = function() {
$(document).on("click", ".subtask-toggle-status", function(e) {
e.preventDefault();
var el = $(this);
$.ajax({
cache: false,
url: el.attr("href"),
success: function(data) {
if (el.hasClass("subtask-refresh-table")) {
$(".subtasks-table").replaceWith(data);
} else {
el.replaceWith(data);
}
}
});
});
$(document).on("click", ".subtask-toggle-timer", function(e) {
e.preventDefault();
var el = $(this);
$.ajax({
cache: false,
url: el.attr("href"),
success: function(data) {
$(".subtasks-table").replaceWith(data);
}
});
});
};