diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-03-19 16:45:32 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-03-19 16:45:32 -0400 |
commit | d915c2a96b0cbb54b9949cc04495d156e1f89332 (patch) | |
tree | 93f31d3de295c0f6cfc7c3a3bdf20cb8d7e7922a /assets/js/components/subtask-toggle-status.js | |
parent | 5b7ed28ba1a47a5c4312017a86fb811e14c0285a (diff) |
Improve subtask toggle
Diffstat (limited to 'assets/js/components/subtask-toggle-status.js')
-rw-r--r-- | assets/js/components/subtask-toggle-status.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/assets/js/components/subtask-toggle-status.js b/assets/js/components/subtask-toggle-status.js new file mode 100644 index 00000000..3014adfa --- /dev/null +++ b/assets/js/components/subtask-toggle-status.js @@ -0,0 +1,35 @@ +KB.on('dom.ready', function () { + $(document).on('click', '.js-subtask-toggle-status', function(e) { + var el = $(this); + var url = el.attr('href'); + + e.preventDefault(); + + $.ajax({ + cache: false, + url: url, + success: function(data) { + if (url.indexOf('fragment=table') != -1) { + $('.subtasks-table').replaceWith(data); + } else if (url.indexOf('fragment=rows') != -1) { + $(el).closest('.task-list-subtasks').replaceWith(data); + } else { + $(el).closest('.subtask-title').replaceWith(data); + } + } + }); + }); + + $(document).on('click', '.js-subtask-toggle-timer', function(e) { + var el = $(this); + e.preventDefault(); + + $.ajax({ + cache: false, + url: el.attr('href'), + success: function(data) { + $(el).closest('.subtask-time-tracking').replaceWith(data); + } + }); + }); +}); |