--- a/src/pyams_content/skin/resources/js/pyams_content.min.js Thu Apr 21 18:13:29 2016 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.min.js Thu Apr 21 18:13:54 2016 +0200
@@ -1,1 +1,1 @@
-(function(b,a){var d=a.MyAMS;var c={TinyMCE:{initEditor:function(e){e.image_list=c.TinyMCE.getImagesList;e.link_list=c.TinyMCE.getLinksList;return e},getImagesList:function(e){return d.ajax.post("get-images-list.json",{},e)},getLinksList:function(e){return d.ajax.post("get-links-list.json",{},e)}},profile:{switchFavorite:function(){var f=b(this);var e=f.data("sequence-oid");d.ajax.post("switch-user-favorite.json",{oid:e},function(g,h){if(g.favorite){f.removeClass("fa-star-o").addClass("fa-star")}else{f.removeClass("fa-star").addClass("fa-star-o")}})}},extfiles:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.files:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_file.id).attr("selected","selected").text(f.new_file.text).appendTo(e);var h=e.select2("data");h.push(f.new_file);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.files,{term:""})},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("td.extfiles",e));if(g.nb_files>0){f.text("("+g.nb_files+")")}else{f.text("")}}},links:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.links:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_link.id).attr("selected","selected").text(f.new_link.text).appendTo(e);var h=e.select2("data");h.push(f.new_link);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.links,{term:""})},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("td.links",e));if(g.nb_links>0){f.text("("+g.nb_links+")")}else{f.text("")}}},galleries:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.galleries:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_gallery.id).attr("selected","selected").text(f.new_gallery.text).appendTo(e);var h=e.select2("data");h.push(f.new_gallery);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.galleries,{term:""})},setOrder:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var e=h.item.parents(".gallery");var f=b(".image",e).listattr("data-ams-element-name");d.ajax.post(e.data("ams-location")+"/set-images-order.json",{images:JSON.stringify(f)})},removeFile:function(e){return function(){var f=b(this);d.skin.bigBox({title:d.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+d.i18n.DELETE_WARNING,buttons:d.i18n.BTN_OK_CANCEL},function(j){if(j===d.i18n.BTN_OK){var i=f.parents(".gallery");var h=i.data("ams-location");var k=f.parents(".image");var g=k.data("ams-element-name");d.ajax.post(h+"/delete-element.json",{object_name:g},function(l,m){k.remove()})}})}},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("td.galleries",e));if(g.nb_galleries>0){f.text("("+g.nb_galleries+")")}else{f.text("")}}},paragraphs:{switchVisibility:function(e){return function(){var h=b(this);var f=h.parents("tr");var g=f.parents("table");d.ajax.post(g.data("ams-location")+"/set-paragraph-visibility.json",{object_name:f.data("ams-element-name")},function(i,j){if(i.visible){b("i",h).attr("class","fa fa-fw fa-eye")}else{b("i",h).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refreshParagraph:function(g){var f=b('table[id="paragraphs_list"]');var e=b('tr[data-ams-element-name="'+g.object_name+'"]',f);if(g.visible){b("i",b("td.switcher",e)).removeClass("fa-eye-slash text-danger").addClass("fa-eye")}else{b("i",b("td.switcher",e)).removeClass("fa-eye").addClass("fa-eye-slash text-danger")}b("span.title",e).text(g.title||"--")},switchEditor:function(g){var j=b(this);var i=b("i",j);var k=j.parents("td");var h=b(".editor",k);var e=j.parents("tr");if(i.hasClass("fa-plus-square-o")){var f=e.parents("table");h.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>');d.ajax.post(f.data("ams-location")+"/get-paragraph-editor.json",{object_name:e.data("ams-element-name")},function(l){h.html(l);if(l){d.initContent(h);i.removeClass("fa-plus-square-o").addClass("fa-minus-square-o");e.data("ams-disabled-handlers",true)}})}else{d.skin.cleanContainer(h);h.empty();i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");e.removeData("ams-disabled-handlers")}},switchAllEditors:function(f){var h=b(this);var g=b("i",h);var e=h.parents("table");if(g.hasClass("fa-plus-square-o")){g.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin");d.ajax.post(e.data("ams-location")+"/get-paragraphs-editors.json",{},function(j){for(var k in j){if(!j.hasOwnProperty(k)){continue}var i=b('tr[data-ams-element-name="'+k+'"]',e);var l=b(".editor",i);if(l.is(":empty")){l.html(j[k]);d.initContent(l)}b(".fa-plus-square-o",i).removeClass("fa-plus-square-o").addClass("fa-minus-square-o");i.data("ams-disabled-handlers",true)}if(!b("i.fa-plus-square-o",b("tbody",e)).exists()){g.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")}})}else{b(".editor",e).each(function(){d.skin.cleanContainer(b(this));b(this).empty()});b(".fa-minus-square-o",e).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");b("tr",e).removeData("ams-disabled-handlers")}}},themes:{initExtracts:function(g){var f=b('select[name="form.widgets.thesaurus_name:list"]',g);var e=f.val();var i=b('select[name="form.widgets.extract_name:list"]',g);var h=i.val();if(e){d.jsonrpc.post("getExtracts",{thesaurus_name:e},{url:"/api/thesaurus/json"},function(j){i.empty();b(j.result).each(function(){b("<option></option>").attr("value",this.id).attr("selected",this.id===h).text(this.text).appendTo(i)})})}i.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(h){var e=b(h.currentTarget);var g=e.parents("form");var f=b('select[name="form.widgets.thesaurus_name:list"]',g).val();if(f){d.jsonrpc.post("getExtracts",{thesaurus_name:f},{url:"/api/thesaurus/json"},function(k){var j=b('select[name="form.widgets.extract_name:list"]',g);var i=j.data("select2");i.results.empty();i.opts.populateResults.call(i,i.results,k.result,{term:""})})}}}};a.PyAMS_content=c;b(a.document).on("PyAMS_content.changed_item",function(f,e){switch(e.object_type){case"paragraph":c.paragraphs.refreshParagraph(e);break;case"extfiles_container":c.extfiles.refreshContainer(e);break;case"links_container":c.links.refreshContainer(e);break;case"galleries_container":c.galleries.refreshContainer(e);break}})})(jQuery,this);
\ No newline at end of file
+(function(b,a){var d=a.MyAMS;var c={TinyMCE:{initEditor:function(e){e.image_list=c.TinyMCE.getImagesList;e.link_list=c.TinyMCE.getLinksList;return e},getImagesList:function(e){return d.ajax.post("get-images-list.json",{},e)},getLinksList:function(e){return d.ajax.post("get-links-list.json",{},e)}},profile:{switchFavorite:function(){var f=b(this);var e=f.data("sequence-oid");d.ajax.post("switch-user-favorite.json",{oid:e},function(g,h){if(g.favorite){f.removeClass("fa-star-o").addClass("fa-star")}else{f.removeClass("fa-star").addClass("fa-star-o")}})}},extfiles:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.files:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_file.id).attr("selected","selected").text(f.new_file.text).appendTo(e);var h=e.select2("data");h.push(f.new_file);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.files,{term:""})},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("div.action.extfiles",e));if(g.nb_files>0){f.text("("+g.nb_files+")")}else{f.text("")}}},links:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.links:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_link.id).attr("selected","selected").text(f.new_link.text).appendTo(e);var h=e.select2("data");h.push(f.new_link);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.links,{term:""})},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("div.action.links",e));if(g.nb_links>0){f.text("("+g.nb_links+")")}else{f.text("")}}},galleries:{refresh:function(f){if(typeof(f)==="string"){f=JSON.parse(f)}var e=b('select[name="form.widgets.galleries:list"]');var g=e.data("select2");b("<option></option>").attr("value",f.new_gallery.id).attr("selected","selected").text(f.new_gallery.text).appendTo(e);var h=e.select2("data");h.push(f.new_gallery);e.select2("data",h);g.results.empty();g.opts.populateResults.call(g,g.results,f.galleries,{term:""})},setOrder:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var e=h.item.parents(".gallery");var f=b(".image",e).listattr("data-ams-element-name");d.ajax.post(e.data("ams-location")+"/set-images-order.json",{images:JSON.stringify(f)})},removeFile:function(e){return function(){var f=b(this);d.skin.bigBox({title:d.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+d.i18n.DELETE_WARNING,buttons:d.i18n.BTN_OK_CANCEL},function(j){if(j===d.i18n.BTN_OK){var i=f.parents(".gallery");var h=i.data("ams-location");var k=f.parents(".image");var g=k.data("ams-element-name");d.ajax.post(h+"/delete-element.json",{object_name:g},function(l,m){k.remove()})}})}},refreshContainer:function(g){var e=b('tr[data-ams-element-name="'+g.object_name+'"]');var f=b("span.count",b("div.action.galleries",e));if(g.nb_galleries>0){f.text("("+g.nb_galleries+")")}else{f.text("")}}},paragraphs:{switchVisibility:function(e){return function(){var h=b(this);var f=h.parents("tr");var g=f.parents("table");d.ajax.post(g.data("ams-location")+"/set-paragraph-visibility.json",{object_name:f.data("ams-element-name")},function(i,j){if(i.visible){b("i",h).attr("class","fa fa-fw fa-eye")}else{b("i",h).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refreshParagraph:function(g){var f=b('table[id="paragraphs_list"]');var e=b('tr[data-ams-element-name="'+g.object_name+'"]',f);if(g.visible){b("i",b("td.switcher",e)).removeClass("fa-eye-slash text-danger").addClass("fa-eye")}else{b("i",b("td.switcher",e)).removeClass("fa-eye").addClass("fa-eye-slash text-danger")}b("span.title",e).text(g.title||"--")},switchEditor:function(g){var j=b(this);var i=b("i",j);var k=j.parents("td");var h=b(".editor",k);var e=j.parents("tr");if(i.hasClass("fa-plus-square-o")){var f=e.parents("table");h.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>');d.ajax.post(f.data("ams-location")+"/get-paragraph-editor.json",{object_name:e.data("ams-element-name")},function(l){h.html(l);if(l){d.initContent(h);i.removeClass("fa-plus-square-o").addClass("fa-minus-square-o");e.data("ams-disabled-handlers",true)}})}else{d.skin.cleanContainer(h);h.empty();i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");e.removeData("ams-disabled-handlers")}},switchAllEditors:function(f){var h=b(this);var g=b("i",h);var e=h.parents("table");if(g.hasClass("fa-plus-square-o")){g.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin");d.ajax.post(e.data("ams-location")+"/get-paragraphs-editors.json",{},function(j){for(var k in j){if(!j.hasOwnProperty(k)){continue}var i=b('tr[data-ams-element-name="'+k+'"]',e);var l=b(".editor",i);if(l.is(":empty")){l.html(j[k]);d.initContent(l)}b(".fa-plus-square-o",i).removeClass("fa-plus-square-o").addClass("fa-minus-square-o");i.data("ams-disabled-handlers",true)}if(!b("i.fa-plus-square-o",b("tbody",e)).exists()){g.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")}})}else{b(".editor",e).each(function(){d.skin.cleanContainer(b(this));b(this).empty()});b(".fa-minus-square-o",e).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");b("tr",e).removeData("ams-disabled-handlers")}}},themes:{initExtracts:function(g){var f=b('select[name="form.widgets.thesaurus_name:list"]',g);var e=f.val();var i=b('select[name="form.widgets.extract_name:list"]',g);var h=i.val();if(e){d.jsonrpc.post("getExtracts",{thesaurus_name:e},{url:"/api/thesaurus/json"},function(j){i.empty();b(j.result).each(function(){b("<option></option>").attr("value",this.id).attr("selected",this.id===h).text(this.text).appendTo(i)})})}i.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(h){var e=b(h.currentTarget);var g=e.parents("form");var f=b('select[name="form.widgets.thesaurus_name:list"]',g).val();if(f){d.jsonrpc.post("getExtracts",{thesaurus_name:f},{url:"/api/thesaurus/json"},function(k){var j=b('select[name="form.widgets.extract_name:list"]',g);var i=j.data("select2");i.results.empty();i.opts.populateResults.call(i,i.results,k.result,{term:""})})}}}};a.PyAMS_content=c;b(a.document).on("PyAMS_content.changed_item",function(f,e){switch(e.object_type){case"paragraph":c.paragraphs.refreshParagraph(e);break;case"extfiles_container":c.extfiles.refreshContainer(e);break;case"links_container":c.links.refreshContainer(e);break;case"galleries_container":c.galleries.refreshContainer(e);break}})})(jQuery,this);
\ No newline at end of file