GridFieldBulkEditingTools/client/dist/js/bulkTools.js
2018-02-27 15:08:39 +02:00

1 line
6.6 KiB
JavaScript

!function(t){function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}var e={};n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=0)}([function(t,n,e){e(1),e(2),t.exports=e(3)},function(t,n){!function(t){t.entwine("ss",function(t){t.entwine("colymba",function(t){t(".bulkManagerOptions").entwine({onmatch:function(){var n=this.parents("thead"),e=n.find("tr"),i=[".filter-header",".sortable-header"],s=n.find(i.join(",")),a=e.index(this),o=e.length-1;s.each(function(t,n){var i=e.index(n);i<o&&(o=i)}),a>o&&e.eq(o).insertAfter(t(this))},onunmatch:function(){}}),t("td.col-bulkSelect").entwine({onmatch:function(){},onunmatch:function(){},onmouseover:function(){t(this).parents(".ss-gridfield-item").find(".edit-link").removeClass("edit-link").addClass("tempDisabledEditLink")},onmouseout:function(){t(this).parents(".ss-gridfield-item").find(".tempDisabledEditLink").addClass("edit-link").removeClass("tempDisabledEditLink")},onclick:function(n){var e=t(n.target).find("input");t(e).prop("checked")?t(e).prop("checked",!1):t(e).prop("checked",!0)}}),t("td.col-bulkSelect input").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(n){t(this).parents(".grid-field__table").find("input.bulkSelectAll").prop("checked","")}}),t("input.bulkSelectAll").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(){var n=t(this).prop("checked");t(this).parents(".grid-field__table").find("td.col-bulkSelect input").prop("checked",n).trigger("change")},getSelectRecordsID:function(){return t(this).parents(".grid-field__table").find("td.col-bulkSelect input:checked").map(function(){return parseInt(t(this).data("record"))}).get()}}),t("select.bulkActionName").entwine({onmatch:function(){},onunmatch:function(){},onchange:function(n){var e=t(this).val(),i=t(this).parents(".bulkManagerOptions"),s=i.find(".doBulkActionButton"),a=s.data("config");if(t.each(a,function(t,n){t!=e&&s.removeClass(n.buttonClasses)}),!e)return void s.addClass("disabled");if(s.removeClass("disabled"),s.addClass(a[e].buttonClasses).addClass("btn-outline-secondary"),a[e].icon){var o=s.find("img");o.length?o.attr("src",a[e].icon):s.prepend('<img src="'+a[e].icon+'" alt="" />')}else s.find("img").remove();a[e].destructive?s.addClass("btn-outline-danger"):s.removeClass("btn-outline-danger")}}),t(".doBulkActionButton").entwine({onmatch:function(){},onunmatch:function(){},getActionURL:function(t,n){var e=(new Date).getTime();return n=n.split("?"),t=t?"/"+t:"",n=n[1]?n[0]+t+"?"+n[1]+"&cacheBuster="+e:n[0]+t+"?cacheBuster="+e},onclick:function(n){var e=t(this).parents(".bulkManagerOptions"),i=e.find("select.bulkActionName").val(),s=t(this).parents(".bulkManagerOptions").find("input.bulkSelectAll:first").getSelectRecordsID();this.doBulkAction(i,s)},doBulkAction:function(n,e,i,s){var a=t(this).parents(".bulkManagerOptions"),o=a.find("a.doBulkActionButton"),l=o.data("config"),d=this.getActionURL(n,t(this).data("url")),c={records:e};if(e.length<=0)return void alert(ss.i18n._t("GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT"));if(l[n].destructive&&!confirm(ss.i18n._t("GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION")))return i&&s&&i.call(s,!1),!1;if(o.addClass("loading"),l[n].xhr)t.ajax({url:d,data:c,type:"POST",context:t(this)}).done(function(n,e,a){o.removeClass("loading"),i&&s?i.call(s,n):t(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload()});else{d=d+"&"+("records[]="+e.join("&records[]=")),window.location.href=d}}})})})}(jQuery)},function(t,n){!function(t){t.entwine("colymba",function(t){t("#bulkEditToggle").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(n){var e=this.parents("form").find(".ss-toggle .ui-accordion-header"),i=this.data("state");i=i&&"close"!==i?"close":"open",e.each(function(){var n=t(this);"open"!==i||n.hasClass("ui-state-active")||n.click(),"close"===i&&n.hasClass("ui-state-active")&&n.click()}),this.data("state",i)}}),t(".bulkEditingFieldHolder").entwine({onmatch:function(){},onunmatch:function(){},onchange:function(){this.removeClass("updated"),this.hasClass("hasUpdate")||this.addClass("hasUpdate")}})})}(jQuery)},function(t,n){!function(t){t.entwine("ss",function(t){t.entwine("colymba",function(t){t(".bulkUploader").entwine({onmatch:function(){var t=this.parents("thead").find("tr"),n=this.clone();t.index(this)>1&&(n.insertAfter(t.eq(0)),this.remove())},onunmatch:function(){}}),t("ul.ss-uploadfield-files").entwine({onmatch:function(){},onunmatch:function(){},trackProgress:function(){var t=this.find("li.ss-uploadfield-item"),n=t.length,e=t.filter(".done"),i=e.length,s=t.not(e).find(".ui-state-warning-text,.ui-state-error-text"),a=s.length;this.parents(".ss-uploadfield").find(".colymba-bulkupload-buttons").refresh(n,i,a)}}),t("li.ss-uploadfield-item").entwine({onmatch:function(){this.parents("ul.ss-uploadfield-files").trackProgress()},onunmatch:function(){t("ul.ss-uploadfield-files").trackProgress()}}),t("li.ss-uploadfield-item .ui-state-warning-text,li.ss-uploadfield-item .ui-state-error-text").entwine({onmatch:function(){this.parents("ul.ss-uploadfield-files").trackProgress()},onunmatch:function(){t("ul.ss-uploadfield-files").trackProgress()}}),t(".colymba-bulkupload-buttons").entwine({onmatch:function(){},onunmatch:function(){},refresh:function(t,n,e){var i=this.find(".colymba-bulkupload-info"),s=this.find(".bulkUploadFinishButton");t>0?(this.css({display:"block"}),i.html(ss.i18n.sprintf(ss.i18n._t("GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO"),t,n,e)),n+e<t?this.hasClass("loading")||(this.addClass("loading"),s.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","disabled")):(this.removeClass("loading"),s.removeClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","false").removeAttr("disabled"))):(this.css({display:"none"}).removeClass("loading"),s.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"),$clearErrorBtn.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"))}}),t(".bulkUploadFinishButton:not(.ui-state-disabled)").entwine({onmatch:function(){this.removeClass("action")},onunmatch:function(){},onclick:function(){var n=this.parents(".bulkUpload"),e=n.find("li.ss-uploadfield-item");this.addClass("loading"),e.each(function(n,e){t(this).remove()}),t(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload(),this.removeClass("loading")}})})})}(jQuery)}]);