mediacms/static/js/manage-comments.js

1 line
5.1 KiB
JavaScript
Raw Normal View History

2020-12-16 12:48:37 +01:00
!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(