mediacms/static/js/manage-comments.js

1 line
11 KiB
JavaScript
Raw Permalink Normal View History

!function(){"use strict";var t,e={25381:function(t,e,n){var r=n(92541),o=(n(25101),n(13080),n(52004),n(28407),n(56394),n(38288),n(55677),n(92129),n(24655),n(35466)),i=n(3074),u=n.n(i),a=n(43613),c=n(20541),l=n(25910),s=n(9700);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function y(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?d(t):e}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e,n){return t+"?"+e+(""===e?"":"&")+"page="+n}var g=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}(f,t);var e,n,r,i,u=(r=f,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=b(r);if(i){var n=b(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return y(this,t)});function f(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(e=u.call(this,t,"manage-comments")).state={resultsCount:null,requestUrl:a.ApiUrlContext._currentValue.manage.comments,currentPage:1,sortingArgs:"",sortBy:"add_date",ordering:"desc",refresh:0},e.getCountFunc=e.getCountFunc.bind(d(e)),e.onTablePageChange=e.onTablePageChange.bind(d(e)),e.onColumnSortClick=e.onColumnSortClick.bind(d(e)),e.onItemsRemoval=e.onItemsRemoval.bind(d(e)),e.onItemsRemovalFail=e.onItemsRemovalFail.bind(d(e)),e}return e=f,(n=[{key:"onTablePageChange",value:function(t,e){this.setState({currentPage:e,requestUrl:v(a.ApiUrlContext._currentValue.manage.comments,this.state.sortingArgs,e)})}},{key:"getCountFunc",value:function(t){this.setState({resultsCount:t})}},{key:"onColumnSortClick",value:function(t,e){var n="sort_by="+t+"&ordering="+e;this.setState({sortBy:t,ordering:e,sortingArgs:n,requestUrl:v(a.ApiUrlContext._currentValue.manage.comments,n,this.state.currentPage)})}},{key:"onItemsRemoval",value:function(t){this.setState({resultsCount:null,refresh:this.state.refresh+1,requestUrl:a.ApiUrlContext._currentValue.manage.comments},(function(){t?c.PageActions.addNotification("The comments deleted successfully.","commentsRemovalSucceed"):c.PageActions.addNotification("The comment deleted successfully.","commentRemovalSucceed")}))}},{key:"onItemsRemovalFail",value:function(t){t?c.PageActions.addNotification("The comments removal failed. Please try again.","commentsRemovalFailed"):c.PageActions.addNotification("The comment removal failed. Please try again.","commentRemovalFailed")}},{key:"pageContent",value:function(){return o.createElement(l.MediaListWrapper,{title:this.props.title+(null===this.state.resultsCount?"":" ("+this.state.resultsCount+")"),className:"search-results-wrap items-list-hor"},o.createElement(s.d,{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(e.prototype,n),f}(n(58204).T);g.propTypes={title:u().string.isRequire