--- a/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.min.js Wed Apr 15 14:25:46 2015 +0200
+++ b/src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.min.js Fri Apr 17 14:02:46 2015 +0200
@@ -1,1 +1,1 @@
-(function(a){PyAMS_thesaurus={tree:{displaySubNodes:function(f,d,b){if(b===undefined){b=a('span.term:withtext("'+f+'")').siblings("i[data-ams-click-handler]")}var n=b.parents("span.label").siblings("ul.group");var m=n.closest("ul.group").closest("li");n.empty();for(var h in d){var e=d[h];var o=a("<li></li>");e.extracts.reverse();for(var k in e.extracts){var g=e.extracts[k];var c=a("<div></div>").addClass("pull-right margin-right-2").appendTo(o);var p=a("<i></i>").attr("data-ams-extract-name",g.name).addClass("fa fa-fw fa-square extract-checker").css("color","#"+g.color).appendTo(c);var j=a('>div i.extract-checker[data-ams-extract-name="'+g.name+'"]',m);if(j.hasClass("used")){if(g.used){p.addClass("used")}else{p.removeClass("fa-square").addClass("fa-square-o")}var i=a("i.switcher",'table.extracts tr[data-ams-element-name="'+g.name+'"]');if(!i.hasClass("fa-eye")){p.css("visibility","hidden")}}else{p.addClass("disabled").css("color","silver")}}var l=a("<span></span>").addClass("label label-success").addClass(e.css_class).attr("data-ams-url",e.view).attr("data-toggle","modal");if(e.expand){a("<i></i>").addClass("fa fa-lg fa-plus-circle").attr("data-ams-click-handler","PyAMS_thesaurus.tree.expand").attr("data-ams-stop-propagation",true).appendTo(l)}a("<span></span>").addClass("term").html(e.label).appendTo(l);l.appendTo(o);a("<ul></ul>").addClass("hidden group").appendTo(o);o.appendTo(n);if(e.subnodes){PyAMS_thesaurus.tree.displaySubNodes(e.label,e.subnodes)}}n.removeClass("hidden");b.removeClass("fa-gear").addClass("fa-minus-circle")},expand:function(){var d=a(this);if(d.hasClass("fa-plus-circle")){d.removeClass("fa-plus-circle").addClass("fa-gear");var b=d.siblings("span.term").text();var c=d.closest("div.tree").data("ams-tree-context");MyAMS.ajax.post(c+"/get-nodes.json",{term:b},function(e){PyAMS_thesaurus.tree.displaySubNodes(b,e.nodes,d)})}else{PyAMS_thesaurus.tree.collapse.call(this)}},collapse:function(){var b=a(this);b.parents("span.label").siblings("ul.group").addClass("hidden");b.removeClass("fa-minus-circle").addClass("fa-plus-circle")},updateTerm:function(b){var c=a('span.term:withtext("'+b.term+'")').siblings("i[data-ams-click-handler]");if(c.hasClass("fa-minus-circle")){PyAMS_thesaurus.tree.collapse.call(c)}PyAMS_thesaurus.tree.expand.call(c)},findTerm:function(b){MyAMS.ajax.post("get-parent-nodes.json",{term:b.term},function(d){PyAMS_thesaurus.tree.displaySubNodes(d.parent,d.nodes);var c=a('span.term:withtext("'+d.term+'")').parents("span.label");a("html,body").animate({scrollTop:c.offset().top-100},1000);c.css("background-color","darkgreen").on("mouseover",function(){a(this).css("background-color","")})})},switchExtract:function(){return function(){var c=a("i.fa",a(this));var b=c.parents("tr:first").data("ams-element-name");if(c.hasClass("fa-eye-slash")){PyAMS_thesaurus.tree.showExtract.call(this,b,c)}else{PyAMS_thesaurus.tree.hideExtract.call(this,b,c)}}},showExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","");b.removeClass("fa-eye-slash").removeClass("text-danger").addClass("fa-eye")},hideExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","hidden");b.removeClass("fa-eye").addClass("fa-eye-slash").addClass("text-danger")}},search:function(){var b=a(this).val();PyAMS_thesaurus.tree.findTerm({term:b})}};a(document).on("click","i.extract-checker",function(d){var b=a(this);if(b.hasClass("disabled")){return}var c=a("span.term",b.closest("div").siblings("span"));MyAMS.ajax.post("switch-extract.json",{term:c.text(),extract:b.data("ams-extract-name")},function(e){if(e.used){b.removeClass("fa-square-o").addClass("fa-square used");a('>li >div i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square disabled").addClass("fa-square-o").css("color","#"+e.color)}else{b.removeClass("fa-square used").addClass("fa-square-o");a('i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square-o").addClass("fa-square disabled").css("color","silver")}})})})(jQuery);
\ No newline at end of file
+(function(a){PyAMS_thesaurus={tree:{displaySubNodes:function(f,d,b){if(b===undefined){b=a('span.term:withtext("'+f+'")').siblings("i[data-ams-click-handler]")}var n=b.parents("span.label").siblings("ul.group");var m=n.closest("ul.group").closest("li");n.empty();for(var h in d){var e=d[h];var o=a("<li></li>");e.extracts.reverse();for(var k in e.extracts){var g=e.extracts[k];var c=a("<div></div>").addClass("pull-right margin-right-2").appendTo(o);var p=a("<i></i>").attr("data-ams-extract-name",g.name).addClass("fa fa-fw fa-square extract-checker").css("color","#"+g.color).appendTo(c);var j=a('>div i.extract-checker[data-ams-extract-name="'+g.name+'"]',m);if(j.hasClass("used")){if(g.used){p.addClass("used")}else{p.removeClass("fa-square").addClass("fa-square-o")}var i=a("i.switcher",'table.extracts tr[data-ams-element-name="'+g.name+'"]');if(!i.hasClass("fa-eye")){p.css("visibility","hidden")}}else{p.addClass("disabled").css("color","silver")}}var l=a("<span></span>").addClass("label label-success").addClass(e.css_class).attr("data-ams-url",e.view).attr("data-toggle","modal");if(e.expand){a("<i></i>").addClass("fa fa-lg fa-plus-circle").attr("data-ams-click-handler","PyAMS_thesaurus.tree.expand").attr("data-ams-stop-propagation",true).appendTo(l)}a("<span></span>").addClass("term").html(e.label).appendTo(l);l.appendTo(o);a("<ul></ul>").addClass("hidden group").appendTo(o);o.appendTo(n);if(e.subnodes){PyAMS_thesaurus.tree.displaySubNodes(e.label,e.subnodes)}}n.removeClass("hidden");b.removeClass("fa-gear").addClass("fa-minus-circle")},expand:function(){var d=a(this);if(d.hasClass("fa-plus-circle")){d.removeClass("fa-plus-circle").addClass("fa-gear");var b=d.siblings("span.term").text();var c=d.closest("div.tree").data("ams-tree-context");MyAMS.ajax.post(c+"/get-nodes.json",{term:b},function(e){PyAMS_thesaurus.tree.displaySubNodes(b,e.nodes,d)})}else{PyAMS_thesaurus.tree.collapse.call(this)}},collapse:function(){var b=a(this);b.parents("span.label").siblings("ul.group").addClass("hidden");b.removeClass("fa-minus-circle").addClass("fa-plus-circle")},updateTerm:function(b){var c=a('span.term:withtext("'+b.term+'")').siblings("i[data-ams-click-handler]");if(c.hasClass("fa-minus-circle")){PyAMS_thesaurus.tree.collapse.call(c)}PyAMS_thesaurus.tree.expand.call(c)},findTerm:function(b){MyAMS.ajax.post("get-parent-nodes.json",{term:b.term},function(d){PyAMS_thesaurus.tree.displaySubNodes(d.parent,d.nodes);var c=a('span.term:withtext("'+d.term+'")').parents("span.label");a("html,body").animate({scrollTop:c.offset().top-100},1000);c.css("background-color","darkgreen").on("mouseover",function(){a(this).css("background-color","")})})},switchExtract:function(){return function(){var c=a("i.fa",a(this));var b=c.parents("tr:first").data("ams-element-name");if(c.hasClass("fa-eye-slash")){PyAMS_thesaurus.tree.showExtract.call(this,b,c)}else{PyAMS_thesaurus.tree.hideExtract.call(this,b,c)}}},showExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","");b.removeClass("fa-eye-slash").removeClass("text-danger").addClass("fa-eye")},hideExtract:function(c,b){a('i.extract-checker[data-ams-extract-name="'+c+'"]').css("visibility","hidden");b.removeClass("fa-eye").addClass("fa-eye-slash").addClass("text-danger")}},search:function(){var b=a(this).val();PyAMS_thesaurus.tree.findTerm({term:b})}};a(document).on("click","i.extract-checker",function(d){var b=a(this);if(b.hasClass("disabled")){return}var c=a("span.term",b.closest("div").siblings("span"));MyAMS.ajax.post("switch-extract.json",{term:c.text(),extract:b.data("ams-extract-name")},function(e){if(e.status){MyAMS.ajax.handleJSON(e)}else{if(e.used){b.removeClass("fa-square-o").addClass("fa-square used");a('>li >div i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square disabled").addClass("fa-square-o").css("color","#"+e.color)}else{b.removeClass("fa-square used").addClass("fa-square-o");a('i.extract-checker[data-ams-extract-name="'+e.extract+'"]',b.closest("div").siblings("ul.group")).removeClass("fa-square-o").addClass("fa-square disabled").css("color","silver")}}})})})(jQuery);
\ No newline at end of file