[Rt-commit] rt branch, 4.4/create-linked-ticket-modal, created. rt-4.4.1-122-g14c8414
Jim Brandt
jbrandt at bestpractical.com
Fri Sep 23 10:13:25 EDT 2016
The branch, 4.4/create-linked-ticket-modal has been created
at 14c841421d1e0c5267f0abb7cd05ca2bccb0e151 (commit)
- Log -----------------------------------------------------------------
commit 14c841421d1e0c5267f0abb7cd05ca2bccb0e151
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Sep 23 10:09:04 2016 -0400
Move onclick event to Create linked ticket anchor
On assets with a long history, it was possible to click
the Create linked ticket link in the Actions menu before
the page had fully loaded. In these cases, the jQuery
onclick event would not fire and the user would see the HTML
interstitial page rather than the modal for selecting the
queue to create the ticket.
Move the onclick event to the anchor tag itself to make sure
it displays the modal even if the page is not fully loaded.
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index e672e3b..c832a1a 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -1011,7 +1011,9 @@ my $build_main_nav = sub {
}
my $actions = $page->child("actions", title => loc("Actions"));
- $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
+ $actions->child("create-linked-ticket", title => loc("Create linked ticket"),
+ path => "/Asset/CreateLinkedTicket.html?Asset=$id",
+ attributes => { 'onClick' => 'createLinkedTicket(event)' });
my $status = $asset->Status;
my $lifecycle = $asset->LifecycleObj;
diff --git a/share/static/js/assets.js b/share/static/js/assets.js
index 8d5aaa0..6fe5e62 100644
--- a/share/static/js/assets.js
+++ b/share/static/js/assets.js
@@ -1,3 +1,20 @@
+function showModal(html) {
+ jQuery("<div class='modal'></div>")
+ .append(html).appendTo("body")
+ .bind('modal:close', function(ev,modal) { modal.elm.remove(); })
+ .modal();
+}
+
+function createLinkedTicket (ev) {
+ ev.preventDefault();
+ var url = ev.target.href.replace(/\/Asset\/CreateLinkedTicket\.html\?/g,
+ '/Asset/Helpers/CreateLinkedTicket?');
+ jQuery.get(
+ url,
+ showModal
+ );
+}
+
jQuery(function() {
var showModal = function(html) {
jQuery("<div class='modal'></div>")
@@ -25,15 +42,6 @@ jQuery(function() {
.map(function(x){return "asset:"+x})
.join(" "));
});
- jQuery("#page-actions-create-linked-ticket").click(function(ev){
- ev.preventDefault();
- var url = this.href.replace(/\/Asset\/CreateLinkedTicket\.html\?/g,
- '/Asset/Helpers/CreateLinkedTicket?');
- jQuery.get(
- url,
- showModal
- );
- });
jQuery("#bulk-update-create-linked-ticket").click(function(ev){
ev.preventDefault();
var chkArray = [];
-----------------------------------------------------------------------
More information about the rt-commit
mailing list