mediacms/static/js/manage-comments.js

1 wiersz
5.1 KiB
JavaScript

!function(){"use strict";var e={5047:function(e,t,n){var r=n(2667),o=(n(5101),n(6394),n(3080),n(4669),n(5466)),s=n(3074),i=n.n(s),u=n(8204),a=n(4426),l=n(8349),c=n(1397),f=n(1784);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){return!t||"object"!==m(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t,n){return e+"?"+t+(""===t?"":"&")+"page="+n}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(u,e);var t,n,r,s,i=(r=u,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=d(r);if(s){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return g(this,e)});function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=i.call(this,e,"manage-comments")).state={resultsCount:null,requestUrl:e.api_url,currentPage:1,sortingArgs:"",sortBy:"add_date",ordering:"desc",refresh:0},t.getCountFunc=t.getCountFunc.bind(y(t)),t.onTablePageChange=t.onTablePageChange.bind(y(t)),t.onColumnSortClick=t.onColumnSortClick.bind(y(t)),t.onItemsRemoval=t.onItemsRemoval.bind(y(t)),t.onItemsRemovalFail=t.onItemsRemovalFail.bind(y(t)),t}return t=u,(n=[{key:"onTablePageChange",value:function(e,t){this.setState({currentPage:t,requestUrl:b(this.props.api_url,this.state.sortingArgs,t)})}},{key:"getCountFunc",value:function(e){this.setState({resultsCount:e})}},{key:"onColumnSortClick",value:function(e,t){var n="sort_by="+e+"&ordering="+t;this.setState({sortBy:e,ordering:t,sortingArgs:n,requestUrl:b(this.props.api_url,n,this.state.currentPage)})}},{key:"onItemsRemoval",value:function(e){this.setState({resultsCount:null,refresh:this.state.refresh+1,requestUrl:this.props.api_url},(function(){e?l.wN("The comments deleted successfully.","commentsRemovalSucceed"):l.wN("The comment deleted successfully.","commentRemovalSucceed")}))}},{key:"onItemsRemovalFail",value:function(e){e?l.wN("The comments removal failed. Please try again.","commentsRemovalFailed"):l.wN("The comment removal failed. Please try again.","commentRemovalFailed")}},{key:"pageContent",value:function(){return o.createElement(c._,{title:this.props.title+(null===this.state.resultsCount?"":" ("+this.state.resultsCount+")"),className:"search-results-wrap items-list-hor"},o.createElement(f.x,{pageItems:50,manageType:"comments",key:this.state.requestUrl+"["+this.state.refresh+"]",itemsCountCallback:this.getCountFunc,requestUrl:this.state.requestUrl,onPageChange:this.onTablePageChange,sortBy:this.state.sortBy,ordering:this.state.ordering,onRowsDelete:this.onItemsRemoval,onRowsDeleteFail:this.onItemsRemovalFail,onClickColumnSort:this.onColumnSortClick}))}}])&&p(t.prototype,n),u}(u.T);v.propTypes={title:i().string.isRequired,api_url:i().string.isRequired},v.defaultProps={title:"Manage comments",api_url:a.Z.get("api-manage-comments")},(0,r.X)("page-manage-comments",v)}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.m=e,n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.j=800,function(){var e={800:0},t=[[5047,431]],r=function(){};function o(){for(var r,o=0;o<t.length;o++){for(var s=t[o],i=!0,u=1;u<s.length;u++){var a=s[u];0!==e[a]&&(i=!1)}i&&(t.splice(o--,1),r=n(n.s=s[0]))}return 0===t.length&&(n.x(),n.x=function(){}),r}n.x=function(){n.x=function(){},i=i.slice();for(var e=0;e<i.length;e++)s(i[e]);return(r=o)()};var s=function(o){for(var s,i,a=o[0],l=o[1],c=o[2],f=o[3],m=0,p=[];m<a.length;m++)i=a[m],n.o(e,i)&&e[i]&&p.push(e[i][0]),e[i]=0;for(s in l)n.o(l,s)&&(n.m[s]=l[s]);for(c&&c(n),u(o);p.length;)p.shift()();return f&&t.push.apply(t,f),r()},i=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[],u=i.push.bind(i);i.push=s}(),n.x()}();