diff --git a/admin/client/dist/js/bundle.js b/admin/client/dist/js/bundle.js index d4debf35d..1ecd296c0 100644 --- a/admin/client/dist/js/bundle.js +++ b/admin/client/dist/js/bundle.js @@ -159,7 +159,7 @@ return Q=t.runOnLoop||t.runOnContext,u()}catch(r){return f()}}function m(e,t){va void 0===r[ae]&&M(r) var a=i._state return a?!function(){var e=n[a-1] -J(function(){return F(a,r,e,i._result)})}():j(i,r,e,t),r}function g(e){var t=this +J(function(){return A(a,r,e,i._result)})}():j(i,r,e,t),r}function g(e){var t=this if(e&&"object"==typeof e&&e.constructor===t)return e var n=new t(v) return P(n,e),n}function v(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){ @@ -170,17 +170,17 @@ i||(i=!0,k(e,t))},"Settle: "+(e._label||" unknown promise")) }function P(t,n){t===n?k(t,y()):e(n)?E(t,n,_(n)):S(t,n)}function O(e){e._onerror&&e._onerror(e._result),x(e)}function S(e,t){e._state===oe&&(e._result=t,e._state=se,0!==e._subscribers.length&&J(x,e))}function k(e,t){ e._state===oe&&(e._state=le,e._result=t,J(O,e))}function j(e,t,n,i){var r=e._subscribers,a=r.length e._onerror=null,r[a]=t,r[a+se]=n,r[a+le]=i,0===a&&e._state&&J(x,e)}function x(e){var t=e._subscribers,n=e._state -if(0!==t.length){for(var i=void 0,r=void 0,a=e._result,o=0;o127?"x":A[M] -if(!D.match(b)){var U=I.slice(0,S),L=I.slice(S+1),B=A.match(_) +if(!R)for(var I=this.hostname.split(/\./),S=0,A=I.length;S127?"x":F[M] +if(!D.match(b)){var U=I.slice(0,S),L=I.slice(S+1),B=F.match(_) B&&(U.push(B[1]),L.unshift(B[2])),L.length&&(s="/"+L.join(".")+s),this.hostname=U.join(".") break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=l.toASCII(this.hostname)) var H=this.port?":"+this.port:"",$=this.hostname||"" -this.host=$+H,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!w[h])for(var S=0,F=m.length;S0)&&n.host.split("@") P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return b=b||n.host&&w.length,b&&!x&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")), n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=d.exec(e) -t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){var i;(function(e,r){!function(a){function o(e){throw RangeError(A[e])}function s(e,t){ +t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){var i;(function(e,r){!function(a){function o(e){throw RangeError(F[e])}function s(e,t){ for(var n=e.length,i=[];n--;)i[n]=t(e[n]) return i}function l(e,t){var n=e.split("@"),i="" -n.length>1&&(i=n[0]+"@",e=n[1]),e=e.replace(F,".") +n.length>1&&(i=n[0]+"@",e=n[1]),e=e.replace(A,".") var r=e.split("."),a=s(r,t).join(".") return i+a}function u(e){for(var t=[],n=0,i=e.length,r,a;n=55296&&r<=56319&&n= 0x80 (not a basic code point)", +var w,C=2147483647,T=36,E=1,P=26,O=38,S=700,k=72,j=128,x="-",R=/^xn--/,I=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)", "invalid-input":"Invalid input"},D=T-E,M=Math.floor,N=String.fromCharCode,U w={version:"1.3.2",ucs2:{decode:u,encode:c},decode:h,encode:m,toASCII:v,toUnicode:g},i=function(){return w}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}(this)}).call(t,n(15)(e),function(){return this}()) @@ -1131,7 +1131,7 @@ t.length&&t.remove(),n=$.path.addSearchParams(n,{tempid:e,BackURL:window.locatio }}),$(".leftandmain-logindialog").entwine({onmatch:function j(){this._super(),this.ssdialog({iframeUrl:this.data("url"),dialogClass:"leftandmain-logindialog-dialog",autoOpen:!0,minWidth:500,maxWidth:500, minHeight:370,maxHeight:400,closeOnEscape:!1,open:function e(){$(".ui-widget-overlay").addClass("leftandmain-logindialog-overlay")},close:function t(){$(".ui-widget-overlay").removeClass("leftandmain-logindialog-overlay") -}})},onunmatch:function x(){this._super()},open:function R(){this.ssdialog("open")},close:function I(){this.ssdialog("close")},toggle:function F(e){this.is(":visible")?this.close():this.open()},reauthenticate:function A(e){ +}})},onunmatch:function x(){this._super()},open:function R(){this.ssdialog("open")},close:function I(){this.ssdialog("close")},toggle:function A(e){this.is(":visible")?this.close():this.open()},reauthenticate:function F(e){ "undefined"!=typeof e.SecurityID&&$(":input[name=SecurityID]").val(e.SecurityID),"undefined"!=typeof e.TempID&&$("body").data("member-tempid",e.TempID),this.close()}}),$("form.loading,.cms-content.loading,.cms-content-fields.loading,.cms-content-view.loading").entwine({ onmatch:function D(){this.append('
'),this._super()},onunmatch:function M(){this.find(".cms-content-loading-overlay,.cms-content-loading-spinner").remove(), this._super()}}),$(".cms .cms-panel-link").entwine({onclick:function N(e){if($(this).hasClass("external-link"))return void e.stopPropagation() @@ -1387,7 +1387,7 @@ return t.toggle(),!1}}),e(".cms .profile-link").entwine({onclick:function j(){re onadd:function x(){var t=!!e(".cms-menu").getPersistedStickyState() this.toggleCSS(t),this.toggleIndicator(t),this._super()},toggleCSS:function R(e){this[e?"addClass":"removeClass"]("active")},toggleIndicator:function I(e){this.next(".sticky-status-indicator").text(e?"fixed":"auto") -},onclick:function F(){var e=this.closest(".cms-menu"),t=e.getPersistedCollapsedState(),n=e.getPersistedStickyState(),i=void 0===n?!this.hasClass("active"):!n +},onclick:function A(){var e=this.closest(".cms-menu"),t=e.getPersistedCollapsedState(),n=e.getPersistedStickyState(),i=void 0===n?!this.hasClass("active"):!n void 0===t?e.setPersistedCollapsedState(e.hasClass("collapsed")):void 0!==t&&i===!1&&e.clearPersistedCollapsedState(),e.setPersistedStickyState(i),this.toggleCSS(i),this.toggleIndicator(i),this._super() }})})},function(e,t,n){"use strict" @@ -1458,8 +1458,8 @@ this.addClass("active").siblings().removeClass("active"),e(".cms-preview").chang }}),e(".preview-mode-selector select").entwine({onchange:function I(t){this._super(t),t.preventDefault() var n=e(this).val() -e(".cms-preview").changeMode(n)}}),e(".cms-container--content-mode").entwine({onmatch:function F(){e(".cms-preview .result-selected").hasClass("font-icon-columns")&&statusMessage(s["default"]._t("LeftAndMain.DISABLESPLITVIEW","Screen too small to show site preview in split mode"),"error"), -this._super()}}),e(".preview-size-selector").entwine({changeVisibleSize:function A(e){this.find("select").val(e).trigger("chosen:updated")._addIcon()}}),e(".preview-size-selector select").entwine({onchange:function D(t){ +e(".cms-preview").changeMode(n)}}),e(".cms-container--content-mode").entwine({onmatch:function A(){e(".cms-preview .result-selected").hasClass("font-icon-columns")&&statusMessage(s["default"]._t("LeftAndMain.DISABLESPLITVIEW","Screen too small to show site preview in split mode"),"error"), +this._super()}}),e(".preview-size-selector").entwine({changeVisibleSize:function F(e){this.find("select").val(e).trigger("chosen:updated")._addIcon()}}),e(".preview-size-selector select").entwine({onchange:function D(t){ t.preventDefault() var n=e(this).val() e(".cms-preview").changeSize(n)}}),e(".preview-selector select.preview-dropdown").entwine({"onchosen:ready":function M(){this._super(),this._addIcon()},_addIcon:function N(){var e=this.find(":selected"),t=e.attr("data-icon"),n=this.parent().find(".chosen-container a.chosen-single"),i=n.attr("data-icon") @@ -1777,7 +1777,7 @@ i.setCurrentXhr(null),a.jstree("destroy").bind("loaded.jstree",function(e,r){t.e var r=n.inst.get_checked(null,!0) i.setValue(t.map(r,function(e,n){return t(e).data("id")})),i.setTitle(t.map(r,function(e,t){return n.inst.get_text(e)})),i.data("metadata",t.map(r,function(e,n){return{id:t(e).data("id"),metadata:t(e).getMetaData() }}))})}}),this.setCurrentXhr(o)},getValue:function I(){var e=this._super() -return e.split(/ *, */)},setValue:function F(e){this._super(t.isArray(e)?e.join(","):e)},setTitle:function A(e){this._super(t.isArray(e)?e.join(", "):e)},updateTitle:function D(){}}),t(".TreeDropdownField input[type=hidden]").entwine({ +return e.split(/ *, */)},setValue:function A(e){this._super(t.isArray(e)?e.join(","):e)},setTitle:function F(e){this._super(t.isArray(e)?e.join(", "):e)},updateTitle:function D(){}}),t(".TreeDropdownField input[type=hidden]").entwine({ onadd:function M(){this._super(),this.bind("change.TreeDropdownField",function(){t(this).getField().updateTitle()})},onremove:function N(){this._super(),this.unbind(".TreeDropdownField")}})})}).call(t,n(1)) },,,function(module,exports,__webpack_require__){"use strict" @@ -1868,13 +1868,13 @@ l?e.ajax({url:e.path.addSearchParams(this.attr("action").replace("LinkForm","get }}):n.resolve([]) break -default:n.reject(_i18n2["default"]._t("HtmlEditorField.ANCHORSNOTSUPPORTED","Anchors are not supported for this link type."))}return n.promise()},updateAnchorSelector:function F(){var t=this,n=this.find(":input[name=AnchorSelector]"),i=this.getAnchors() +default:n.reject(_i18n2["default"]._t("HtmlEditorField.ANCHORSNOTSUPPORTED","Anchors are not supported for this link type."))}return n.promise()},updateAnchorSelector:function A(){var t=this,n=this.find(":input[name=AnchorSelector]"),i=this.getAnchors() n.empty(),n.append(e('")),i.done(function(t){if(n.empty(),n.append(e('")), t)for(var i=0;i'+t[i]+""))}).fail(function(t){n.empty(),n.append(e('"))}),e.browser.msie&&n.hide().show() -},updateFromEditor:function A(){var e=/<\S[^><]*>/g,t,n=this.getCurrentLink() +},updateFromEditor:function F(){var e=/<\S[^><]*>/g,t,n=this.getCurrentLink() if(n)for(t in n){var i=this.find(":input[name="+t+"]"),r=n[t] "string"==typeof r&&(r=r.replace(e,"")),i.is(":checkbox")?i.prop("checked",r).change():i.is(":radio")?i.val([r]).change():"file"==t?(i=this.find(':input[name="'+t+'[Uploads][]"]'),i=i.parents(".ss-uploadfield"), function a(e,t){e.getConfig()?e.attachFiles([t]):setTimeout(function(){a(e,t)},50)}(i,r)):i.val(r).change()}},getCurrentLink:function D(){var e=this.getSelection(),t="",n="",i="",r="insert",a="",o=null @@ -1982,7 +1982,7 @@ n.addClass("ui-state-success-text"))),n.attr("title",i).text(i)}}),e('form.htmle var e=this this.bind("change",function(){var t=e.closest("form").find(".grid-field") t.setState("ParentID",e.getValue()),t.reload()})}}),e(".insert-media-react__dialog-wrapper .nav-link").entwine({onclick:function Ie(e){return e.preventDefault()}}),e("#insert-media-react__dialog-wrapper").entwine({ -Element:null,Data:{},onunmatch:function Fe(){this._clearModal()},_clearModal:function Ae(){_reactDom2["default"].unmountComponentAtNode(this[0])},open:function De(){this._renderModal(!0)},close:function Me(){ +Element:null,Data:{},onunmatch:function Ae(){this._clearModal()},_clearModal:function Fe(){_reactDom2["default"].unmountComponentAtNode(this[0])},open:function De(){this._renderModal(!0)},close:function Me(){ this._renderModal(!1)},_renderModal:function Ne(e){var t=this,n=function l(){return t.close()},i=function u(){return t._handleInsert.apply(t,arguments)},r=window.ss.store,a=window.ss.apolloClient,o=this.getOriginalAttributes(),s=window.InsertMediaModal["default"] @@ -2068,10 +2068,10 @@ e.print()})},onunmatch:function O(){this._super()}}),e(".grid-field .action.no-a onclick:function k(){return this.getGridField().showDetailView(e(this).prop("href")),!1}}),e(".grid-field[data-selectable]").entwine({getSelectedItems:function j(){return this.find(".ss-gridfield-item.ui-selected") },getSelectedIDs:function x(){return e.map(this.getSelectedItems(),function(t){return e(t).data("id")})}}),e(".grid-field[data-selectable] .ss-gridfield-items").entwine({onadd:function R(){this._super(), -this.selectable()},onremove:function I(){this._super(),this.data("selectable")&&this.selectable("destroy")}}),e(".grid-field .filter-header :input").entwine({onmatch:function F(){var e=this.closest(".extra").find(".ss-gridfield-button-filter"),t=this.closest(".extra").find(".ss-gridfield-button-reset") +this.selectable()},onremove:function I(){this._super(),this.data("selectable")&&this.selectable("destroy")}}),e(".grid-field .filter-header :input").entwine({onmatch:function A(){var e=this.closest(".extra").find(".ss-gridfield-button-filter"),t=this.closest(".extra").find(".ss-gridfield-button-reset") -this.val()&&(e.addClass("filtered"),t.addClass("filtered")),this._super()},onunmatch:function A(){this._super()},onkeydown:function D(e){if(!this.closest(".ss-gridfield-button-reset").length){var t=this.closest(".extra").find(".ss-gridfield-button-filter"),n=this.closest(".extra").find(".ss-gridfield-button-reset") +this.val()&&(e.addClass("filtered"),t.addClass("filtered")),this._super()},onunmatch:function F(){this._super()},onkeydown:function D(e){if(!this.closest(".ss-gridfield-button-reset").length){var t=this.closest(".extra").find(".ss-gridfield-button-filter"),n=this.closest(".extra").find(".ss-gridfield-button-reset") if("13"==e.keyCode){var i=this.closest(".filter-header").find(".ss-gridfield-button-filter"),r="show" @@ -2091,8 +2091,8 @@ function i(e){if(e&&e.__esModule)return e var t={} if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]) return t["default"]=e,t}function r(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=m["default"].get("absoluteBaseUrl"),t=(0,I.createNetworkInterface)({uri:e+"graphql/",opts:{credentials:"same-origin" -}}),n=new F["default"]({shouldBatch:!0,addTypename:!0,dataIdFromObject:function O(e){return e.id>=0&&e.__typename?e.__typename+":"+e.id:null},networkInterface:t}) -t.use([{applyMiddleware:function k(e,t){var n=(0,A.printRequest)(e.request) +}}),n=new A["default"]({shouldBatch:!0,addTypename:!0,dataIdFromObject:function O(e){return e.id>=0&&e.__typename?e.__typename+":"+e.id:null},networkInterface:t}) +t.use([{applyMiddleware:function k(e,t){var n=(0,F.printRequest)(e.request) e.options.headers=o({},e.options.headers,{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),e.options.body=M["default"].stringify(o({},n,{variables:JSON.stringify(n.variables)})),t()}}]), v["default"].add("config",w["default"]),v["default"].add("form",f.reducer),v["default"].add("schemas",T["default"]),v["default"].add("records",P["default"]),v["default"].add("campaign",S["default"]),v["default"].add("breadcrumbs",j["default"]), v["default"].add("routing",p.routerReducer),v["default"].add("apollo",n.reducer()),R["default"].start() @@ -2104,7 +2104,7 @@ var _=h(u.createStore),C=_(r,i) C.dispatch(b.setConfig(m["default"].getAll())),window.ss=window.ss||{},window.ss.store=C,window.ss=window.ss||{},window.ss.apolloClient=n var E=new l["default"](C,n) E.start(window.location.pathname),window.jQuery&&window.jQuery("body").addClass("js-react-boot")}var o=Object.assign||function(e){for(var t=1;t0&&(t=e+"/"+this.props.params.id) var n={createFn:this.campaignEditCreateFn.bind(this),schemaUrl:t} return p["default"].createElement("div",{className:"fill-height"},p["default"].createElement(x["default"],{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},p["default"].createElement(C["default"],{ @@ -2553,7 +2553,7 @@ var i=Object.getOwnPropertyDescriptor(e,t) if(void 0===i){var r=Object.getPrototypeOf(e) return null===r?void 0:V(r,t,n)}if("value"in i)return i.value var a=i.get -if(void 0!==a)return a.call(n)},p=n(5),h=r(p),m=n(107),g=n(106),v=n(387),y=i(v),b=n(124),_=i(b),w=n(391),C=i(w),T=n(20),E=r(T),P=n(392),O=r(P),S=n(393),k=r(S),j=n(395),x=r(j),R=n(389),I=r(R),F=n(252),A=r(F),D=n(396),M=r(D),N=n(388),U=r(N),L=n(397),B=r(L),H=n(114),$=r(H),q=function(e){ +if(void 0!==a)return a.call(n)},p=n(5),h=r(p),m=n(107),g=n(106),v=n(387),y=i(v),b=n(124),_=i(b),w=n(391),C=i(w),T=n(20),E=r(T),P=n(392),O=r(P),S=n(393),k=r(S),j=n(395),x=r(j),R=n(389),I=r(R),A=n(252),F=r(A),D=n(396),M=r(D),N=n(388),U=r(N),L=n(397),B=r(L),H=n(114),$=r(H),q=function(e){ function t(e){a(this,t) var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)) return n.handlePublish=n.handlePublish.bind(n),n.handleItemSelected=n.handleItemSelected.bind(n),n.setBreadcrumbs=n.setBreadcrumbs.bind(n),n.handleCloseItem=n.handleCloseItem.bind(n),n}return s(t,e),d(t,[{ @@ -2583,7 +2583,7 @@ if(!e||!e.length)return h["default"].createElement("div",{className:"btn-toolbar var t={} return"open"===this.props.record.State?t=c(t,{title:$["default"]._t("Campaigns.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket" }):"published"===this.props.record.State&&(t=c(t,{title:$["default"]._t("Campaigns.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})),h["default"].createElement("div",{ -className:"btn-toolbar"},h["default"].createElement(A["default"],t))}},{key:"getItems",value:function m(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{ +className:"btn-toolbar"},h["default"].createElement(F["default"],t))}},{key:"getItems",value:function m(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{ key:"groupItemsForSet",value:function g(){var e={},t=this.getItems() return t?(t.forEach(function(t){var n=t.BaseClass e[n]||(e[n]={singular:t.Singular,plural:t.Plural,items:[]}),e[n].items.push(t)}),e):e}},{key:"handlePublish",value:function v(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId) diff --git a/admin/client/lang/src/en.js b/admin/client/lang/src/en.js index 31e613bda..9305b0cb2 100644 --- a/admin/client/lang/src/en.js +++ b/admin/client/lang/src/en.js @@ -7,8 +7,11 @@ "CMSMAIN.BATCH_UNPUBLISH_PROMPT": "You have {num} page(s) selected.\n\nDo you really want to unpublish", "CMSMAIN.SELECTONEPAGE": "Please select at least one page", "Campaigns.ADDCAMPAIGN": "Add campaign", + "Campaigns.DELETECAMPAIGN": "Are you sure you want to delete this record?", "Campaigns.ITEM_SUMMARY_PLURAL": "%s items", "Campaigns.ITEM_SUMMARY_SINGULAR": "%s item", + "Campaigns.LOADING": "Loading...", + "Campaigns.NO_RECORDS": "No campaigns created yet.", "Campaigns.PUBLISHCAMPAIGN": "Publish campaign", "Campaigns.REVERTCAMPAIGN": "Revert", "File.NO_SIZE": "N\/A", @@ -32,4 +35,4 @@ "ModelAdmin.SAVED": "Saved", "ModelAdmin.VALIDATIONERROR": "Validation Error", "SecurityAdmin.BATCHACTIONSDELETECONFIRM": "Do you really want to delete %s groups?" -} \ No newline at end of file +} diff --git a/admin/client/src/components/GridField/GridField.js b/admin/client/src/components/GridField/GridField.js index e4ad64293..04bb6d9bb 100644 --- a/admin/client/src/components/GridField/GridField.js +++ b/admin/client/src/components/GridField/GridField.js @@ -1,4 +1,5 @@ import React from 'react'; +import i18n from 'i18n'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import SilverStripeComponent from 'lib/SilverStripeComponent'; @@ -46,11 +47,11 @@ class GridField extends SilverStripeComponent { // props.records is keyed by record identifiers if (this.props.records === NotYetLoaded) { // TODO Replace with better loading indicator - return
Loading...
; + return
{ i18n._t('Campaigns.LOADING', 'Loading...') }
; } if (!Object.getOwnPropertyNames(this.props.records).length) { - return
No campaigns created yet.
; + return
{ i18n._t('Campaigns.NO_RECORDS', 'No campaigns created yet.') }
; } // Placeholder to align the headers correctly with the content @@ -128,6 +129,12 @@ class GridField extends SilverStripeComponent { const headers = {}; headers[FormConstants.CSRF_HEADER] = this.props.config.SecurityID; + if (!confirm( + i18n._t('Campaigns.DELETECAMPAIGN', 'Are you sure you want to delete this record?') + )) { + return; + } + this.props.actions.deleteRecord( this.props.data.recordType, id,