mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
1 line
8.9 KiB
JavaScript
1 line
8.9 KiB
JavaScript
!function(t){function i(e){if(n[e])return n[e].exports;var a=n[e]={i:e,l:!1,exports:{}};return t[e].call(a.exports,a,a.exports,i),a.l=!0,a.exports}var n={};i.m=t,i.c=n,i.d=function(t,n,e){i.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:e})},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=0)}([function(t,i,n){n(1),n(2),t.exports=n(3)},function(t,i){!function(t){t.entwine("ss",function(t){t.entwine("colymba",function(t){t(".bulkManagerOptions").entwine({onmatch:function(){var i=this.parents("thead"),n=i.find("tr"),e=[".filter-header",".sortable-header"],a=i.find(e.join(",")),s=n.index(this),o=n.length-1;a.each(function(t,i){var e=n.index(i);e<o&&(o=e)}),s>o&&n.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(i){var n=t(i.target).find("input");t(n).prop("checked")?t(n).prop("checked",!1):t(n).prop("checked",!0)}}),t("td.col-bulkSelect input").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(i){t(this).parents(".grid-field__table").find("input.bulkSelectAll").prop("checked","")}}),t("input.bulkSelectAll").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(){var i=t(this).prop("checked");t(this).parents(".grid-field__table").find("td.col-bulkSelect input").prop("checked",i).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(i){var n=t(this).val(),e=t(this).parents(".bulkManagerOptions"),a=e.find(".doBulkActionButton"),s=a.data("config"),o=e.find(".doBulkActionButton .ui-icon");t.each(s,function(t,i){t!=n&&o.removeClass("btn-icon-"+i.icon)}),o.addClass("btn-icon-"+s[n].icon),s[n].isDestructive?a.addClass("ss-ui-action-destructive"):a.removeClass("ss-ui-action-destructive")}}),t(".doBulkActionButton").entwine({onmatch:function(){},onunmatch:function(){},getActionURL:function(t,i){var n=(new Date).getTime();return i=i.split("?"),t=t?"/"+t:"",i=i[1]?i[0]+t+"?"+i[1]+"&cacheBuster="+n:i[0]+t+"?cacheBuster="+n},onclick:function(i){var n=t(this).parents(".bulkManagerOptions"),e=n.find("select.bulkActionName").val(),a=t(this).parents(".bulkManagerOptions").find("input.bulkSelectAll:first").getSelectRecordsID();this.doBulkAction(e,a)},doBulkAction:function(i,n,e,a){var s=t(this).parents(".bulkManagerOptions"),o=s.find("a.doBulkActionButton"),d=o.data("config"),l=this.getActionURL(i,t(this).data("url")),r={records:n};if(n.length<=0)return void alert(ss.i18n._t("GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT"));if(d[i].isDestructive&&!confirm(ss.i18n._t("GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION")))return e&&a&&e.call(a,!1),!1;if(o.addClass("loading"),d[i].isAjax)t.ajax({url:l,data:r,type:"POST",context:t(this)}).done(function(i,n,s){o.removeClass("loading"),e&&a?e.call(a,i):t(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload()});else{l=l+"&"+("records[]="+n.join("&records[]=")),window.location.href=l}}})})})}(jQuery)},function(t,i){!function(t){t.entwine("colymba",function(t){t("#bulkEditToggle").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(i){var n=this.parents("form").find(".ss-toggle .ui-accordion-header"),e=this.data("state");e=e&&"close"!==e?"close":"open",n.each(function(){var i=t(this);"open"!==e||i.hasClass("ui-state-active")||i.click(),"close"===e&&i.hasClass("ui-state-active")&&i.click()}),this.data("state",e)}}),t(".bulkEditingFieldHolder").entwine({onmatch:function(){},onunmatch:function(){},onchange:function(){this.removeClass("updated"),this.hasClass("hasUpdate")||this.addClass("hasUpdate")}})})}(jQuery)},function(t,i){!function(t){t.entwine("ss",function(t){t.entwine("colymba",function(t){t(".bulkUploader").entwine({onmatch:function(){var t=this.parents("thead").find("tr"),i=this.clone();t.index(this)>1&&(i.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"),i=t.length,n=t.filter(".done"),e=n.length,a=t.not(n).find(".ui-state-warning-text,.ui-state-error-text"),s=a.length;this.parents(".ss-uploadfield").find(".colymba-bulkupload-buttons").refresh(i,e,s)}}),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,i,n){var e=this.find(".colymba-bulkupload-info"),a=this.find(".bulkUploadEditButton"),s=this.find(".bulkUploadCancelButton"),o=this.find(".bulkUploadFinishButton"),d=this.find(".bulkUploadClearErrorButton");t>0?(this.css({display:"block"}),e.html(ss.i18n.sprintf(ss.i18n._t("GRIDFIELD_BULK_UPLOAD.PROGRESS_INFO"),t,i,n)),s.removeClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","false").removeAttr("disabled"),i+n<t?this.hasClass("loading")||(this.addClass("loading"),o.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","disabled")):(this.removeClass("loading"),o.removeClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","false").removeAttr("disabled")),t===i?a.removeClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","false").removeAttr("disabled"):a.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"),n>0?d.removeClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","false").removeAttr("disabled"):d.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true")):(this.css({display:"none"}).removeClass("loading"),a.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"),s.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"),o.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"),d.addClass("ui-state-disabled ssui-button-disabled").attr("aria-disabled","true").attr("disabled","true"))}}),t(".bulkUploadClearErrorButton:not(.ui-state-disabled)").entwine({onmatch:function(){this.removeClass("action")},onunmatch:function(){},onclick:function(i){var n=this.parents(".bulkUpload"),e=n.find("li.ss-uploadfield-item .ui-state-warning-text,li.ss-uploadfield-item .ui-state-error-text").parents("li");t(e.get().reverse()).each(function(i,n){t(this).remove()})}}),t(".bulkUploadCancelButton:not(.ui-state-disabled)").entwine({onmatch:function(){this.removeClass("action")},onunmatch:function(){},onclick:function(){var i,n=this.parents(".bulkUpload"),e=n.find("li.ss-uploadfield-item"),a=e.filter("[data-recordid]"),s=e.not(a),o=n.parents(".ss-gridfield-table").find(".doBulkActionButton");s.each(function(i,n){t(this).remove()}),o.length>0&&(i=a.map(function(){return parseInt(t(this).data("recordid"))}).get(),this.addClass("loading"),o.doBulkAction("delete",i,this.cancelCallback,this))},cancelCallback:function(i){var n,e=this.parents(".bulkUpload"),a=e.find("li.ss-uploadfield-item");i&&(n=i.records,a.each(function(i,e){var a=t(this),s=parseInt(a.data("recordid"));-1!==n.indexOf(s)&&a.remove()}),t(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload()),this.removeClass("loading")}}),t(".bulkUploadFinishButton:not(.ui-state-disabled)").entwine({onmatch:function(){this.removeClass("action")},onunmatch:function(){},onclick:function(){var i=this.parents(".bulkUpload"),n=i.find("li.ss-uploadfield-item");this.addClass("loading"),n.each(function(i,n){t(this).remove()}),t(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload(),this.removeClass("loading")}}),t(".bulkUploadEditButton:not(.ui-state-disabled)").entwine({onmatch:function(){this.removeClass("action")},onunmatch:function(){},onclick:function(){var i,n=this.parents(".bulkUpload"),e=n.find("li.ss-uploadfield-item"),a=e.filter("[data-recordid]"),s=n.parents(".ss-gridfield-table").find(".doBulkActionButton");s.length>0&&(this.addClass("loading"),i=a.map(function(){return parseInt(t(this).data("recordid"))}).get(),s.doBulkAction("bulkedit",i))}})})})}(jQuery)}]); |