Skip to content

Commit e146cd8

Browse files
committed
WiP
1 parent ea3f162 commit e146cd8

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

client/js/form.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,7 @@ function cardForm(params) {
10861086
}
10871087

10881088
function ok() {
1089+
$("#modal").off("hidden.bs.modal");
10891090
$(".modalFormField").removeClass("is-invalid");
10901091
$(".select2-invalid").removeClass("select2-invalid");
10911092
$(".border-color-invalid").removeClass("border-color-invalid");
@@ -1162,6 +1163,7 @@ function cardForm(params) {
11621163
}
11631164

11641165
function del() {
1166+
$("#modal").off("hidden.bs.modal");
11651167
if (typeof params.callback === "function") {
11661168
let result = {};
11671169

@@ -1180,12 +1182,13 @@ function cardForm(params) {
11801182
}
11811183

11821184
function cancel() {
1183-
if (!params.target) {
1184-
$('#modal').modal('hide');
1185-
}
1185+
$("#modal").off("hidden.bs.modal");
11861186
if (typeof params.cancel === "function") {
11871187
params.cancel();
11881188
}
1189+
if (!params.target) {
1190+
$('#modal').modal('hide');
1191+
}
11891192
}
11901193

11911194
let target;
@@ -1253,6 +1256,8 @@ function cardForm(params) {
12531256
$(".modalFormDelete").off("click").on("click", del);
12541257
$(".modalFormCancel").off("click").on("click", cancel);
12551258

1259+
$("#modal").off("hidden.bs.modal").on("hidden.bs.modal", cancel);
1260+
12561261
$(".cardFormSelectWithRotate").off("click").on("click", function () {
12571262
let select = $("#" + $(this).attr("data-for"));
12581263
let i = parseInt(select.attr("data-field-index"));

client/js/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ function navigateUrl(route, params, options) {
438438
loadingStart();
439439
window.location.href = "?#" + route + "&" + $.param(params);
440440
} else {
441-
return "?#" + route + "&" + $.param(params);
441+
return "?#" + route + ((params && Object.keys(params).length) ? ("&" + $.param(params)) : "");
442442
}
443443
}
444444

client/modules/tt/createIssue.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
({
22
init: function () {
33
if (AVAIL("tt", "issue", "POST") && modules.tt.menuItem) {
4-
$("#" + leftSideClick("far fa-fw fa-plus-square", i18n("tt.createIssue"), "tt", () => {
5-
modules.tt.createIssue.createIssue($("#ttProjectSelect").val());
6-
})).after($("#" + modules.tt.menuItem));
4+
$("#" + leftSide("far fa-fw fa-plus-square", i18n("tt.createIssue"), navigateUrl("tt.createIssue", false, { exclude: [ "_" ]}), "tt")).
5+
after($("#" + modules.tt.menuItem));
76
}
87
moduleLoaded("tt.createIssue", this);
98
},
@@ -194,6 +193,9 @@
194193
navigateUrl("tt.createIssue", { project: result.project, workflow: result.workflow, catalog: result.catalog, parent: !!parent ? parent["issueId"] : false }, { run: true });
195194
// modules.tt.createIssueForm(result.project, result.workflow, result.catalog, (!!parent) ? encodeURIComponent(parent["issueId"]) : "");
196195
},
196+
cancel: () => {
197+
window.history.back();
198+
}
197199
});
198200
},
199201

@@ -360,7 +362,12 @@
360362
GET("tt", "tt", false, true).
361363
done(modules.tt.tt).
362364
done(() => {
363-
modules.tt.createIssue.createIssueForm(params.project, params.workflow, params.catalog, params.parent);
365+
if (params.project && params.workflow) {
366+
modules.tt.createIssue.createIssueForm(params.project, params.workflow, params.catalog, params.parent);
367+
} else {
368+
loadingDone();
369+
modules.tt.createIssue.createIssue($("#ttProjectSelect").val() ? $("#ttProjectSelect").val() : lStore("ttProject"));
370+
}
364371
}).
365372
fail(FAIL).
366373
fail(loadingDone);

client/modules/tt/issue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,7 @@
14751475

14761476
GET("tt", "issue", params["issue"], true).
14771477
done(r => {
1478+
$("#altForm").hide();
14781479
if (modules.groups) {
14791480
modules.users.loadUsers(() => {
14801481
modules.groups.loadGroups(() => {

0 commit comments

Comments
 (0)