# HG changeset patch # User Thierry Florac # Date 1495406761 -7200 # Node ID ae56cae68d91d5f764cfd0d85c9883cf16d9acd6 # Parent 084d3778c025b0201170b8de8ee037300574b665 Use click handlers for expanders diff -r 084d3778c025 -r ae56cae68d91 src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.js --- a/src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.js Tue May 16 11:41:47 2017 +0200 +++ b/src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.js Mon May 22 00:46:01 2017 +0200 @@ -178,7 +178,6 @@ }, init: function(element) { - $('.expander', element).click(PyAMS_zodbbrowser.collapseOrExpand); PyAMS_zodbbrowser.hideItemsIfTooMany(); $('#path a', element).click(function (event) { event.stopPropagation(); diff -r 084d3778c025 -r ae56cae68d91 src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.min.js --- a/src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.min.js Tue May 16 11:41:47 2017 +0200 +++ b/src/pyams_zodbbrowser/zmi/resources/js/zodbbrowser.min.js Mon May 22 00:46:01 2017 +0200 @@ -1,1 +1,1 @@ -(function(a){window.PyAMS_zodbbrowser={filterAll:function(){a(".filter").attr("checked",true);PyAMS_zodbbrowser.filterHistory(true)},filterNone:function(){a(".filter").attr("checked",false);PyAMS_zodbbrowser.filterHistory()},filterHistory:function(k){var p=a("div.transaction");var g=a(".filter");var b=Array();var c="map";for(var n=0;n'+l+"")}}},collapseOrExpand:function(){var c=a(this).next();var b=a(this).children("img");if(c.is(":hidden")){a(b).attr("src",a("#collapseImg").attr("src"));c.slideDown()}else{a(b).attr("src",a("#expandImg").attr("src"));c.slideUp()}},hideItemsIfTooMany:function(){a(".items").each(function(){var d=a(this).children(".expander")[0];var c=a(this).children(".collapsible")[0];if(c.childNodes.length>100&&!a(c).is(":hidden")){var b=a(d).children("img");a(b).attr("src",a("#expandImg").attr("src"));a(c).hide()}})},showGoTo:function(){a("#path").hide();a("#goto").show();a("#gotoInput").focus()},hideGoTo:function(){a("#goto").hide();a("#path").show();setTimeout(function(){a("#pathError").slideUp()},50)},ajaxErrorHandler:function(b,d,c){errorMessage="";if(d=="parsererror"){errorMessage="Server returned malformed data"}else{if(d=="error"){errorMessage="Unknown error (maybe server is offline?)"}else{if(d=="timeout"){errorMessage="Server timeout"}else{if(d=="notmodified"){errorMessage="Server error (says resource not modified)"}else{errorMessage="Unknown error"}}}}errorMessage=' '+errorMessage+"";a("#pathError").html(errorMessage)},ajaxSuccessHandler:function(c,b){if(c.url){window.location=c.url;a("#pathError").text("Found.").slideDown().slideUp()}else{if(c.error){a("#pathError").text(c.error).show();if(c.partial_url){a("#pathError").append(', would you like to go to '+c.partial_path+" instead?")}}else{a("#pathError").text(b).show()}}},activateGoTo:function(){var c=a("#gotoInput").val();var b="zodbbrowser_path_to_oid";a("#pathError").text("Loading...").slideDown();a.ajax({url:b,dataType:"json",data:"path="+c,timeout:7000,success:PyAMS_zodbbrowser.ajaxSuccessHandler,error:PyAMS_zodbbrowser.ajaxErrorHandler})},cancelRollback:function(b){a("#confirmation").remove();a("div.transaction").removeClass("focus");a("input.rollbackbtn").show()},pressRollback:function(c){c.preventDefault();PyAMS_zodbbrowser.cancelRollback();a(c.target).hide();var b=a(c.target).closest("div.transaction");b.addClass("focus");a('
This is a dangerous operation that may break data integrity. Are you really sure you want to do this?
').appendTo(b)},doRollback:function(){var b=a("#confirmation").closest("div.transaction");var c=b.find("form.rollback");c.find('input[name="confirmed"]').val("1");c.submit()},init:function(b){a(".expander",b).click(PyAMS_zodbbrowser.collapseOrExpand);PyAMS_zodbbrowser.hideItemsIfTooMany();a("#path a",b).click(function(c){c.stopPropagation()});a("#path",b).click(PyAMS_zodbbrowser.showGoTo);a("#gotoInput",b).blur(PyAMS_zodbbrowser.hideGoTo);a("#gotoInput",b).keypress(function(c){if(c.which==13){PyAMS_zodbbrowser.activateGoTo()}});a("#gotoInput",b).keydown(function(c){if(c.keyCode==27){PyAMS_zodbbrowser.hideGoTo()}});a(document).keypress(function(c){if(c.which==103){if(a("#goto",b).is(":hidden")){PyAMS_zodbbrowser.showGoTo();c.preventDefault()}}});a("input.rollbackbtn",b).click(PyAMS_zodbbrowser.pressRollback);a("span.truncated",b).click(function(c){c.preventDefault();var d=a(this);var e=d.attr("id");a.ajax({url:"zodbbrowser_truncated",data:"id="+e,success:function(g,f){d.replaceWith(g)}})})}}})(jQuery); \ No newline at end of file +(function(a){window.PyAMS_zodbbrowser={filterAll:function(){a(".filter").attr("checked",true);PyAMS_zodbbrowser.filterHistory(true)},filterNone:function(){a(".filter").attr("checked",false);PyAMS_zodbbrowser.filterHistory()},filterHistory:function(k){var p=a("div.transaction");var g=a(".filter");var b=Array();var c="map";for(var n=0;n'+l+"")}}},collapseOrExpand:function(){var c=a(this).next();var b=a(this).children("img");if(c.is(":hidden")){a(b).attr("src",a("#collapseImg").attr("src"));c.slideDown()}else{a(b).attr("src",a("#expandImg").attr("src"));c.slideUp()}},hideItemsIfTooMany:function(){a(".items").each(function(){var d=a(this).children(".expander")[0];var c=a(this).children(".collapsible")[0];if(c.childNodes.length>100&&!a(c).is(":hidden")){var b=a(d).children("img");a(b).attr("src",a("#expandImg").attr("src"));a(c).hide()}})},showGoTo:function(){a("#path").hide();a("#goto").show();a("#gotoInput").focus()},hideGoTo:function(){a("#goto").hide();a("#path").show();setTimeout(function(){a("#pathError").slideUp()},50)},ajaxErrorHandler:function(b,d,c){errorMessage="";if(d=="parsererror"){errorMessage="Server returned malformed data"}else{if(d=="error"){errorMessage="Unknown error (maybe server is offline?)"}else{if(d=="timeout"){errorMessage="Server timeout"}else{if(d=="notmodified"){errorMessage="Server error (says resource not modified)"}else{errorMessage="Unknown error"}}}}errorMessage=' '+errorMessage+"";a("#pathError").html(errorMessage)},ajaxSuccessHandler:function(c,b){if(c.url){window.location=c.url;a("#pathError").text("Found.").slideDown().slideUp()}else{if(c.error){a("#pathError").text(c.error).show();if(c.partial_url){a("#pathError").append(', would you like to go to '+c.partial_path+" instead?")}}else{a("#pathError").text(b).show()}}},activateGoTo:function(){var c=a("#gotoInput").val();var b="zodbbrowser_path_to_oid";a("#pathError").text("Loading...").slideDown();a.ajax({url:b,dataType:"json",data:"path="+c,timeout:7000,success:PyAMS_zodbbrowser.ajaxSuccessHandler,error:PyAMS_zodbbrowser.ajaxErrorHandler})},cancelRollback:function(b){a("#confirmation").remove();a("div.transaction").removeClass("focus");a("input.rollbackbtn").show()},pressRollback:function(c){c.preventDefault();PyAMS_zodbbrowser.cancelRollback();a(c.target).hide();var b=a(c.target).closest("div.transaction");b.addClass("focus");a('
This is a dangerous operation that may break data integrity. Are you really sure you want to do this?
').appendTo(b)},doRollback:function(){var b=a("#confirmation").closest("div.transaction");var c=b.find("form.rollback");c.find('input[name="confirmed"]').val("1");c.submit()},init:function(b){PyAMS_zodbbrowser.hideItemsIfTooMany();a("#path a",b).click(function(c){c.stopPropagation()});a("#path",b).click(PyAMS_zodbbrowser.showGoTo);a("#gotoInput",b).blur(PyAMS_zodbbrowser.hideGoTo);a("#gotoInput",b).keypress(function(c){if(c.which==13){PyAMS_zodbbrowser.activateGoTo()}});a("#gotoInput",b).keydown(function(c){if(c.keyCode==27){PyAMS_zodbbrowser.hideGoTo()}});a(document).keypress(function(c){if(c.which==103){if(a("#goto",b).is(":hidden")){PyAMS_zodbbrowser.showGoTo();c.preventDefault()}}});a("input.rollbackbtn",b).click(PyAMS_zodbbrowser.pressRollback);a("span.truncated",b).click(function(c){c.preventDefault();var d=a(this);var e=d.attr("id");a.ajax({url:"zodbbrowser_truncated",data:"id="+e,success:function(g,f){d.replaceWith(g)}})})}}})(jQuery); \ No newline at end of file diff -r 084d3778c025 -r ae56cae68d91 src/pyams_zodbbrowser/zmi/templates/zodbhistory.pt --- a/src/pyams_zodbbrowser/zmi/templates/zodbhistory.pt Tue May 16 11:41:47 2017 +0200 +++ b/src/pyams_zodbbrowser/zmi/templates/zodbhistory.pt Mon May 22 00:46:01 2017 +0200 @@ -42,7 +42,7 @@
-
+
collapse -

+

collapse Attributes

@@ -67,7 +67,7 @@
-

+

collapse Items ()

@@ -87,7 +87,7 @@
-

+

collapse History