[otrs-cvs] otrs/var/httpd/htdocs/js Core.Agent.Admin.ProcessManagement.js, 1.65, 1.66 Core.UI.Accordion.js, 1.2, 1.3

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv25753/var/httpd/htdocs/js

Modified Files:
	Core.Agent.Admin.ProcessManagement.js Core.UI.Accordion.js 
Log Message:
Accordion in ProcessManagements now reloads without animation.

Author: mn

Index: Core.Agent.Admin.ProcessManagement.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.Agent.Admin.ProcessManagement.js,v
retrieving revision 1.65
retrieving revision 1.66
diff -2 -u -d -r1.65 -r1.66
--- Core.Agent.Admin.ProcessManagement.js	21 Jan 2013 11:36:07 -0000	1.65
+++ Core.Agent.Admin.ProcessManagement.js	22 Jan 2013 08:56:29 -0000	1.66
@@ -540,5 +540,5 @@
 
             // open accordion element again, which was active before the update
-            $('ul#ProcessElements > li:nth-child(' + (parseInt(ActiveElement,10) + 1) + ') h2 a').trigger('click');
+            Core.UI.Accordion.OpenElement($('ul#ProcessElements > li:nth-child(' + (parseInt(ActiveElement,10) + 1) + ')'));
 
             // Initialize filters

Author: mn

Index: Core.UI.Accordion.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.UI.Accordion.js,v
retrieving revision 1.2
retrieving revision 1.3
diff -2 -u -d -r1.2 -r1.3
--- Core.UI.Accordion.js	17 Feb 2011 21:30:59 -0000	1.2
+++ Core.UI.Accordion.js	22 Jan 2013 08:56:29 -0000	1.3
@@ -1,5 +1,5 @@
 // --
 // Core.UI.js - provides all UI functions
-// Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
+// Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 // --
 // $Id$
@@ -54,4 +54,6 @@
     };
 
+    TargetNS.ContentSelector = undefined;
+
     /**
      * @function
@@ -76,36 +78,51 @@
         }
 
+        TargetNS.ContentSelector = ContentSelector;
+
         // Bind click function to link selector elements
         $LinkSelectors.click(function () {
-            var $ListElement = $(this).closest('li'),
-                $AllListElements,
-                $ActiveListElement;
+            var $ListElement = $(this).closest('li');
 
-            // if clicked element is already active, do nothing
-            if ($ListElement.hasClass('Active')) {
-                return false;
-            }
+            TargetNS.OpenElement($ListElement, true);
 
-            // if another accordion animation is currently running, so nothing
-            if (TargetNS.AnimationIsRunning()) {
-                return false;
-            }
+            // always return false, because otherwise the url in the clicked link would be loaded
+            return false;
+        });
+    };
 
-            TargetNS.StartAnimation();
+    TargetNS.OpenElement = function ($ListElement, WithAnimation) {
+        var $AllListElements,
+            $ActiveListElement;
 
-            $AllListElements = $ListElement.parent('ul').find('li');
-            $ActiveListElement = $AllListElements.filter('.Active');
+        // if clicked element is already active, do nothing
+        if ($ListElement.hasClass('Active')) {
+            return false;
+        }
+
+        // if another accordion animation is currently running, do nothing
+        if (TargetNS.AnimationIsRunning()) {
+            return false;
+        }
+
+        $AllListElements = $ListElement.parent('ul').find('li');
+        $ActiveListElement = $AllListElements.filter('.Active');
+
+        if (WithAnimation) {
+            TargetNS.StartAnimation();
 
             $AllListElements.find('div.Content div').css('overflow', 'hidden');
 
-            $ActiveListElement.find(ContentSelector).add($ListElement.find(ContentSelector)).slideToggle("slow", function () {
+            $ActiveListElement.find(TargetNS.ContentSelector).add($ListElement.find(TargetNS.ContentSelector)).slideToggle("slow", function () {
                 $AllListElements.find('div.Content div').css('overflow', 'scroll');
-                $(this).closest('li').toggleClass('Active');
+                $ListElement.addClass('Active');
+                $ActiveListElement.removeClass('Active');
                 TargetNS.StopAnimation();
             });
-
-            // always return false, because otherwise the url in the clicked link would be loaded
-            return false;
-        });
+        }
+        else {
+            $ActiveListElement.find(TargetNS.ContentSelector).add($ListElement.find(TargetNS.ContentSelector)).toggle();
+            $ListElement.addClass('Active');
+            $ActiveListElement.removeClass('Active');
+        }
     };
 
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.