Fix regression: unable to change project in "task move/duplicate to another project"

This commit is contained in:
Frederic Guillot 2016-02-23 21:57:54 -05:00
parent cfbf6bc9c7
commit a6540bc604
4 changed files with 34 additions and 13 deletions

View File

@ -28,6 +28,7 @@ Bug fixes:
* Fix PHP notices during creation of first project and in subtasks table
* Fix filter dropdown not accessible when there are too many items
* Fix regression: unable to change project in "task move/duplicate to another project"
Version 1.0.25
--------------

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ function App() {
this.dropdown = new Dropdown();
this.tooltip = new Tooltip(this);
this.popover = new Popover(this);
this.task = new Task();
this.task = new Task(this);
this.project = new Project();
this.subtask = new Subtask(this);
this.column = new Column(this);
@ -19,16 +19,6 @@ function App() {
$(".alert-fade-out").delay(4000).fadeOut(800, function() {
$(this).remove();
});
// Reload page when a destination project is changed
var reloading_project = false;
$("select.task-reload-project-destination").change(function() {
if (! reloading_project) {
$(".loading-icon").show();
reloading_project = true;
window.location = $(this).data("redirect").replace(/PROJECT_ID/g, $(this).val());
}
});
}
App.prototype.listen = function() {

View File

@ -1,13 +1,19 @@
function Task() {
function Task(app) {
this.app = app;
}
Task.prototype.listen = function() {
var self = this;
var reloadingProjectId = 0;
// Change color
$(document).on("click", ".color-square", function() {
$(".color-square-selected").removeClass("color-square-selected");
$(this).addClass("color-square-selected");
$("#form-color_id").val($(this).data("color-id"));
});
// Assign to me
$(document).on("click", ".assign-me", function(e) {
e.preventDefault();
@ -18,4 +24,28 @@ Task.prototype.listen = function() {
$(dropdownId).val(currentId);
}
});
// Reload page when a destination project is changed
$(document).on("change", "select.task-reload-project-destination", function() {
if (reloadingProjectId > 0) {
$(this).val(reloadingProjectId);
}
else {
reloadingProjectId = $(this).val();
var url = $(this).data("redirect").replace(/PROJECT_ID/g, reloadingProjectId);
$(".loading-icon").show();
$.ajax({
type: "GET",
url: url,
success: function(data, textStatus, request) {
reloadingProjectId = 0;
$(".loading-icon").hide();
self.app.popover.afterSubmit(data, request, self.app.popover);
}
});
}
});
};