src/pyams_skin/resources/js/myams-container.min.js
changeset 533 d21c81597338
parent 504 fb5a531cddbe
equal deleted inserted replaced
532:d787b89ba9b8 533:d21c81597338
     1 !function(i,a){var f=a.MyAMS;f.container={changeOrder:function(a,t){i('input[name="'+i(this).data("ams-input-name")+'"]',i(this)).val(t.join(";"))},deleteElement:function(){return function(){var r=i(this);f.skin&&f.skin.bigBox({title:f.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i>&nbsp; '+f.i18n.DELETE_WARNING,status:"info",buttons:f.i18n.BTN_OK_CANCEL},function(a){if(a===f.i18n.BTN_OK){var e=r.parents("tr").first(),n=e.parents("table").first(),t=e.data("ams-location")||n.data("ams-location")||"";t&&(t+="/");var s=e.data("ams-delete-target")||n.data("ams-delete-target")||"delete-element.json",i=e.data("ams-element-name");f.ajax&&f.ajax.post(t+s,{object_name:i},function(a,t){"success"===a.status?(n.hasClass("datatable")?n.dataTable().fnDeleteRow(e[0]):e.remove(),a.handle_json&&f.ajax&&f.ajax.handleJSON(a)):f.ajax&&f.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var e=i(this),a=e.parents("td").first(),t=e.parents("tr").first(),n=t.parents("table");i("i",e).attr("class","fa fa-fw fa-spinner fa-pulse"),f.ajax&&f.ajax.post(n.data("ams-location")+"/"+(a.data("ams-attribute-switcher")||n.data("ams-attribute-switcher")),{object_name:t.data("ams-element-name")},function(a,t){a.visible?i("i",e).attr("class","fa fa-fw fa-eye"):i("i",e).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var e=i(this),a=e.parents("td").first(),n=a.data("ams-switcher-attribute-name"),t=e.parents("tr").first(),s=t.parents("table");i("i",e).attr("class","fa fa-fw fa-spinner fa-pulse"),f.ajax&&f.ajax.post(s.data("ams-location")+"/"+(a.data("ams-attribute-switcher")||s.data("ams-attribute-switcher")),{object_name:t.data("ams-element-name")},function(a,t){a[n]||a.on?i("i",e).attr("class",s.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):i("i",e).attr("class",s.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}},exportTableToTSV:function(){return function(){var s=i(this);f.ajax&&f.ajax.check(a.saveAs,f.baseURL+"ext/js-filesaver"+f.devext+".js",function(){var a=i("table.datatable",s.parents(".ams-widget:first")),t=a.dataTable(),e="";i("th",a).each(function(a){0<a&&(e+="\t"),e+=i(this).text()}),e+="\n",i(t.fnGetData()).each(function(){i(this).each(function(a){0<a&&(e+="\t"),e+=this}),e+="\n"});var n=new Blob([e],{type:"text/tsv; charset=utf-8"});saveAs(n,"export.tsv")})}}}}(jQuery,this);
     1 !function(a,t){var e=t.MyAMS;e.container={changeOrder:function(t,e){a('input[name="'+a(this).data("ams-input-name")+'"]',a(this)).val(e.join(";"))},deleteElement:function(){return function(){var t=a(this);e.skin&&e.skin.bigBox({title:e.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i>&nbsp; '+e.i18n.DELETE_WARNING,status:"info",buttons:e.i18n.BTN_OK_CANCEL},function(a){if(a===e.i18n.BTN_OK){var s=t.parents("tr").first(),n=s.parents("table").first(),i=s.data("ams-location")||n.data("ams-location")||"";i&&(i+="/");var r=s.data("ams-delete-target")||n.data("ams-delete-target")||"delete-element.json",f=s.data("ams-element-name");e.ajax&&e.ajax.post(i+r,{object_name:f},function(a,t){"success"===a.status?(n.hasClass("datatable")?n.dataTable().fnDeleteRow(s[0]):s.remove(),a.handle_json&&e.ajax.handleJSON(a)):e.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var t=a(this),s=t.parents("td").first(),n=t.parents("tr").first(),i=n.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(i.data("ams-location")+"/"+(s.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:n.data("ams-element-name")},function(s,n){"success"===s.status?s.visible?a("i",t).attr("class","fa fa-fw fa-eye"):a("i",t).attr("class","fa fa-fw fa-eye-slash text-danger"):e.ajax.handleJSON(s)})}},switchElementAttribute:function(){return function(){var t=a(this),s=t.parents("td").first(),n=s.data("ams-switcher-attribute-name"),i=t.parents("tr").first(),r=i.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(r.data("ams-location")+"/"+(s.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(s,i){"success"===s.status?s[n]||s.on?a("i",t).attr("class",r.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):a("i",t).attr("class",r.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75"):e.ajax.handleJSON(s)})}},exportTableToTSV:function(){return function(){var s=a(this);e.ajax&&e.ajax.check(t.saveAs,e.baseURL+"ext/js-filesaver"+e.devext+".js",function(){var t=a("table.datatable",s.parents(".ams-widget:first")),e=t.dataTable(),n="";a("th",t).each(function(t){t>0&&(n+="\t"),n+=a(this).text()}),n+="\n",a(e.fnGetData()).each(function(){a(this).each(function(a){a>0&&(n+="\t"),n+=this}),n+="\n"});var i=new Blob([n],{type:"text/tsv; charset=utf-8"});saveAs(i,"export.tsv")})}}}}(jQuery,this);