--- a/src/pyams_portal/resources/js/portal.min.js Wed Jul 12 12:19:53 2017 +0200
+++ b/src/pyams_portal/resources/js/portal.min.js Wed Jul 12 12:20:51 2017 +0200
@@ -1,1 +1,1 @@
-(function(c,b){var d=b.MyAMS;var a={template:{initConfig:function(){var e=c("#portal_config");if(e.data("ams-allowed-change")){c(".rows",e).addClass("sortable");c(".slots",e).addClass("sortable");c(".slot",e).addClass("resizable");c(".portlets",e).addClass("sortable");d.plugins.enabled.sortable(e);d.plugins.enabled.resizable(e);c(".btn-row",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".rows"});c(".rows",e).droppable({accept:".btn-row",drop:a.template.dropRowButton});c(".btn-slot",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".slots"});c(".slots",e).droppable({accept:".btn-slot",drop:a.template.dropSlotButton});c(".btn-portlet",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".portlets"});c(".portlets",e).droppable({accept:".btn-portlet",hoverClass:"portlets-hover",activeClass:"portlets-active",drop:a.template.dropPortletButton})}},selectDisplay:function(){var e=c(this).val();d.ajax.post("get-slots-width.json",{device:e},function(f){var g=c("#portal_config");g.removeClassPrefix("container-");if(e){g.addClass("container-"+e)}c(".slot",g).removeClassPrefix("col-");for(var h in f){if(!f.hasOwnProperty(h)){continue}var i=f[h];var k=c('.slot[data-ams-slot-name="'+h+'"]',g);if(e){k.addClass("col-"+i[e])}else{for(var j in i){if(!i.hasOwnProperty(j)){continue}k.addClass("col-"+j+"-"+i[j])}}}})},addRow:function(){return function(){c(this).parents(".btn-group").removeClass("open");d.ajax.post("add-template-row.json",{},function(e){var f=e.row_id;var g=c(".rows","#portal_config");c("<div></div>").addClass("row context-menu").attr("data-ams-row-id",f).append(c("<span></span>").addClass("row_id label label-success pull-right").text(f)).append(c("<div></div>").addClass("slots").sortable({placeholder:"slot-highlight",connectWith:".slots",over:a.template.overSlots,stop:a.template.sortSlots}).droppable({accept:".btn-slot",drop:a.template.dropSlotButton})).contextMenu({menuSelector:"#rowMenu",menuSelected:d.helpers.contextMenuHandler}).appendTo(g);g.sortable("refresh")})}},dropRowButton:function(e,f){if(f.draggable.hasClass("already-dropped")){return}f.draggable.addClass("already-dropped");d.ajax.post("add-template-row.json",{},function(g){var h=g.row_id;var i=c(".rows","#portal_config");f.draggable.removeClassPrefix("btn").removeClassPrefix("ui-").removeClass("already-dropped").removeAttr("style").addClass("row context-menu").attr("data-ams-row-id",h).empty().append(c("<span></span>").addClass("row_id label label-success pull-right").text(h)).append(c("<div></div>").addClass("slots").sortable({placeholder:"slot-highlight",connectWith:".slots",over:a.template.overSlots,stop:a.template.sortSlots}).droppable({accept:".btn-slot",drop:a.template.dropSlotButton})).contextMenu({menuSelector:"#rowMenu",menuSelected:d.helpers.contextMenuHandler});a.template.sortRows();i.sortable("refresh")})},overRows:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("row-highlight").css("height",c(f.item).outerHeight())},sortRows:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var e=c("#portal_config");var f=c(".row",e).listattr("data-ams-row-id");d.ajax.post("set-template-row-order.json",{rows:JSON.stringify(f)},function(i){if(i.status==="success"){c(".row",e).each(function(j){c(this).attr("data-ams-row-id",j);c("span.row_id",c(this)).text(j)})}})},deleteRow:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("row")){e=e.parents(".row")}d.ajax.post("delete-template-row.json",{row_id:e.data("ams-row-id")},function(g){if(g.status==="success"){e.remove();c(".row","#portal_config").each(function(h){c(this).removeData().attr("data-ams-row-id",h);c("span.row_id",c(this)).text(h)})}})}})}},addSlotCallback:function(e){var h=c(".slots",'.row[data-ams-row-id="'+e.row_id+'"]');var g=e.slot_name;var f=c("<div></div>").addClass("slot context-menu col col-xs-12 col-sm-12 col-md-12 col-lg-12 resizable").attr("data-ams-slot-name",g).append(c("<div></div>").addClass("header padding-x-5").text(g)).append(c("<div></div>").addClass("portlets").sortable({placeholder:"portlet-highlight",connectWith:".portlets",over:a.template.overPortlets,stop:a.template.sortPortlets}).droppable({accept:".btn-portlet",hoverClass:"portlets-hover",activeClass:"portlets-active",drop:a.template.dropPortletButton})).append(c("<div></div>").addClass("clearfix")).contextMenu({menuSelector:"#slotMenu",menuSelected:d.helpers.contextMenuHandler});var i=c(".btn-slot",h);if(i.exists()){i.replaceWith(f);c(".slot",h).each(function(){c(this).removeData()});a.template.sortSlots()}else{f.appendTo(h)}f.resizable({start:a.template.startSlotResize,stop:a.template.stopSlotResize,handles:"e"});h.sortable("refresh")},dropSlotButton:function(f,g){if(g.draggable.hasClass("already-dropped")){return}g.draggable.addClass("already-dropped");var e=g.helper.parents(".row:first").data("ams-row-id");d.dialog.open("add-template-slot.html?form.widgets.row_id="+e)},startSlotResize:function(f,h){var j=h.element;var i=j.parents(".slots:first");var e=(i.innerWidth()-110)/12;var g=j.height();h.element.resizable("option","grid",[e,g]);h.element.resizable("option","minWidth",e);h.element.resizable("option","minHeight",g);h.element.resizable("option","maxWidth",i.innerWidth());h.element.resizable("option","maxHeight",g)},stopSlotResize:function(h,j){var l=j.element;var k=l.parents(".slots:first");var f=(k.innerWidth()-10)/12;var i=Math.round(c(l).width()/f);var g=c("#device_selector").val();if(!g){var e=c("body").width();if(e>1170){g="lg"}else{if(e>970){g="md"}else{if(e>750){g="sm"}else{g="xs"}}}}d.ajax.post("set-slot-width.json",{slot_name:l.data("ams-slot-name"),device:g,width:i},function(m){l.removeClassPrefix("col-");l.removeAttr("style");var n=l.data("ams-slot-name");var o=m[n];if(g){l.addClass("col-"+g+"-"+o[g])}else{l.addClass("col-"+o[g])}})},editSlot:function(){return function(e){if(!e.hasClass("slot")){e=e.parents(".slot")}d.dialog.open("slot-properties.html?form.widgets.slot_name="+e.data("ams-slot-name"))}},editSlotCallback:function(e){var g=c('.slot[data-ams-slot-name="'+e.slot_name+'"]');g.attr("class","slot context-menu col");var f=c("#device_selector").val();if(f){g.addClass("col-"+e.width[f])}else{for(f in e.width){if(!e.width.hasOwnProperty(f)){continue}g.addClass("col-"+f+"-"+e.width[f])}}},overSlots:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("slot-highlight").css("height",c(f.item).outerHeight())},sortSlots:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var f=c("#portal_config");var e={};c(".row",f).each(function(){var j=c(this);var i=[];c(".slot",j).each(function(){i.push(c(this).data("ams-slot-name"))});e[parseInt(j.attr("data-ams-row-id"))]=i});d.ajax.post("set-template-slot-order.json",{order:JSON.stringify(e)})},deleteSlot:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("slot")){e=e.parents(".slot")}d.ajax.post("delete-template-slot.json",{slot_name:e.data("ams-slot-name")},function(g){if(g.status==="success"){e.remove();c(".slot","#portal_config").each(function(){c(this).removeData()})}})}})}},addPortletCallback:function(e){var f=c(".portlets",'.slot[data-ams-slot-name="'+e.slot_name+'"]');var h=c("<div></div>").addClass("portlet context-menu").attr("data-ams-portlet-id",e.portlet_id).append(c("<div></div>").addClass("header padding-x-5").text(e.label)).append(c("<div></div>").addClass("preview").html(e.preview||"")).contextMenu({menuSelector:"#portletMenu",menuSelected:d.helpers.contextMenuHandler});d.initContent(c(".preview",h));var g=c(".btn-portlet",f);if(g.exists()){g.replaceWith(h);c(".portlet",f).each(function(){c(this).removeData()});a.template.sortPortlets(null,{item:h})}else{h.appendTo(f)}f.sortable("refresh")},dropPortletButton:function(e,g){if(g.draggable.hasClass("already-dropped")){return}g.draggable.addClass("already-dropped");var f=g.draggable;var h=c(this);var i=h.parents(".slot:first");d.ajax.post("drag-template-portlet.json",{portlet_name:f.data("ams-portlet-name"),slot_name:i.data("ams-slot-name")},function(j){d.ajax.handleJSON(j)})},editPortlet:function(){return function(f){if(!f.hasClass("portlet")){f=f.parents(".portlet:first")}var g=f.parents(".slot:first");var e=g.parents(".row:first");d.dialog.open("portlet-properties.html?form.widgets.portlet_id="+f.data("ams-portlet-id"))}},editPortletCallback:function(e){if(e.preview){var f=c("#portal_config");var g=c('.portlet[data-ams-portlet-id="'+e.portlet_id+'"]',f);c(".preview",g).html(e.preview);d.initContent(c(".preview",g))}},overPortlets:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("portlet-highlight").css("height",c(f.item).outerHeight())},sortPortlets:function(f,i){if(i.item.hasClass("already-dropped")){return}var j=i.item;var h=j.parents(".slot");var g=c(".portlet",h);var e={from:j.data("ams-portlet-id"),to:{slot:h.data("ams-slot-name"),portlet_ids:g.listattr("data-ams-portlet-id")}};d.ajax.post("set-template-portlet-order.json",{order:JSON.stringify(e)})},deletePortlet:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("portlet")){e=e.parents(".portlet")}d.ajax.post("delete-template-portlet.json",{portlet_id:e.data("ams-portlet-id")},function(g){if(g.status==="success"){e.remove();c(".portlet","#portal_config").each(function(){c(this).removeData()})}})}})}}}};b.PyAMS_portal=a})(jQuery,this);
\ No newline at end of file
+(function(c,b){var d=b.MyAMS;var a={template:{initConfig:function(){var e=c("#portal_config");if(e.data("ams-allowed-change")){c(".rows",e).addClass("sortable");c(".slots",e).addClass("sortable");c(".slot",e).addClass("resizable");c(".portlets",e).addClass("sortable");d.plugins.enabled.sortable(e);d.plugins.enabled.resizable(e);c(".btn-row",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".rows"});c(".rows",e).droppable({accept:".btn-row",drop:a.template.dropRowButton});c(".btn-slot",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".slots"});c(".slots",e).droppable({accept:".btn-slot",drop:a.template.dropSlotButton});c(".btn-portlet",".btn-toolbar").draggable({cursor:"move",helper:"clone",revert:"invalid",connectToSortable:".portlets"});c(".portlets",e).droppable({accept:".btn-portlet",hoverClass:"portlets-hover",activeClass:"portlets-active",drop:a.template.dropPortletButton})}},selectDisplay:function(){var e=c(this).val();d.ajax.post("get-slots-width.json",{device:e},function(f){var g=c("#portal_config");g.removeClassPrefix("container-");if(e){g.addClass("container-"+e)}c(".slot",g).removeClassPrefix("col-");for(var h in f){if(!f.hasOwnProperty(h)){continue}var i=f[h];var k=c('.slot[data-ams-slot-name="'+h+'"]',g);if(e){k.addClass("col-"+i[e])}else{for(var j in i){if(!i.hasOwnProperty(j)){continue}k.addClass("col-"+j+"-"+i[j])}}}})},addRow:function(){return function(){c(this).parents(".btn-group").removeClass("open");d.ajax.post("add-template-row.json",{},function(e){var f=e.row_id;var g=c(".rows","#portal_config");c("<div></div>").addClass("row context-menu").attr("data-ams-row-id",f).append(c("<span></span>").addClass("row_id label label-success pull-right").text(f)).append(c("<div></div>").addClass("slots").sortable({placeholder:"slot-highlight",connectWith:".slots",over:a.template.overSlots,stop:a.template.sortSlots}).droppable({accept:".btn-slot",drop:a.template.dropSlotButton})).contextMenu({menuSelector:"#rowMenu",menuSelected:d.helpers.contextMenuHandler}).appendTo(g);g.sortable("refresh")})}},dropRowButton:function(e,f){if(f.draggable.hasClass("already-dropped")){return}f.draggable.addClass("already-dropped");d.ajax.post("add-template-row.json",{},function(g){var h=g.row_id;var i=c(".rows","#portal_config");f.draggable.removeClassPrefix("btn").removeClassPrefix("ui-").removeClass("already-dropped").removeAttr("style").addClass("row context-menu").attr("data-ams-row-id",h).empty().append(c("<span></span>").addClass("row_id label label-success pull-right").text(h)).append(c("<div></div>").addClass("slots").sortable({placeholder:"slot-highlight",connectWith:".slots",over:a.template.overSlots,stop:a.template.sortSlots}).droppable({accept:".btn-slot",drop:a.template.dropSlotButton})).contextMenu({menuSelector:"#rowMenu",menuSelected:d.helpers.contextMenuHandler});a.template.sortRows();i.sortable("refresh")})},overRows:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("row-highlight").css("height",c(f.item).outerHeight())},sortRows:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var e=c("#portal_config");var f=c(".row",e).listattr("data-ams-row-id");d.ajax.post("set-template-row-order.json",{rows:JSON.stringify(f)},function(i){if(i.status==="success"){c(".row",e).each(function(j){c(this).attr("data-ams-row-id",j);c("span.row_id",c(this)).text(j)})}})},deleteRow:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("row")){e=e.parents(".row")}d.ajax.post("delete-template-row.json",{row_id:e.data("ams-row-id")},function(g){if(g.status==="success"){e.remove();c(".row","#portal_config").each(function(h){c(this).removeData().attr("data-ams-row-id",h);c("span.row_id",c(this)).text(h)})}})}})}},addSlotCallback:function(e){var h=c(".slots",'.row[data-ams-row-id="'+e.row_id+'"]');var g=e.slot_name;var f=c("<div></div>").addClass("slot context-menu col col-xs-12 col-sm-12 col-md-12 col-lg-12 resizable").attr("data-ams-slot-name",g).append(c("<div></div>").addClass("header padding-x-5").text(g)).append(c("<div></div>").addClass("portlets").sortable({placeholder:"portlet-highlight",connectWith:".portlets",over:a.template.overPortlets,stop:a.template.sortPortlets}).droppable({accept:".btn-portlet",hoverClass:"portlets-hover",activeClass:"portlets-active",drop:a.template.dropPortletButton})).append(c("<div></div>").addClass("clearfix")).contextMenu({menuSelector:"#slotMenu",menuSelected:d.helpers.contextMenuHandler});var i=c(".btn-slot",h);if(i.exists()){i.replaceWith(f);c(".slot",h).each(function(){c(this).removeData()});a.template.sortSlots()}else{f.appendTo(h)}f.resizable({start:a.template.startSlotResize,stop:a.template.stopSlotResize,handles:"e"});h.sortable("refresh")},dropSlotButton:function(f,g){if(g.draggable.hasClass("already-dropped")){return}g.draggable.addClass("already-dropped");var e=g.helper.parents(".row:first").data("ams-row-id");d.dialog.open("add-template-slot.html?form.widgets.row_id="+e)},startSlotResize:function(f,h){var j=h.element;var i=j.parents(".slots:first");var e=(i.innerWidth()-110)/12;var g=j.height();h.element.resizable("option","grid",[e,g]);h.element.resizable("option","minWidth",e);h.element.resizable("option","minHeight",g);h.element.resizable("option","maxWidth",i.innerWidth());h.element.resizable("option","maxHeight",g)},stopSlotResize:function(h,j){var l=j.element;var k=l.parents(".slots:first");var f=(k.innerWidth()-10)/12;var i=Math.round(c(l).width()/f);var g=c("#device_selector").val();if(!g){var e=c("body").width();if(e>1170){g="lg"}else{if(e>970){g="md"}else{if(e>750){g="sm"}else{g="xs"}}}}d.ajax.post("set-slot-width.json",{slot_name:l.data("ams-slot-name"),device:g,width:i},function(m){l.removeClassPrefix("col-");l.removeAttr("style");var n=l.data("ams-slot-name");var o=m[n];if(g){l.addClass("col-"+g+"-"+o[g])}else{l.addClass("col-"+o[g])}})},editSlot:function(){return function(e){if(!e.hasClass("slot")){e=e.parents(".slot")}d.dialog.open("slot-properties.html?form.widgets.slot_name="+e.data("ams-slot-name"))}},editSlotCallback:function(e){var g=c('.slot[data-ams-slot-name="'+e.slot_name+'"]');g.attr("class","slot context-menu col");var f=c("#device_selector").val();if(f){g.addClass("col-"+e.width[f])}else{for(f in e.width){if(!e.width.hasOwnProperty(f)){continue}g.addClass("col-"+f+"-"+e.width[f])}}},overSlots:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("slot-highlight").css("height",c(f.item).outerHeight())},sortSlots:function(g,h){if(h&&h.item.hasClass("already-dropped")){return}var f=c("#portal_config");var e={};c(".row",f).each(function(){var j=c(this);var i=[];c(".slot",j).each(function(){i.push(c(this).data("ams-slot-name"))});e[parseInt(j.attr("data-ams-row-id"))]=i});d.ajax.post("set-template-slot-order.json",{order:JSON.stringify(e)})},deleteSlot:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("slot")){e=e.parents(".slot")}d.ajax.post("delete-template-slot.json",{slot_name:e.data("ams-slot-name")},function(g){if(g.status==="success"){e.remove();c(".slot","#portal_config").each(function(){c(this).removeData()})}})}})}},addPortletCallback:function(e){var f=c(".portlets",'.slot[data-ams-slot-name="'+e.slot_name+'"]');var h=c("<div></div>").addClass("portlet context-menu").attr("data-ams-portlet-id",e.portlet_id).append(c("<div></div>").addClass("header padding-x-5").text(e.label)).append(c("<div></div>").addClass("preview").html(e.preview||"")).contextMenu({menuSelector:"#portletMenu",menuSelected:d.helpers.contextMenuHandler});d.initContent(c(".preview",h));var g=c(".btn-portlet",f);if(g.exists()){g.replaceWith(h);c(".portlet",f).each(function(){c(this).removeData()});a.template.sortPortlets(null,{item:h})}else{h.appendTo(f)}f.sortable("refresh")},dropPortletButton:function(e,g){if(g.draggable.hasClass("already-dropped")){return}g.draggable.addClass("already-dropped");var f=g.draggable;var h=c(this);var i=h.parents(".slot:first");d.ajax.post("drag-template-portlet.json",{portlet_name:f.data("ams-portlet-name"),slot_name:i.data("ams-slot-name")},function(j){d.ajax.handleJSON(j)})},editPortlet:function(){return function(f){if(!f.hasClass("portlet")){f=f.parents(".portlet:first")}var g=f.parents(".slot:first");var e=g.parents(".row:first");d.dialog.open("portlet-properties.html?form.widgets.portlet_id="+f.data("ams-portlet-id"))}},editPortletCallback:function(e){if(e.preview){var f=c("#portal_config");var g=c('.portlet[data-ams-portlet-id="'+e.portlet_id+'"]',f);var h=c(".header",g);if(e.inherit_parent){c("i",h).removeClass("fa-chain-broken")}else{c("i",h).addClass("fa-chain-broken")}c(".preview",g).html(e.preview);d.initContent(c(".preview",g))}},overPortlets:function(e,f){c(f.placeholder).attr("class",c(f.item).attr("class")).removeClassPrefix("ui-").addClass("portlet-highlight").css("height",c(f.item).outerHeight())},sortPortlets:function(f,i){if(i.item.hasClass("already-dropped")){return}var j=i.item;var h=j.parents(".slot");var g=c(".portlet",h);var e={from:j.data("ams-portlet-id"),to:{slot:h.data("ams-slot-name"),portlet_ids:g.listattr("data-ams-portlet-id")}};d.ajax.post("set-template-portlet-order.json",{order:JSON.stringify(e)})},deletePortlet:function(){return function(e){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(f){if(f===d.i18n.BTN_OK){if(!e.hasClass("portlet")){e=e.parents(".portlet")}d.ajax.post("delete-template-portlet.json",{portlet_id:e.data("ams-portlet-id")},function(g){if(g.status==="success"){e.remove();c(".portlet","#portal_config").each(function(){c(this).removeData()})}})}})}}}};b.PyAMS_portal=a})(jQuery,this);
\ No newline at end of file