From ec321c7f4f7de185707f9ee1951fbd1a8231fa30 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Fri, 21 Jul 2017 14:08:36 +1200 Subject: [PATCH 01/14] Change button labels --- client/lang/en.js | 4 ++-- client/lang/src/en.json | 4 ++-- lang/en.yml | 2 +- src/CampaignAdmin.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/lang/en.js b/client/lang/en.js index b85bf8de..5a4b2d59 100644 --- a/client/lang/en.js +++ b/client/lang/en.js @@ -6,7 +6,7 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') { } } else { ss.i18n.addDictionary('en', { - "CampaignAdmin.ADDCAMPAIGN": "Add campaign", + "CampaignAdmin.ADDCAMPAIGN": "Add new", "CampaignAdmin.DELETECAMPAIGN": "Are you sure you want to delete this record?", "CampaignAdmin.DRAFT": "Draft", "CampaignAdmin.ITEM_SUMMARY_PLURAL": "%s items", @@ -17,4 +17,4 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') { "CampaignAdmin.REMOVED": "Removed", "CampaignAdmin.REVERTCAMPAIGN": "Revert" }); -} \ No newline at end of file +} diff --git a/client/lang/src/en.json b/client/lang/src/en.json index 3201d381..db4138b1 100644 --- a/client/lang/src/en.json +++ b/client/lang/src/en.json @@ -1,5 +1,5 @@ { - "CampaignAdmin.ADDCAMPAIGN": "Add campaign", + "CampaignAdmin.ADDCAMPAIGN": "Add new", "CampaignAdmin.DELETECAMPAIGN": "Are you sure you want to delete this record?", "CampaignAdmin.DRAFT": "Draft", "CampaignAdmin.ITEM_SUMMARY_PLURAL": "%s items", @@ -9,4 +9,4 @@ "CampaignAdmin.PUBLISHCAMPAIGN": "Publish campaign", "CampaignAdmin.REMOVED": "Removed", "CampaignAdmin.REVERTCAMPAIGN": "Revert" -} \ No newline at end of file +} diff --git a/lang/en.yml b/lang/en.yml index fef01ff4..6f281beb 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -17,6 +17,6 @@ en: CANCEL: Cancel ERROR_DUPLICATE_NAME: 'Name "{Name}" already exists' MENUTITLE: Campaigns - SAVE: Save + SAVE: Create SAVEDERROR: Error. SAVEDUP: Saved. diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 9135d1ef..a82d0e77 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -550,7 +550,7 @@ public function getCampaignCreateForm() 'campaignCreateForm', $fields, FieldList::create( - FormAction::create('save', _t(__CLASS__.'.SAVE', 'Save')) + FormAction::create('save', _t(__CLASS__.'.SAVE', 'Create')) ->setIcon('save'), FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) ->setUseButtonTag(true) From 245b9ad5e4905c778c1d1161efd279a22d41cf53 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 24 Jul 2017 10:26:48 +1200 Subject: [PATCH 02/14] Add message for newly created campaign --- client/dist/js/bundle.js | 2 +- .../src/containers/CampaignAdmin/CampaignAdmin.js | 6 +++++- .../containers/CampaignAdmin/CampaignAdminList.js | 14 ++++++++++++++ client/src/state/campaign/CampaignActionTypes.js | 1 + client/src/state/campaign/CampaignActions.js | 13 +++++++++++++ client/src/state/campaign/CampaignReducer.js | 7 +++++++ lang/en.yml | 3 ++- 7 files changed, 43 insertions(+), 3 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 15a0e152..624d811d 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=12)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE"}},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(8),i=n(21),o=a(i),l=n(24),s=a(l),u=n(28),c=a(u),p=n(13),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),s.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(11)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===D});return t.params.id>0&&(n=(0,m.formValueSelector)("Campaign.EditView",y.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function s(e){return{breadcrumbsActions:(0,h.bindActionCreators)(E,e)}}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.router.push(r+"/set/"+i+"/edit")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:N.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return d.default.createElement("div",{className:"fill-height","aria-expanded":"true"},d.default.createElement(O.default,null,d.default.createElement(A.default,{multiline:!0})),d.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},d.default.createElement("div",{className:"toolbar toolbar--content"},d.default.createElement("div",{className:"btn-toolbar"},d.default.createElement(S.default,t))),d.default.createElement(x.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return d.default.createElement(M.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return d.default.createElement("div",{className:"fill-height"},d.default.createElement(O.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},d.default.createElement(A.default,{multiline:!0})),d.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},d.default.createElement(x.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return d.default.createElement("div",{className:"fill-height"},d.default.createElement(O.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},d.default.createElement(A.default,{multiline:!0})),d.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},d.default.createElement(x.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return d.default.createElement(e,u({key:t.id},r))}return d.default.createElement(e,u({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return d.default.createElement(e,u({key:t.name},r))}return d.default.createElement(e,u({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return d.default.createElement(e,u({key:r.name},r))}return d.default.createElement(e,u({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(T.default);L.propTypes={breadcrumbsActions:d.default.PropTypes.object.isRequired,campaignId:d.default.PropTypes.string,sectionConfig:d.default.PropTypes.shape({publishEndpoint:d.default.PropTypes.shape({url:d.default.PropTypes.string,method:d.default.PropTypes.string}),form:d.default.PropTypes.shape({EditForm:d.default.PropTypes.shape({schemaUrl:d.default.PropTypes.string}),campaignEditForm:d.default.PropTypes.shape({schemaUrl:d.default.PropTypes.string}),campaignCreateForm:d.default.PropTypes.shape({schemaUrl:d.default.PropTypes.string})})}),securityId:d.default.PropTypes.string.isRequired,view:d.default.PropTypes.string},t.default=(0,g.withRouter)((0,f.connect)(l,s)(L))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=null,a=t.sectionConfig.treeClass;return e.records&&e.records[a]&&t.campaignId&&(n=e.records[a][parseInt(t.campaignId,10)]),{config:e.config,record:n||{},campaign:e.campaign,treeClass:a}}function u(e){return{breadcrumbsActions:(0,m.bindActionCreators)(b,e),recordActions:(0,m.bindActionCreators)(_,e),campaignActions:(0,m.bindActionCreators)(C,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.groupItemsForSet(),l=[],s=this.getSelectedItem(),u=s&&s._links&&s._links.references||[],c=s&&s._links&&s._links.referenced_by||[];Object.keys(o).forEach(function(a){var s=o[a],p=s.items.length,d=[],m=p+" "+(1===p?s.singular:s.plural),h="Set_"+r+"_Group_"+a;s.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var l=!!u.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});l=l||c.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(w.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},f.default.createElement(j.default,{item:a,campaign:e.props.record,selected:r,isLinked:l})))}),l.push(f.default.createElement(P.default,{key:h,groupid:h,title:m},d))});var p=[this.props.config.absoluteBaseUrl,this.props.config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPagesController"===e.name}).url].join(""),d=l.length?f.default.createElement(k.default,null,l):f.default.createElement("div",{className:"alert alert-warning",role:"alert"},f.default.createElement("strong",null,"This campaign is empty.")," You can add items to a campaign by selecting ",f.default.createElement("em",null,"Add to campaign")," from within the ",f.default.createElement("em",null,"More Options "),"popup on ",f.default.createElement("a",{href:p},"pages")," and files."),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},f.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},f.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},f.default.createElement(D.default,{multiline:!0})),f.default.createElement("div",{className:m.join(" ")},d),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),f.default.createElement(G.default,{itemLinks:n,itemId:t,onBack:this.handleCloseItem}))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems();if(!e||!e.length)return f.default.createElement("div",{className:"btn-toolbar"});var t={};return"open"===this.props.record.State?t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:F.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})),f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){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(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(I.default);V.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool.isRequired,changeSetItemId:f.default.PropTypes.number}),breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,handleBackButtonClick:f.default.PropTypes.func},t.default=(0,h.connect)(s,u)(V)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:s.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:s.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:s.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:s.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:c.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:s.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o;var l=n(3),s=a(l),u=n(29),c=a(u)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,t=arguments[1];switch(t.type){case s.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,o.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case s.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,o.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case s.default.PUBLISH_CAMPAIGN_REQUEST:return(0,o.default)(Object.assign({},e,{isPublishing:!0}));case s.default.PUBLISH_CAMPAIGN_SUCCESS:case s.default.PUBLISH_CAMPAIGN_FAILURE:return(0,o.default)(Object.assign({},e,{isPublishing:!1}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(22),o=a(i),l=n(3),s=a(l),u=(0,o.default)({campaignId:null,changeSetItemId:null,isPublishing:!1,view:null});t.default=r},function(e,t){e.exports=Accordion},function(e,t){e.exports=AccordionBlock},function(e,t){e.exports=Backend},function(e,t){e.exports=Config},function(e,t){e.exports=DeepFreezeStrict},function(e,t){e.exports=FormBuilderLoader},function(e,t){e.exports=Injector},function(e,t){e.exports=ListGroupItem},function(e,t){e.exports=Preview},function(e,t){e.exports=ReactBootstrap},function(e,t){e.exports=ReactRouteRegister},function(e,t){e.exports=RecordsActionTypes},function(e,t){e.exports=RecordsActions},function(e,t){e.exports=ReduxForm},function(e,t){e.exports=formatWrittenNumber},function(e,t){e.exports=getFormState}]); \ No newline at end of file +!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN_CREATED:"SET_NEW_CAMPAIGN_CREATED"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN_CREATED,payload:{newItemCreated:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewCampaignCreated=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:O.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(x.default,null,f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(G.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(x.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(x.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=t.sectionConfig.treeClass;return e.records&&e.records[a]&&t.campaignId&&(n=e.records[a][parseInt(t.campaignId,10)]),{config:e.config,record:n||{},campaign:e.campaign,treeClass:a,newItemCreated:e.campaign.newItemCreated}}function u(e){return{breadcrumbsActions:(0,m.bindActionCreators)(b,e),recordActions:(0,m.bindActionCreators)(_,e),campaignActions:(0,m.bindActionCreators)(v,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],m=u+" "+(1===u?o.singular:o.plural),h="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(w.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},f.default.createElement(x.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))}),l.push(f.default.createElement(P.default,{key:h,groupid:h,title:m},d))});var d=o?f.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,m=[this.props.config.absoluteBaseUrl,this.props.config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPagesController"===e.name}).url].join(""),h=l.length?f.default.createElement(k.default,null,l):f.default.createElement("div",{className:"alert alert-warning",role:"alert"},f.default.createElement("strong",null,"This campaign is empty.")," You can add items to a campaign by selecting ",f.default.createElement("em",null,"Add to campaign")," from within the ",f.default.createElement("em",null,"More Options "),"popup on ",f.default.createElement("a",{href:m},"pages")," and files."),g=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},f.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},f.default.createElement(R.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},f.default.createElement(D.default,{multiline:!0})),d,f.default.createElement("div",{className:g.join(" ")},h),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),f.default.createElement(G.default,{itemLinks:n,itemId:t,onBack:this.handleCloseItem}))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems();if(!e||!e.length)return f.default.createElement("div",{className:"btn-toolbar"});var t={};return"open"===this.props.record.State?t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:F.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})),f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){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(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(A.default);V.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool.isRequired,changeSetItemId:f.default.PropTypes.number}),breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,handleBackButtonClick:f.default.PropTypes.func},t.default=(0,h.connect)(l,u)(V)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return i({},e,{newItemCreated:t.payload.newItemCreated});default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t + Nice one! You have successfully created a campaign. +

): + null; + // Set body const pagesLink = [ this.props.config.absoluteBaseUrl, @@ -196,6 +208,7 @@ class CampaignAdminList extends SilverStripeComponent { + {newItemInfo}
{body}
@@ -352,6 +365,7 @@ function mapStateToProps(state, ownProps) { record: record || {}, campaign: state.campaign, treeClass, + newItemCreated: state.campaign.newItemCreated, }; } diff --git a/client/src/state/campaign/CampaignActionTypes.js b/client/src/state/campaign/CampaignActionTypes.js index 702c0ba0..fd7c6f65 100644 --- a/client/src/state/campaign/CampaignActionTypes.js +++ b/client/src/state/campaign/CampaignActionTypes.js @@ -4,4 +4,5 @@ export default { PUBLISH_CAMPAIGN_REQUEST: 'PUBLISH_CAMPAIGN_REQUEST', PUBLISH_CAMPAIGN_SUCCESS: 'PUBLISH_CAMPAIGN_SUCCESS', PUBLISH_CAMPAIGN_FAILURE: 'PUBLISH_CAMPAIGN_FAILURE', + SET_NEW_CAMPAIGN_CREATED: 'SET_NEW_CAMPAIGN_CREATED', }; diff --git a/client/src/state/campaign/CampaignActions.js b/client/src/state/campaign/CampaignActions.js index 788ad0c9..7afca110 100644 --- a/client/src/state/campaign/CampaignActions.js +++ b/client/src/state/campaign/CampaignActions.js @@ -65,3 +65,16 @@ export function publishCampaign(publishApi, recordType, campaignId) { }); }; } + +/** + * Set new campaign created flag + * + * @param {boolean} + * @return {Object} + */ +export function setNewCampaignCreated(newItemCreated) { + return { + type: ACTION_TYPES.SET_NEW_CAMPAIGN_CREATED, + payload: { newItemCreated }, + }; +} diff --git a/client/src/state/campaign/CampaignReducer.js b/client/src/state/campaign/CampaignReducer.js index a775156d..40f796c3 100644 --- a/client/src/state/campaign/CampaignReducer.js +++ b/client/src/state/campaign/CampaignReducer.js @@ -6,6 +6,7 @@ const initialState = deepFreeze({ changeSetItemId: null, isPublishing: false, view: null, + newItemCreated: false, }); function reducer(state = initialState, action) { @@ -34,6 +35,12 @@ function reducer(state = initialState, action) { isPublishing: false, })); + case ACTION_TYPES.SET_NEW_CAMPAIGN_CREATED: + return { + ...state, + newItemCreated: action.payload.newItemCreated, + }; + default: return state; diff --git a/lang/en.yml b/lang/en.yml index 6f281beb..4dba426d 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -17,6 +17,7 @@ en: CANCEL: Cancel ERROR_DUPLICATE_NAME: 'Name "{Name}" already exists' MENUTITLE: Campaigns - SAVE: Create + CREATE: Create + SAVE: Save SAVEDERROR: Error. SAVEDUP: Saved. From f13a96c11130300a7c2161aa64201b8a82716f96 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 24 Jul 2017 15:45:14 +1200 Subject: [PATCH 03/14] Empty and loading preview --- .eslintrc | 5 ++ client/dist/images/empty-campaign-preview.png | Bin 0 -> 34914 bytes client/dist/js/bundle.js | 2 +- client/dist/styles/bundle.css | 2 +- client/dist/styles/bundle.css.map | 2 +- .../CampaignAdmin/CampaignAdmin.scss | 18 ++++ .../CampaignAdmin/CampaignAdminList.js | 80 +++++++++++++++--- .../images/empty-campaign-preview.png | Bin 0 -> 34914 bytes client/src/state/campaign/CampaignReducer.js | 4 +- 9 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 client/dist/images/empty-campaign-preview.png create mode 100644 client/src/containers/CampaignAdmin/images/empty-campaign-preview.png diff --git a/.eslintrc b/.eslintrc index 211e286f..0fa85062 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,5 +5,10 @@ }, "rules": { "init-declarations": 1 + }, + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } } } diff --git a/client/dist/images/empty-campaign-preview.png b/client/dist/images/empty-campaign-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..45c758ab152c0e78242115154d92914282dcc4a6 GIT binary patch literal 34914 zcmV*EKx@B=P)Pyg07*naRCodGy$5t$$#o|DbwW3C4g?8;1oM!bOirHBj7C{2s5S21EnnTu{{Ach zbCZ6eH~WWolahT|&AwgVktI}?^_i?K^6mOjt}T^wuWhy8$7+|q+RVP%<>&sUZgb4l z{*Z2S@-Er^m8Snnm$zgGmWi;^jK9+5EwekfFZzxCq1|e4W~J!8+;WzSf30+1E<-OD zKU@1&s+?@)Tks?W*7}3G9SMJ}G|n}Du6XJlEEiwpGyBVB)?D#(#WS}@#jiELD#!9O zP++A#o(x6bwxDaJX)gJf!dWVPtzXVkOuSUOv^N)=#rk!v`4=nuwoALwKCqkl1zZa) z7t4FKX^NJM>Ro8^|e@@p!xvd}0h6ek@)RkH_+u!5xp=TnxKyHk-tm91q!S_Mpuc z4>L;N9DIoC56N|_0;IDmQ#@63pK#qFm>^A!ahs$v~9*w>|K0bbA*REaNY^IrEmx@cz za>2=jC$OcQx$LFzZ>x0kM|oRyeu>Ur4Q(>z$pxn4=wWH1t)ru3XK`uiyW`RL!;xs@ zVG4IJkn}I)HtT$r?k<-m+3?Nq#o~IJ?OWgaR?!DO@PQ|7HplzIk??ydC^lwkYYI%} zgUjXO<1~CFEJQF|4=2J!36XF(3{IQ)gu%Wn*&Ozz$K`ar6pu#_yzs&cuYKYZpO|GP zoq@B3rEEPdQ(R!;%ymw?FD#%ypAC?Z5cp%8+6#1~jLXS3VG z?B5$MhvR$4jvf2K```cm3F7KZoGmOx>S>wc*q#y|f z5#W5w=7d$hL%A3t!E`GLhZc4cR zA>Wi8xQ0eAx9^$o%`iQlDQv)ohld{{6Z}#r6#g-;9eB)rkTnJwMR?pEcsvvq997&- zPDUYtfC!O*F*=d;6|*Ca0(p6^f2XkhMs02FTgh~VsC)ru3!BrDMWo>?*kZn3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 zGH86zII};rn_8arglHLoWNkc_szb^$0?8WhMC(a3-qQ7is6>-C(RjDcB&!~``a?cC z0xi8kg##Zy0?8i#WY-tp+ooH|PV8jY*Yq`PCpEP84XvI08Dgv1+<%YeuD`hxxw-3) z{UJiddjy($L-KAt^adG$_WCypCy5|i$6<HgZ0j3d q%ZyUnZ>6RG&f$d6_O}_&HTZvt?OY1s13F6p00000&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:O.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(x.default,null,f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(G.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(x.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(x.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=t.sectionConfig.treeClass;return e.records&&e.records[a]&&t.campaignId&&(n=e.records[a][parseInt(t.campaignId,10)]),{config:e.config,record:n||{},campaign:e.campaign,treeClass:a,newItemCreated:e.campaign.newItemCreated}}function u(e){return{breadcrumbsActions:(0,m.bindActionCreators)(b,e),recordActions:(0,m.bindActionCreators)(_,e),campaignActions:(0,m.bindActionCreators)(v,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],m=u+" "+(1===u?o.singular:o.plural),h="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(w.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},f.default.createElement(x.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))}),l.push(f.default.createElement(P.default,{key:h,groupid:h,title:m},d))});var d=o?f.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,m=[this.props.config.absoluteBaseUrl,this.props.config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPagesController"===e.name}).url].join(""),h=l.length?f.default.createElement(k.default,null,l):f.default.createElement("div",{className:"alert alert-warning",role:"alert"},f.default.createElement("strong",null,"This campaign is empty.")," You can add items to a campaign by selecting ",f.default.createElement("em",null,"Add to campaign")," from within the ",f.default.createElement("em",null,"More Options "),"popup on ",f.default.createElement("a",{href:m},"pages")," and files."),g=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},f.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},f.default.createElement(R.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},f.default.createElement(D.default,{multiline:!0})),d,f.default.createElement("div",{className:g.join(" ")},h),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),f.default.createElement(G.default,{itemLinks:n,itemId:t,onBack:this.handleCloseItem}))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems();if(!e||!e.length)return f.default.createElement("div",{className:"btn-toolbar"});var t={};return"open"===this.props.record.State?t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:F.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})),f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){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(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(A.default);V.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool.isRequired,changeSetItemId:f.default.PropTypes.number}),breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,handleBackButtonClick:f.default.PropTypes.func},t.default=(0,h.connect)(l,u)(V)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return i({},e,{newItemCreated:t.payload.newItemCreated});default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",y.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:O.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(G.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(s,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=null,a=t.sectionConfig.treeClass;return e.records&&e.records[a]&&t.campaignId&&(n=e.records[a][parseInt(t.campaignId,10)]),{config:e.config,record:n||{},campaign:e.campaign,treeClass:a,newItemCreated:e.campaign.newItemCreated}}function u(e){return{breadcrumbsActions:(0,m.bindActionCreators)(b,e),recordActions:(0,m.bindActionCreators)(y,e),campaignActions:(0,m.bindActionCreators)(v,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,l=this.groupItemsForSet(),s=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(l).forEach(function(a){var o=l[a],u=o.items.length,d=[],m=u+" "+(1===u?o.singular:o.plural),h="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var l=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});l=l||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(w.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},f.default.createElement(j.default,{item:a,campaign:e.props.record,selected:r,isLinked:l})))}),s.push(f.default.createElement(P.default,{key:h,groupid:h,title:m},d))});var d=o?f.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,m=[this.props.config.absoluteBaseUrl,this.props.config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPagesController"===e.name}).url].join(""),h=s.length?f.default.createElement(k.default,null,s):f.default.createElement("div",{className:"alert alert-warning",role:"alert"},f.default.createElement("strong",null,"This campaign is empty.")," You can add items to a campaign by selecting ",f.default.createElement("em",null,"Add to campaign")," from within the ",f.default.createElement("em",null,"More Options "),"popup on ",f.default.createElement("a",{href:m},"pages")," and files."),g=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},f.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},f.default.createElement(R.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},f.default.createElement(D.default,{multiline:!0})),d,f.default.createElement("div",{className:g.join(" ")},h),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){return this.state.loading?f.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},f.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?f.default.createElement(G.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):f.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},f.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),f.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",f.default.createElement("strong",null,"Add to Campaign"),"from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:F.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){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(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(A.default);H.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool.isRequired,changeSetItemId:f.default.PropTypes.number}),breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,handleBackButtonClick:f.default.PropTypes.func},t.default=(0,h.connect)(s,u)(H)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,l.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,l.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,l.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,l.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,l.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t> breakpoint-next(sm)\n// md\n// >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))\n// md\n// >> breakpoint-next(sm, $breakpoint-names: (xs sm md))\n// md\n@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {\n $n: index($breakpoint-names, $name);\n @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);\n}\n\n// Minimum breakpoint width. Null for the smallest (first) breakpoint.\n//\n// >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))\n// 544px\n@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {\n $min: map-get($breakpoints, $name);\n @return if($min != 0, $min, null);\n}\n\n// Maximum breakpoint width. Null for the largest (last) breakpoint.\n// The maximum value is calculated as the minimum of the next one less 0.1.\n//\n// >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))\n// 767px\n@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {\n $next: breakpoint-next($name, $breakpoints);\n @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);\n}\n\n// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n// Makes the @content apply to the given breakpoint and wider.\n@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {\n $min: breakpoint-min($name, $breakpoints);\n @if $min {\n @media (min-width: $min) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n// Makes the @content apply to the given breakpoint and narrower.\n@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {\n $max: breakpoint-max($name, $breakpoints);\n @if $max {\n @media (max-width: $max) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media between the breakpoint's minimum and maximum widths.\n// No minimum for the smallest breakpoint, and no maximum for the largest one.\n// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($name, $breakpoints) {\n @include media-breakpoint-down($name, $breakpoints) {\n @content;\n }\n }\n}\n\n// Media that spans multiple breakpoint widths.\n// Makes the @content apply between the min and max breakpoints\n@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($lower, $breakpoints) {\n @include media-breakpoint-down($upper, $breakpoints) {\n @content;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/bootstrap/scss/mixins/_breakpoints.scss",".campaign-admin__campaign {\n position: relative;\n height: 100%;\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .campaign-admin__campaign .list-group-item.active {\n background-color: #fff;\n color: #4f5861;\n z-index: 0;\n }\n}\n\n@media (max-width: 991px) and (max-width: 1199px) {\n .campaign-admin__campaign .list-group-item.active {\n border: none;\n }\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign .list-group-item.active:hover {\n background-color: #f5f5f5;\n color: #4f5861;\n border-color: #e5e8eb;\n }\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n}\n\n@media (min-width: 992px) {\n .campaign-admin__campaign-items {\n width: 300px;\n }\n}\n\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: #29abe2;\n position: absolute;\n right: 1.2308rem;\n bottom: 0.82053rem;\n font-size: 0.923rem;\n}\n\n.campaign-admin__item-links .font-icon-link,\n.campaign-admin__item-links--has-links .font-icon-link,\n.campaign-admin__item-links--is-linked .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n}\n\n.campaign-admin__item-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--has-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n opacity: 0;\n}\n\n.list-group-item.active .campaign-admin__item-links--has-links {\n opacity: 1;\n}\n\n@media (min-width: 992px) {\n .list-group-item.active .campaign-admin__item-links--has-links {\n color: #fff;\n }\n}\n\n.list-group-item.active .campaign-admin__item-links__number {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n display: none;\n}\n\n.list-group-item:hover .campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./bundle.scss"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///./client/src/containers/CampaignAdmin/CampaignAdmin.scss?e48c","webpack:///./~/bootstrap/scss/mixins/_breakpoints.scss?4f45","webpack:///./bundle.scss?6663"],"names":[],"mappings":"AACA,0BACE,kBACA,YCuDE,yBDzDJ,mGAOM,aEAH,kDFIG,sBACA,cACA,UEAH,CD4CC,gDDzDJ,kDAgBQ,YEGL,CDsCC,yBDzDJ,wDAoBQ,yBACA,cACA,qBEKL,CACF,mEFAG,uEACA,8EEIH,yDFAG,mBACA,kBEIH,sDFAG,+BACA,+CACA,4BACA,0BACA,mBEIH,gCFCC,WACA,UACA,kBCLE,yBDEJ,gCAMI,YEKD,CACF,0GFGC,sDACA,uEACA,cACA,kBACA,gBACA,iBACA,kBEGD,0JFAG,eACA,kBACA,QACA,iBACA,gBEMH,sNFFG,UEQH,+DFEG,UC5CA,yBDsCJ,+DAGM,WEUH,CACF,mGFCC,UEOD,2EFJG,aEQH,8DFFG,UEMH","file":"styles/bundle.css","sourcesContent":["// Required for preview position\n.campaign-admin__campaign {\n position: relative;\n height: 100%;\n\n // On smaller screens hide the preview and show list of items with nothing selected\n @include media-breakpoint-down(md) {\n &.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .list-group-item.active {\n background-color: $list-group-bg;\n color: $list-group-link-color;\n z-index: 0;\n\n @include media-breakpoint-down(lg) {\n border: none;\n }\n\n &:hover {\n background-color: $list-group-hover-bg;\n color: $list-group-link-color;\n border-color: $list-group-border-color;\n }\n }\n }\n\n .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n }\n\n .campaign-admin__empty-heading {\n font-size: $font-size-h1;\n margin-bottom: 1em;\n }\n\n .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url('empty-campaign-preview.png');\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: $font-size-lg;\n }\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n\n @include media-breakpoint-up(lg) {\n width: $cms-panel-sm;\n }\n}\n\n\n// Campaign items which have linked associations\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: $brand-primary;\n position: absolute;\n right: $spacer-x;\n bottom: $spacer-y * 2 / 3;\n font-size: $font-size-sm;\n\n .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n }\n\n .campaign-admin__item-links__number {\n opacity: 0;\n }\n}\n\n.list-group-item.active {\n .campaign-admin__item-links--has-links {\n @include media-breakpoint-up(lg) {\n color: $white;\n }\n\n opacity: 1;\n }\n\n .campaign-admin__item-links__number {\n opacity: 1;\n }\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n\n .campaign-admin__item-links__number {\n display: none;\n }\n}\n\n.list-group-item:hover {\n .campaign-admin__item-links--is-linked {\n opacity: 1;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/containers/CampaignAdmin/CampaignAdmin.scss","// Breakpoint viewport sizes and media queries.\n//\n// Breakpoints are defined as a map of (name: minimum width), order from small to large:\n//\n// (xs: 0, sm: 544px, md: 768px)\n//\n// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.\n\n// Name of the next breakpoint, or null for the last breakpoint.\n//\n// >> breakpoint-next(sm)\n// md\n// >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))\n// md\n// >> breakpoint-next(sm, $breakpoint-names: (xs sm md))\n// md\n@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {\n $n: index($breakpoint-names, $name);\n @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);\n}\n\n// Minimum breakpoint width. Null for the smallest (first) breakpoint.\n//\n// >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))\n// 544px\n@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {\n $min: map-get($breakpoints, $name);\n @return if($min != 0, $min, null);\n}\n\n// Maximum breakpoint width. Null for the largest (last) breakpoint.\n// The maximum value is calculated as the minimum of the next one less 0.1.\n//\n// >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))\n// 767px\n@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {\n $next: breakpoint-next($name, $breakpoints);\n @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);\n}\n\n// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n// Makes the @content apply to the given breakpoint and wider.\n@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {\n $min: breakpoint-min($name, $breakpoints);\n @if $min {\n @media (min-width: $min) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n// Makes the @content apply to the given breakpoint and narrower.\n@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {\n $max: breakpoint-max($name, $breakpoints);\n @if $max {\n @media (max-width: $max) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media between the breakpoint's minimum and maximum widths.\n// No minimum for the smallest breakpoint, and no maximum for the largest one.\n// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($name, $breakpoints) {\n @include media-breakpoint-down($name, $breakpoints) {\n @content;\n }\n }\n}\n\n// Media that spans multiple breakpoint widths.\n// Makes the @content apply between the min and max breakpoints\n@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($lower, $breakpoints) {\n @include media-breakpoint-down($upper, $breakpoints) {\n @content;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/bootstrap/scss/mixins/_breakpoints.scss",".campaign-admin__campaign {\n position: relative;\n height: 100%;\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .campaign-admin__campaign .list-group-item.active {\n background-color: #fff;\n color: #4f5861;\n z-index: 0;\n }\n}\n\n@media (max-width: 991px) and (max-width: 1199px) {\n .campaign-admin__campaign .list-group-item.active {\n border: none;\n }\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign .list-group-item.active:hover {\n background-color: #f5f5f5;\n color: #4f5861;\n border-color: #e5e8eb;\n }\n}\n\n.campaign-admin__campaign .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-heading {\n font-size: 1.693rem;\n margin-bottom: 1em;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url(\"../containers/CampaignAdmin/images/empty-campaign-preview.png\");\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: 1.231rem;\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n}\n\n@media (min-width: 992px) {\n .campaign-admin__campaign-items {\n width: 300px;\n }\n}\n\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: #29abe2;\n position: absolute;\n right: 1.2308rem;\n bottom: 0.82053rem;\n font-size: 0.923rem;\n}\n\n.campaign-admin__item-links .font-icon-link,\n.campaign-admin__item-links--has-links .font-icon-link,\n.campaign-admin__item-links--is-linked .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n}\n\n.campaign-admin__item-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--has-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n opacity: 0;\n}\n\n.list-group-item.active .campaign-admin__item-links--has-links {\n opacity: 1;\n}\n\n@media (min-width: 992px) {\n .list-group-item.active .campaign-admin__item-links--has-links {\n color: #fff;\n }\n}\n\n.list-group-item.active .campaign-admin__item-links__number {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n display: none;\n}\n\n.list-group-item:hover .campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./bundle.scss"],"sourceRoot":""} \ No newline at end of file diff --git a/client/src/containers/CampaignAdmin/CampaignAdmin.scss b/client/src/containers/CampaignAdmin/CampaignAdmin.scss index ac6b2562..3bb2e0c2 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdmin.scss +++ b/client/src/containers/CampaignAdmin/CampaignAdmin.scss @@ -25,6 +25,24 @@ } } } + + .campaign-admin__campaign-preview--empty { + align-items: center; + justify-content: center; + } + + .campaign-admin__empty-heading { + font-size: $font-size-h1; + margin-bottom: 1em; + } + + .campaign-admin__empty-info { + padding-top: calc(270px + 0.5em); + background-image: url('empty-campaign-preview.png'); + background-repeat: no-repeat; + background-position: 50% 0; + font-size: $font-size-lg; + } } .campaign-admin__campaign-items { diff --git a/client/src/containers/CampaignAdmin/CampaignAdminList.js b/client/src/containers/CampaignAdmin/CampaignAdminList.js index 7d3683c1..fd864a05 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdminList.js +++ b/client/src/containers/CampaignAdmin/CampaignAdminList.js @@ -29,6 +29,16 @@ class CampaignAdminList extends SilverStripeComponent { this.handleItemSelected = this.handleItemSelected.bind(this); this.setBreadcrumbs = this.setBreadcrumbs.bind(this); this.handleCloseItem = this.handleCloseItem.bind(this); + + if (!this.isRecordLoaded()) { + this.state = { + loading: true, + }; + } else { + this.state = { + loading: false, + }; + } } componentDidMount() { @@ -37,10 +47,13 @@ class CampaignAdminList extends SilverStripeComponent { this.setBreadcrumbs(); // Only load record if not already present - if (!Object.keys(this.props.record).length) { + if (!this.isRecordLoaded()) { this.props.recordActions .fetchRecord(this.props.treeClass, 'get', fetchURL) - .then(this.setBreadcrumbs); + .then(() => { + this.setBreadcrumbs(); + this.setState({ loading: false }); + }); } } @@ -49,6 +62,13 @@ class CampaignAdminList extends SilverStripeComponent { this.props.campaignActions.setNewCampaignCreated(false); } + /** + * @return {boolean} + */ + isRecordLoaded() { + return Object.keys(this.props.record).length !== 0; + } + /** * Update breadcrumbs for this view */ @@ -180,7 +200,7 @@ class CampaignAdminList extends SilverStripeComponent { const newItemInfo = newItemCreated ? (

Nice one! You have successfully created a campaign. -

): +

) : null; // Set body @@ -216,11 +236,49 @@ class CampaignAdminList extends SilverStripeComponent { {this.renderButtonToolbar()} - + {this.renderPreview(itemLinks, itemId)} ); } + renderPreview(itemLinks, itemId) { + let preview = null; + + if (this.state.loading) { + preview = ( +
+

Loading...

+
+ ); + } else if (!this.getItems() || this.getItems().length === 0) { + preview = ( +
+

Getting started

+

+ Select Add to Campaign + from pages, files, and other content types +

+
+ ); + } else { + preview = ; + } + + return preview; + } + /** * Callback for items being clicked on * @@ -238,11 +296,6 @@ class CampaignAdminList extends SilverStripeComponent { renderButtonToolbar() { const items = this.getItems(); - // let itemSummaryLabel; - if (!items || !items.length) { - return
; - } - // let itemSummaryLabel = i18n.sprintf( // items.length === 1 // ? i18n._t('CampaignAdmin.ITEM_SUMMARY_SINGULAR') @@ -252,7 +305,14 @@ class CampaignAdminList extends SilverStripeComponent { let actionProps = {}; - if (this.props.record.State === 'open') { + if (!items || items.length === 0) { + actionProps = Object.assign(actionProps, { + title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN'), + buttonStyle: 'secondary-outline', + icon: 'rocket', + disabled: true, + }); + } else if (this.props.record.State === 'open') { actionProps = Object.assign(actionProps, { title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN'), buttonStyle: 'primary', diff --git a/client/src/containers/CampaignAdmin/images/empty-campaign-preview.png b/client/src/containers/CampaignAdmin/images/empty-campaign-preview.png new file mode 100644 index 0000000000000000000000000000000000000000..45c758ab152c0e78242115154d92914282dcc4a6 GIT binary patch literal 34914 zcmV*EKx@B=P)Pyg07*naRCodGy$5t$$#o|DbwW3C4g?8;1oM!bOirHBj7C{2s5S21EnnTu{{Ach zbCZ6eH~WWolahT|&AwgVktI}?^_i?K^6mOjt}T^wuWhy8$7+|q+RVP%<>&sUZgb4l z{*Z2S@-Er^m8Snnm$zgGmWi;^jK9+5EwekfFZzxCq1|e4W~J!8+;WzSf30+1E<-OD zKU@1&s+?@)Tks?W*7}3G9SMJ}G|n}Du6XJlEEiwpGyBVB)?D#(#WS}@#jiELD#!9O zP++A#o(x6bwxDaJX)gJf!dWVPtzXVkOuSUOv^N)=#rk!v`4=nuwoALwKCqkl1zZa) z7t4FKX^NJM>Ro8^|e@@p!xvd}0h6ek@)RkH_+u!5xp=TnxKyHk-tm91q!S_Mpuc z4>L;N9DIoC56N|_0;IDmQ#@63pK#qFm>^A!ahs$v~9*w>|K0bbA*REaNY^IrEmx@cz za>2=jC$OcQx$LFzZ>x0kM|oRyeu>Ur4Q(>z$pxn4=wWH1t)ru3XK`uiyW`RL!;xs@ zVG4IJkn}I)HtT$r?k<-m+3?Nq#o~IJ?OWgaR?!DO@PQ|7HplzIk??ydC^lwkY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Y*gVorvaw})!gK$A&IPSJs`hb3Z8Ee!1lFQ9+<4w-A(SA_QE!MUU zCTDBIjA{3FQ#YLUI)IHCH?J}_pN+$K+jtx278~SmX4co(WO6HK<82)JYU6Dj*UQVt z7!w;)#;l`V+2#h)u2wz?E8E!d^D5`&bK|iZjrApA2wbc1O2)?c8dJu#b5Vy^oqlE8 zwZARDbF{Vn;k=U9udiNZ8|(9Hv$_32lF}=tu|B``@~YRbZ0L`UfY(MD4pQSrps8aT zq`Y5@pTBWy*7#C>$?E4v%Ryqidf3$RUUj!SUu)aIj>JDeQ^z=H`Jize<3!_G&cs9$ zGH86zII};rn_8arglHLoWNkc_szb^$0?8WhMC(a3-qQ7is6>-C(RjDcB&!~``a?cC z0xi8kg##Zy0?8i#WY-tp+ooH|PV8jY*Yq`PCpEP84XvI08Dgv1+<%YeuD`hxxw-3) z{UJiddjy($L-KAt^adG$_WCypCy5|i$6<HgZ0j3d q%ZyUnZ>6RG&f$d6_O}_&HTZvt?OY1s13F6p0000 Date: Tue, 25 Jul 2017 17:33:22 +1200 Subject: [PATCH 04/14] Add title, icon, and class for Save button in saved form version --- src/CampaignAdmin.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index a82d0e77..3beda360 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -486,7 +486,10 @@ public function getCampaignEditForm($id) $fields, FieldList::create( FormAction::create('save', _t(__CLASS__.'.SAVE', 'Save')) - ->setIcon('save'), + ->setIcon('save') + ->setSavedTitle('Saved') + ->setSavedIcon('tick') + ->setSavedClasses('primary-outline'), FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) ->setUseButtonTag(true) ), From 82ec3f427657921e146fa675691575c6fad23bdb Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 26 Jul 2017 14:34:27 +1200 Subject: [PATCH 05/14] Add placeholder groups --- client/dist/js/bundle.js | 2 +- client/dist/styles/bundle.css | 2 +- client/dist/styles/bundle.css.map | 2 +- .../CampaignAdmin/CampaignAdmin.scss | 21 +++++++ .../CampaignAdmin/CampaignAdminList.js | 59 +++++++++++-------- src/CampaignAdmin.php | 32 +++++++++- 6 files changed, 90 insertions(+), 28 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index d4c11286..0c637a54 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN_CREATED:"SET_NEW_CAMPAIGN_CREATED"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function l(e){return{type:u.default.SET_NEW_CAMPAIGN_CREATED,payload:{newItemCreated:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewCampaignCreated=l;var s=n(3),u=a(s),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),l=n(24),s=a(l),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),s.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",y.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:O.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(G.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(P.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(s,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var n=null,a=t.sectionConfig.treeClass;return e.records&&e.records[a]&&t.campaignId&&(n=e.records[a][parseInt(t.campaignId,10)]),{config:e.config,record:n||{},campaign:e.campaign,treeClass:a,newItemCreated:e.campaign.newItemCreated}}function u(e){return{breadcrumbsActions:(0,m.bindActionCreators)(b,e),recordActions:(0,m.bindActionCreators)(y,e),campaignActions:(0,m.bindActionCreators)(v,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,l=this.groupItemsForSet(),s=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(l).forEach(function(a){var o=l[a],u=o.items.length,d=[],m=u+" "+(1===u?o.singular:o.plural),h="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var l=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});l=l||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(f.default.createElement(w.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},f.default.createElement(j.default,{item:a,campaign:e.props.record,selected:r,isLinked:l})))}),s.push(f.default.createElement(P.default,{key:h,groupid:h,title:m},d))});var d=o?f.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,m=[this.props.config.absoluteBaseUrl,this.props.config.sections.find(function(e){return"SilverStripe\\CMS\\Controllers\\CMSPagesController"===e.name}).url].join(""),h=s.length?f.default.createElement(k.default,null,s):f.default.createElement("div",{className:"alert alert-warning",role:"alert"},f.default.createElement("strong",null,"This campaign is empty.")," You can add items to a campaign by selecting ",f.default.createElement("em",null,"Add to campaign")," from within the ",f.default.createElement("em",null,"More Options "),"popup on ",f.default.createElement("a",{href:m},"pages")," and files."),g=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return f.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},f.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},f.default.createElement(R.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},f.default.createElement(D.default,{multiline:!0})),d,f.default.createElement("div",{className:g.join(" ")},h),f.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){return this.state.loading?f.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},f.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?f.default.createElement(G.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):f.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},f.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),f.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",f.default.createElement("strong",null,"Add to Campaign"),"from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:F.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:F.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){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(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(A.default);H.propTypes={campaign:f.default.PropTypes.shape({isPublishing:f.default.PropTypes.bool.isRequired,changeSetItemId:f.default.PropTypes.number}),breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignActions:f.default.PropTypes.object.isRequired,publishApi:f.default.PropTypes.func.isRequired,record:f.default.PropTypes.object.isRequired,recordActions:f.default.PropTypes.object.isRequired,sectionConfig:f.default.PropTypes.object.isRequired,handleBackButtonClick:f.default.PropTypes.func},t.default=(0,h.connect)(s,u)(H)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,l.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,l.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,l.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,l.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,l.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(L.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(S.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(R.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(D.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(S.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(L.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){return this.state.loading?h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign"),"from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,s.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t> breakpoint-next(sm)\n// md\n// >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))\n// md\n// >> breakpoint-next(sm, $breakpoint-names: (xs sm md))\n// md\n@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {\n $n: index($breakpoint-names, $name);\n @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);\n}\n\n// Minimum breakpoint width. Null for the smallest (first) breakpoint.\n//\n// >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))\n// 544px\n@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {\n $min: map-get($breakpoints, $name);\n @return if($min != 0, $min, null);\n}\n\n// Maximum breakpoint width. Null for the largest (last) breakpoint.\n// The maximum value is calculated as the minimum of the next one less 0.1.\n//\n// >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))\n// 767px\n@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {\n $next: breakpoint-next($name, $breakpoints);\n @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);\n}\n\n// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n// Makes the @content apply to the given breakpoint and wider.\n@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {\n $min: breakpoint-min($name, $breakpoints);\n @if $min {\n @media (min-width: $min) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n// Makes the @content apply to the given breakpoint and narrower.\n@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {\n $max: breakpoint-max($name, $breakpoints);\n @if $max {\n @media (max-width: $max) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media between the breakpoint's minimum and maximum widths.\n// No minimum for the smallest breakpoint, and no maximum for the largest one.\n// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($name, $breakpoints) {\n @include media-breakpoint-down($name, $breakpoints) {\n @content;\n }\n }\n}\n\n// Media that spans multiple breakpoint widths.\n// Makes the @content apply between the min and max breakpoints\n@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($lower, $breakpoints) {\n @include media-breakpoint-down($upper, $breakpoints) {\n @content;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/bootstrap/scss/mixins/_breakpoints.scss",".campaign-admin__campaign {\n position: relative;\n height: 100%;\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .campaign-admin__campaign .list-group-item.active {\n background-color: #fff;\n color: #4f5861;\n z-index: 0;\n }\n}\n\n@media (max-width: 991px) and (max-width: 1199px) {\n .campaign-admin__campaign .list-group-item.active {\n border: none;\n }\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign .list-group-item.active:hover {\n background-color: #f5f5f5;\n color: #4f5861;\n border-color: #e5e8eb;\n }\n}\n\n.campaign-admin__campaign .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-heading {\n font-size: 1.693rem;\n margin-bottom: 1em;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url(\"../containers/CampaignAdmin/images/empty-campaign-preview.png\");\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: 1.231rem;\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n}\n\n@media (min-width: 992px) {\n .campaign-admin__campaign-items {\n width: 300px;\n }\n}\n\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: #29abe2;\n position: absolute;\n right: 1.2308rem;\n bottom: 0.82053rem;\n font-size: 0.923rem;\n}\n\n.campaign-admin__item-links .font-icon-link,\n.campaign-admin__item-links--has-links .font-icon-link,\n.campaign-admin__item-links--is-linked .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n}\n\n.campaign-admin__item-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--has-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n opacity: 0;\n}\n\n.list-group-item.active .campaign-admin__item-links--has-links {\n opacity: 1;\n}\n\n@media (min-width: 992px) {\n .list-group-item.active .campaign-admin__item-links--has-links {\n color: #fff;\n }\n}\n\n.list-group-item.active .campaign-admin__item-links__number {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n display: none;\n}\n\n.list-group-item:hover .campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./bundle.scss"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///./client/src/containers/CampaignAdmin/CampaignAdmin.scss?e48c","webpack:///./~/bootstrap/scss/mixins/_breakpoints.scss?4f45","webpack:///./bundle.scss?6663"],"names":[],"mappings":"AACA,0BACE,kBACA,YCuDE,yBDzDJ,mGAOM,aEAH,kDFIG,sBACA,cACA,UEAH,CD4CC,gDD/CA,kDAMI,YEGL,CDsCC,yBD/CA,wDAUI,yBACA,cACA,qBEKL,CACF,mEFAG,uEACA,8EEIH,yDFAG,mBACA,kBEIH,sDFAG,+BACA,+CACA,4BACA,0BACA,mBEIH,gCFCC,WACA,UACA,kBCLE,yBDEJ,gCAMI,YEKD,CACF,0GFGC,sDACA,uEACA,cACA,kBACA,gBACA,iBACA,kBEGD,0JFAG,eACA,kBACA,QACA,iBACA,gBEMH,sNFFG,UEQH,+DFEG,UC5CA,yBDuCF,+DAEI,WEUH,CACF,4DFJG,UEQH,uCFFG,gBEMH,4CFFG,uBACA,kBACA,gBACA,eEMH,oDFFG,aEMH,uCFDC,UEKD,2EFFG,aEMH,8DFAG,UEIH","file":"styles/bundle.css","sourcesContent":["// Required for preview position\n.campaign-admin__campaign {\n position: relative;\n height: 100%;\n\n // On smaller screens hide the preview and show list of items with nothing selected\n @include media-breakpoint-down(md) {\n &.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .list-group-item.active {\n background-color: $list-group-bg;\n color: $list-group-link-color;\n z-index: 0;\n\n @include media-breakpoint-down(lg) {\n border: none;\n }\n\n &:hover {\n background-color: $list-group-hover-bg;\n color: $list-group-link-color;\n border-color: $list-group-border-color;\n }\n }\n }\n\n .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n }\n\n .campaign-admin__empty-heading {\n font-size: $font-size-h1;\n margin-bottom: 1em;\n }\n\n .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url('empty-campaign-preview.png');\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: $font-size-lg;\n }\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n\n @include media-breakpoint-up(lg) {\n width: $cms-panel-sm;\n }\n}\n\n\n// Campaign items which have linked associations\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: $brand-primary;\n position: absolute;\n right: $spacer-x;\n bottom: $spacer-y * 2 / 3;\n font-size: $font-size-sm;\n\n .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n }\n\n .campaign-admin__item-links__number {\n opacity: 0;\n }\n}\n\n.list-group-item.active {\n .campaign-admin__item-links--has-links {\n @include media-breakpoint-up(lg) {\n color: $white;\n }\n\n opacity: 1;\n }\n\n .campaign-admin__item-links__number {\n opacity: 1;\n }\n}\n\n.list-group-wrapper--empty {\n .list-group {\n border-bottom: 0;\n }\n\n .list-group-item {\n background: transparent;\n font-style: italic;\n border-bottom: 0;\n cursor: default;\n }\n\n .accordion__title:before {\n display: none;\n }\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n\n .campaign-admin__item-links__number {\n display: none;\n }\n}\n\n.list-group-item:hover {\n .campaign-admin__item-links--is-linked {\n opacity: 1;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/containers/CampaignAdmin/CampaignAdmin.scss","// Breakpoint viewport sizes and media queries.\n//\n// Breakpoints are defined as a map of (name: minimum width), order from small to large:\n//\n// (xs: 0, sm: 544px, md: 768px)\n//\n// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.\n\n// Name of the next breakpoint, or null for the last breakpoint.\n//\n// >> breakpoint-next(sm)\n// md\n// >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))\n// md\n// >> breakpoint-next(sm, $breakpoint-names: (xs sm md))\n// md\n@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {\n $n: index($breakpoint-names, $name);\n @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);\n}\n\n// Minimum breakpoint width. Null for the smallest (first) breakpoint.\n//\n// >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))\n// 544px\n@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {\n $min: map-get($breakpoints, $name);\n @return if($min != 0, $min, null);\n}\n\n// Maximum breakpoint width. Null for the largest (last) breakpoint.\n// The maximum value is calculated as the minimum of the next one less 0.1.\n//\n// >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))\n// 767px\n@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {\n $next: breakpoint-next($name, $breakpoints);\n @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);\n}\n\n// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n// Makes the @content apply to the given breakpoint and wider.\n@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {\n $min: breakpoint-min($name, $breakpoints);\n @if $min {\n @media (min-width: $min) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n// Makes the @content apply to the given breakpoint and narrower.\n@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {\n $max: breakpoint-max($name, $breakpoints);\n @if $max {\n @media (max-width: $max) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media between the breakpoint's minimum and maximum widths.\n// No minimum for the smallest breakpoint, and no maximum for the largest one.\n// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($name, $breakpoints) {\n @include media-breakpoint-down($name, $breakpoints) {\n @content;\n }\n }\n}\n\n// Media that spans multiple breakpoint widths.\n// Makes the @content apply between the min and max breakpoints\n@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($lower, $breakpoints) {\n @include media-breakpoint-down($upper, $breakpoints) {\n @content;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/bootstrap/scss/mixins/_breakpoints.scss",".campaign-admin__campaign {\n position: relative;\n height: 100%;\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .campaign-admin__campaign .list-group-item.active {\n background-color: #fff;\n color: #4f5861;\n z-index: 0;\n }\n}\n\n@media (max-width: 991px) and (max-width: 1199px) {\n .campaign-admin__campaign .list-group-item.active {\n border: none;\n }\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign .list-group-item.active:hover {\n background-color: #f5f5f5;\n color: #4f5861;\n border-color: #e5e8eb;\n }\n}\n\n.campaign-admin__campaign .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-heading {\n font-size: 1.693rem;\n margin-bottom: 1em;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url(\"../containers/CampaignAdmin/images/empty-campaign-preview.png\");\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: 1.231rem;\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n}\n\n@media (min-width: 992px) {\n .campaign-admin__campaign-items {\n width: 300px;\n }\n}\n\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: #29abe2;\n position: absolute;\n right: 1.2308rem;\n bottom: 0.82053rem;\n font-size: 0.923rem;\n}\n\n.campaign-admin__item-links .font-icon-link,\n.campaign-admin__item-links--has-links .font-icon-link,\n.campaign-admin__item-links--is-linked .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n}\n\n.campaign-admin__item-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--has-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n opacity: 0;\n}\n\n.list-group-item.active .campaign-admin__item-links--has-links {\n opacity: 1;\n}\n\n@media (min-width: 992px) {\n .list-group-item.active .campaign-admin__item-links--has-links {\n color: #fff;\n }\n}\n\n.list-group-item.active .campaign-admin__item-links__number {\n opacity: 1;\n}\n\n.list-group-wrapper--empty .list-group {\n border-bottom: 0;\n}\n\n.list-group-wrapper--empty .list-group-item {\n background: transparent;\n font-style: italic;\n border-bottom: 0;\n cursor: default;\n}\n\n.list-group-wrapper--empty .accordion__title:before {\n display: none;\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n display: none;\n}\n\n.list-group-item:hover .campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./bundle.scss"],"sourceRoot":""} \ No newline at end of file diff --git a/client/src/containers/CampaignAdmin/CampaignAdmin.scss b/client/src/containers/CampaignAdmin/CampaignAdmin.scss index 3bb2e0c2..6707f2c1 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdmin.scss +++ b/client/src/containers/CampaignAdmin/CampaignAdmin.scss @@ -95,6 +95,27 @@ } } +.list-group-wrapper--empty { + .list-group { + border-bottom: 0; + } + + .list-group-item { + background: transparent; + font-style: italic; + border-bottom: 0; + cursor: default; + } + + .accordion__title { + cursor: default; + + &:before { + display: none; + } + } +} + .campaign-admin__item-links--is-linked { opacity: 1; diff --git a/client/src/containers/CampaignAdmin/CampaignAdminList.js b/client/src/containers/CampaignAdmin/CampaignAdminList.js index fd864a05..9d1ed8f5 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdminList.js +++ b/client/src/containers/CampaignAdmin/CampaignAdminList.js @@ -14,8 +14,7 @@ import CampaignAdminItem from './CampaignAdminItem'; import Breadcrumb from 'components/Breadcrumb/Breadcrumb'; import Preview from 'components/Preview/Preview'; import i18n from 'i18n'; - -const sectionConfigKey = 'SilverStripe\\CMS\\Controllers\\CMSPagesController'; +import classnames from 'classnames'; /** * Represents a campaign list view @@ -139,9 +138,12 @@ class CampaignAdminList extends SilverStripeComponent { const group = itemGroups[className]; const groupCount = group.items.length; - let listGroupItems = []; - let title = `${groupCount} ${groupCount === 1 ? group.singular : group.plural}`; - let groupid = `Set_${campaignId}_Group_${className}`; + const listGroupItems = []; + const title = ` + ${groupCount === 0 ? '' : groupCount} + ${groupCount === 1 ? group.singular : group.plural} + `; + const groupid = `Set_${campaignId}_Group_${className}`; // Create items for this group group.items.forEach(item => { @@ -189,11 +191,21 @@ class CampaignAdminList extends SilverStripeComponent { ); }); + const wrapperClassnames = classnames('list-group-wrapper', { + 'list-group-wrapper--empty': listGroupItems.length === 0, + }); + // Merge into group accordionBlocks.push( - - {listGroupItems} - +
+ + { + listGroupItems.length > 0 ? + listGroupItems : +

{group.noItemText}

+ } +
+
); }); @@ -203,21 +215,7 @@ class CampaignAdminList extends SilverStripeComponent {

) : null; - // Set body - const pagesLink = [ - this.props.config.absoluteBaseUrl, - this.props.config.sections.find((section) => section.name === sectionConfigKey).url, - ].join(''); - - const body = accordionBlocks.length - ? ({accordionBlocks}) - : ( -
- ); + const body = {accordionBlocks}; const bodyClass = [ 'panel', 'panel--padded', 'panel--scrollable', 'flexbox-area-grow', ]; @@ -362,7 +360,7 @@ class CampaignAdminList extends SilverStripeComponent { * @return {object} */ groupItemsForSet() { - const groups = {}; + const groups = this.getPlaceholderGroups(); const items = this.getItems(); if (!items) { return groups; @@ -388,6 +386,19 @@ class CampaignAdminList extends SilverStripeComponent { return groups; } + getPlaceholderGroups() { + const groups = {}; + + if (this.props.record && this.props.record.placeholderGroups) { + this.props.record.placeholderGroups.forEach((group) => { + groups[group.baseClass] = { ...group }; + groups[group.baseClass].items = [...group.items]; + }); + } + + return groups; + } + handlePublish(e) { e.preventDefault(); this.props.campaignActions.publishCampaign( diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 3beda360..a33747d9 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -155,6 +155,35 @@ public function readCampaigns() return $response; } + protected function getPlaceholderGroups() + { + $groups = []; + + if (class_exists('SilverStripe\CMS\Model\SiteTree')) { + $class = singleton('SilverStripe\CMS\Model\SiteTree'); + $groups[] = [ + 'baseClass' => DataObject::getSchema()->baseDataClass('SilverStripe\CMS\Model\SiteTree'), + 'singular' => $class->i18n_singular_name(), + 'plural' => $class->i18n_plural_name(), + 'noItemText' => 'Add from ' . $class->i18n_plural_name() . ' area', + 'items' => [] + ]; + } + + if (class_exists('SilverStripe\AssetAdmin\Controller\AssetAdmin')) { + $class = singleton('SilverStripe\Assets\File'); + $groups[] = [ + 'baseClass' => DataObject::getSchema()->baseDataClass('SilverStripe\Assets\File'), + 'singular' => $class->i18n_singular_name(), + 'plural' => $class->i18n_plural_name(), + 'noItemText' => 'Add from ' . $class->i18n_plural_name() . ' area', + 'items' => [] + ]; + } + + return $groups; + } + /** * Get list contained as a hal wrapper * @@ -206,7 +235,8 @@ protected function getChangeSetResource(ChangeSet $changeSet) 'IsInferred' => $changeSet->IsInferred, 'canEdit' => $changeSet->canEdit(), 'canPublish' => false, - '_embedded' => ['items' => []] + '_embedded' => ['items' => []], + 'placeholderGroups' => $this->getPlaceholderGroups() ]; // Before presenting the changeset to the client, From 65e66c2752bf76bd29d144c1fd8c554f65ca52e1 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Thu, 27 Jul 2017 16:48:27 +1200 Subject: [PATCH 06/14] Clean up --- client/dist/js/bundle.js | 2 +- client/dist/styles/bundle.css.map | 1 - .../containers/CampaignAdmin/CampaignAdmin.js | 2 +- .../CampaignAdmin/CampaignAdminList.js | 40 ++++++++----------- .../src/state/campaign/CampaignActionTypes.js | 2 +- client/src/state/campaign/CampaignActions.js | 10 ++--- client/src/state/campaign/CampaignReducer.js | 6 +-- 7 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 client/dist/styles/bundle.css.map diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 0c637a54..04ef1500 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN_CREATED:"SET_NEW_CAMPAIGN_CREATED"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN_CREATED,payload:{newItemCreated:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewCampaignCreated=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewCampaignCreated(!0),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(R.default,t))),f.default.createElement(D.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(L.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(D.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(S.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItemCreated,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(R.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(D.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(S.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(L.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){return this.state.loading?h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:"flexbox-area-grow fill-height preview campaign-admin__campaign-preview campaign-admin__campaign-preview--empty"},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign"),"from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN_CREATED:return(0,s.default)(i({},e,{newItemCreated:t.payload.newItemCreated}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t> breakpoint-next(sm)\n// md\n// >> breakpoint-next(sm, (xs: 0, sm: 544px, md: 768px))\n// md\n// >> breakpoint-next(sm, $breakpoint-names: (xs sm md))\n// md\n@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {\n $n: index($breakpoint-names, $name);\n @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);\n}\n\n// Minimum breakpoint width. Null for the smallest (first) breakpoint.\n//\n// >> breakpoint-min(sm, (xs: 0, sm: 544px, md: 768px))\n// 544px\n@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {\n $min: map-get($breakpoints, $name);\n @return if($min != 0, $min, null);\n}\n\n// Maximum breakpoint width. Null for the largest (last) breakpoint.\n// The maximum value is calculated as the minimum of the next one less 0.1.\n//\n// >> breakpoint-max(sm, (xs: 0, sm: 544px, md: 768px))\n// 767px\n@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {\n $next: breakpoint-next($name, $breakpoints);\n @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);\n}\n\n// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n// Makes the @content apply to the given breakpoint and wider.\n@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {\n $min: breakpoint-min($name, $breakpoints);\n @if $min {\n @media (min-width: $min) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n// Makes the @content apply to the given breakpoint and narrower.\n@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {\n $max: breakpoint-max($name, $breakpoints);\n @if $max {\n @media (max-width: $max) {\n @content;\n }\n } @else {\n @content;\n }\n}\n\n// Media between the breakpoint's minimum and maximum widths.\n// No minimum for the smallest breakpoint, and no maximum for the largest one.\n// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n@mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($name, $breakpoints) {\n @include media-breakpoint-down($name, $breakpoints) {\n @content;\n }\n }\n}\n\n// Media that spans multiple breakpoint widths.\n// Makes the @content apply between the min and max breakpoints\n@mixin media-breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {\n @include media-breakpoint-up($lower, $breakpoints) {\n @include media-breakpoint-down($upper, $breakpoints) {\n @content;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./~/bootstrap/scss/mixins/_breakpoints.scss",".campaign-admin__campaign {\n position: relative;\n height: 100%;\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview {\n display: none;\n }\n\n .campaign-admin__campaign .list-group-item.active {\n background-color: #fff;\n color: #4f5861;\n z-index: 0;\n }\n}\n\n@media (max-width: 991px) and (max-width: 1199px) {\n .campaign-admin__campaign .list-group-item.active {\n border: none;\n }\n}\n\n@media (max-width: 991px) {\n .campaign-admin__campaign .list-group-item.active:hover {\n background-color: #f5f5f5;\n color: #4f5861;\n border-color: #e5e8eb;\n }\n}\n\n.campaign-admin__campaign .campaign-admin__campaign-preview--empty {\n align-items: center;\n justify-content: center;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-heading {\n font-size: 1.693rem;\n margin-bottom: 1em;\n}\n\n.campaign-admin__campaign .campaign-admin__empty-info {\n padding-top: calc(270px + 0.5em);\n background-image: url(\"../containers/CampaignAdmin/images/empty-campaign-preview.png\");\n background-repeat: no-repeat;\n background-position: 50% 0;\n font-size: 1.231rem;\n}\n\n.campaign-admin__campaign-items {\n width: 100%;\n z-index: 1;\n position: relative;\n}\n\n@media (min-width: 992px) {\n .campaign-admin__campaign-items {\n width: 300px;\n }\n}\n\n.campaign-admin__item-links,\n.campaign-admin__item-links--has-links,\n.campaign-admin__item-links--is-linked {\n display: flex;\n align-items: center;\n color: #29abe2;\n position: absolute;\n right: 1.2308rem;\n bottom: 0.82053rem;\n font-size: 0.923rem;\n}\n\n.campaign-admin__item-links .font-icon-link,\n.campaign-admin__item-links--has-links .font-icon-link,\n.campaign-admin__item-links--is-linked .font-icon-link {\n font-size: 16px;\n position: relative;\n top: 3px;\n margin-right: 1px;\n margin-left: 3px;\n}\n\n.campaign-admin__item-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--has-links .campaign-admin__item-links__number,\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n opacity: 0;\n}\n\n.list-group-item.active .campaign-admin__item-links--has-links {\n opacity: 1;\n}\n\n@media (min-width: 992px) {\n .list-group-item.active .campaign-admin__item-links--has-links {\n color: #fff;\n }\n}\n\n.list-group-item.active .campaign-admin__item-links__number {\n opacity: 1;\n}\n\n.list-group-wrapper--empty .list-group {\n border-bottom: 0;\n}\n\n.list-group-wrapper--empty .list-group-item {\n background: transparent;\n font-style: italic;\n border-bottom: 0;\n cursor: default;\n}\n\n.list-group-wrapper--empty .accordion__title:before {\n display: none;\n}\n\n.campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n.campaign-admin__item-links--is-linked .campaign-admin__item-links__number {\n display: none;\n}\n\n.list-group-item:hover .campaign-admin__item-links--is-linked {\n opacity: 1;\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./bundle.scss"],"sourceRoot":""} \ No newline at end of file diff --git a/client/src/containers/CampaignAdmin/CampaignAdmin.js b/client/src/containers/CampaignAdmin/CampaignAdmin.js index 0e5118c6..aa543537 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdmin.js +++ b/client/src/containers/CampaignAdmin/CampaignAdmin.js @@ -120,7 +120,7 @@ class CampaignAdmin extends SilverStripeComponent { // open the new campaign in edit mode after save completes const sectionUrl = this.props.sectionConfig.url; const id = response.record.id; - this.props.campaignActions.setNewCampaignCreated(true); + this.props.campaignActions.setNewItem(id); this.props.router.push(`${sectionUrl}/set/${id}/show`); } diff --git a/client/src/containers/CampaignAdmin/CampaignAdminList.js b/client/src/containers/CampaignAdmin/CampaignAdminList.js index 9d1ed8f5..0ff1ff2e 100644 --- a/client/src/containers/CampaignAdmin/CampaignAdminList.js +++ b/client/src/containers/CampaignAdmin/CampaignAdminList.js @@ -58,7 +58,7 @@ class CampaignAdminList extends SilverStripeComponent { componentWillUnmount() { // Reset new create flag - this.props.campaignActions.setNewCampaignCreated(false); + this.props.campaignActions.setNewItem(null); } /** @@ -118,7 +118,7 @@ class CampaignAdminList extends SilverStripeComponent { const selectedClass = (!itemId) ? 'campaign-admin__campaign--hide-preview' : ''; const campaignId = this.props.campaignId; const campaign = this.props.record; - const newItemCreated = this.props.newItemCreated; + const newItem = this.props.newItem; // Trigger different layout when preview is enabled const itemGroups = this.groupItemsForSet(); @@ -209,7 +209,7 @@ class CampaignAdminList extends SilverStripeComponent { ); }); - const newItemInfo = newItemCreated ? + const newItemInfo = newItem ? (

Nice one! You have successfully created a campaign.

) : @@ -241,32 +241,26 @@ class CampaignAdminList extends SilverStripeComponent { renderPreview(itemLinks, itemId) { let preview = null; + let previewClasses = classnames([ + 'flexbox-area-grow', + 'fill-height', + 'preview', + 'campaign-admin__campaign-preview', + 'campaign-admin__campaign-preview--empty', + ]); if (this.state.loading) { preview = ( -
+

Loading...

); } else if (!this.getItems() || this.getItems().length === 0) { preview = ( -
+

Getting started

- Select Add to Campaign - from pages, files, and other content types + Select Add to Campaign from pages, files, and other content types

); @@ -305,14 +299,14 @@ class CampaignAdminList extends SilverStripeComponent { if (!items || items.length === 0) { actionProps = Object.assign(actionProps, { - title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN'), + title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), buttonStyle: 'secondary-outline', icon: 'rocket', disabled: true, }); } else if (this.props.record.State === 'open') { actionProps = Object.assign(actionProps, { - title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN'), + title: i18n._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), buttonStyle: 'primary', loading: this.props.campaign.isPublishing, handleClick: this.handlePublish, @@ -321,7 +315,7 @@ class CampaignAdminList extends SilverStripeComponent { } else if (this.props.record.State === 'published') { // TODO Implement "revert" feature actionProps = Object.assign(actionProps, { - title: i18n._t('CampaignAdmin.REVERTCAMPAIGN'), + title: i18n._t('CampaignAdmin.REVERTCAMPAIGN', 'Revert'), buttonStyle: 'secondary-outline', icon: 'back-in-time', disabled: true, @@ -436,7 +430,7 @@ function mapStateToProps(state, ownProps) { record: record || {}, campaign: state.campaign, treeClass, - newItemCreated: state.campaign.newItemCreated, + newItem: state.campaign.newItem, }; } diff --git a/client/src/state/campaign/CampaignActionTypes.js b/client/src/state/campaign/CampaignActionTypes.js index fd7c6f65..6e0830f3 100644 --- a/client/src/state/campaign/CampaignActionTypes.js +++ b/client/src/state/campaign/CampaignActionTypes.js @@ -4,5 +4,5 @@ export default { PUBLISH_CAMPAIGN_REQUEST: 'PUBLISH_CAMPAIGN_REQUEST', PUBLISH_CAMPAIGN_SUCCESS: 'PUBLISH_CAMPAIGN_SUCCESS', PUBLISH_CAMPAIGN_FAILURE: 'PUBLISH_CAMPAIGN_FAILURE', - SET_NEW_CAMPAIGN_CREATED: 'SET_NEW_CAMPAIGN_CREATED', + SET_NEW_CAMPAIGN: 'SET_NEW_CAMPAIGN', }; diff --git a/client/src/state/campaign/CampaignActions.js b/client/src/state/campaign/CampaignActions.js index 7afca110..963001f3 100644 --- a/client/src/state/campaign/CampaignActions.js +++ b/client/src/state/campaign/CampaignActions.js @@ -67,14 +67,14 @@ export function publishCampaign(publishApi, recordType, campaignId) { } /** - * Set new campaign created flag + * Set new campaign * - * @param {boolean} + * @param {?number} * @return {Object} */ -export function setNewCampaignCreated(newItemCreated) { +export function setNewItem(itemId) { return { - type: ACTION_TYPES.SET_NEW_CAMPAIGN_CREATED, - payload: { newItemCreated }, + type: ACTION_TYPES.SET_NEW_CAMPAIGN, + payload: { newItem: itemId }, }; } diff --git a/client/src/state/campaign/CampaignReducer.js b/client/src/state/campaign/CampaignReducer.js index 47f5db39..8a0134ac 100644 --- a/client/src/state/campaign/CampaignReducer.js +++ b/client/src/state/campaign/CampaignReducer.js @@ -6,7 +6,7 @@ const initialState = deepFreeze({ changeSetItemId: null, isPublishing: false, view: null, - newItemCreated: false, + newItem: null, }); function reducer(state = initialState, action) { @@ -35,10 +35,10 @@ function reducer(state = initialState, action) { isPublishing: false, })); - case ACTION_TYPES.SET_NEW_CAMPAIGN_CREATED: + case ACTION_TYPES.SET_NEW_CAMPAIGN: return deepFreeze({ ...state, - newItemCreated: action.payload.newItemCreated, + newItem: action.payload.newItem, }); default: From 4162b8812e2177dcaaac563a45acedf4eb83d347 Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Tue, 1 Aug 2017 17:19:44 +1200 Subject: [PATCH 07/14] Update to use simple props, without new FormAction API --- client/dist/js/bundle.js | 1610 ++++++++++++++++++++++++++++++++- client/dist/styles/bundle.css | 3 +- src/CampaignAdmin.php | 13 +- 3 files changed, 1621 insertions(+), 5 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 04ef1500..fc4a9f1e 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1,1609 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN:"SET_NEW_CAMPAIGN"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewItem=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t 1) { + var last = this.props.breadcrumbs[this.props.breadcrumbs.length - 2]; + if (last && last.href) { + event.preventDefault(); + this.props.router.push(last.href); + } + } + } + }, { + key: 'handleCreateCampaignSubmit', + value: function handleCreateCampaignSubmit(data, action, submitFn) { + var _this2 = this; + + var promise = submitFn(); + if (!promise) { + throw new Error('Promise was not returned for submitting'); + } + return promise.then(function (response) { + var hasErrors = response.errors && response.errors.length > 0; + if (action === 'action_save' && !hasErrors) { + var sectionUrl = _this2.props.sectionConfig.url; + var id = response.record.id; + _this2.props.campaignActions.setNewItem(id); + _this2.props.router.push(sectionUrl + '/set/' + id + '/show'); + } + + return response; + }); + } + }, { + key: 'handleFormAction', + value: function handleFormAction(event) { + var name = event.currentTarget.name; + + if (name === 'action_cancel') { + var url = this.props.sectionConfig.url; + this.props.router.push(url); + event.preventDefault(); + } + } + }, { + key: 'render', + value: function render() { + var view = null; + + switch (this.props.params.view) { + case 'show': + view = this.renderItemListView(); + break; + case 'edit': + view = this.renderDetailEditView(); + break; + case 'create': + view = this.renderCreateView(); + break; + default: + view = this.renderIndexView(); + } + + return view; + } + }, { + key: 'renderIndexView', + value: function renderIndexView() { + var schemaUrl = this.props.sectionConfig.form.EditForm.schemaUrl; + var formActionProps = { + title: _i18n2.default._t('CampaignAdmin.ADDCAMPAIGN'), + icon: 'plus', + extraClass: 'btn-primary', + handleClick: this.addCampaign.bind(this) + }; + var formBuilderProps = { + createFn: this.campaignListCreateFn.bind(this), + schemaUrl: schemaUrl, + identifier: 'Campaign.IndexView' + }; + + return _react2.default.createElement( + 'div', + { className: 'fill-height', 'aria-expanded': 'true' }, + _react2.default.createElement( + _Toolbar2.default, + null, + _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) + ), + _react2.default.createElement( + 'div', + { className: 'panel panel--padded panel--scrollable flexbox-area-grow' }, + _react2.default.createElement( + 'div', + { className: 'toolbar toolbar--content' }, + _react2.default.createElement( + 'div', + { className: 'btn-toolbar' }, + _react2.default.createElement(_FormAction2.default, formActionProps) + ) + ), + _react2.default.createElement(_FormBuilderLoader2.default, formBuilderProps) + ) + ); + } + }, { + key: 'renderItemListView', + value: function renderItemListView() { + var props = { + sectionConfig: this.props.sectionConfig, + campaignId: this.props.params.id, + itemListViewEndpoint: this.props.sectionConfig.itemListViewEndpoint, + publishApi: this.publishApi, + handleBackButtonClick: this.handleBackButtonClick.bind(this) + }; + + return _react2.default.createElement(_CampaignAdminList2.default, props); + } + }, { + key: 'renderDetailEditView', + value: function renderDetailEditView() { + if (this.props.params.id <= 0) { + return this.renderCreateView(); + } + var baseSchemaUrl = this.props.sectionConfig.form.campaignEditForm.schemaUrl; + var schemaUrl = baseSchemaUrl + '/' + this.props.params.id; + + return _react2.default.createElement( + 'div', + { className: 'fill-height' }, + _react2.default.createElement( + _Toolbar2.default, + { showBackButton: true, handleBackButtonClick: this.handleBackButtonClick }, + _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) + ), + _react2.default.createElement( + 'div', + { className: 'panel panel--padded panel--scrollable flexbox-area-grow form--inline' }, + _react2.default.createElement(_FormBuilderLoader2.default, { + handleAction: this.handleFormAction, + schemaUrl: schemaUrl, + identifier: 'Campaign.EditView' + }) + ) + ); + } + }, { + key: 'renderCreateView', + value: function renderCreateView() { + var schemaUrl = this.props.sectionConfig.form.campaignCreateForm.schemaUrl; + return _react2.default.createElement( + 'div', + { className: 'fill-height' }, + _react2.default.createElement( + _Toolbar2.default, + { showBackButton: true, handleBackButtonClick: this.handleBackButtonClick }, + _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) + ), + _react2.default.createElement( + 'div', + { className: 'panel panel--padded panel--scrollable flexbox-area-grow form--inline' }, + _react2.default.createElement(_FormBuilderLoader2.default, { + handleSubmit: this.handleCreateCampaignSubmit, + handleAction: this.handleFormAction, + schemaUrl: schemaUrl, + identifier: 'Campaign.CreateView' + }) + ) + ); + } + }, { + key: 'campaignEditCreateFn', + value: function campaignEditCreateFn(Component, props) { + var _this3 = this; + + var url = this.props.sectionConfig.url; + + if (props.name === 'action_cancel') { + var extendedProps = Object.assign({}, props, { + handleClick: function handleClick(event) { + event.preventDefault(); + _this3.props.router.push(url); + } + }); + + return _react2.default.createElement(Component, _extends({ key: props.id }, extendedProps)); + } + + return _react2.default.createElement(Component, _extends({ key: props.id }, props)); + } + }, { + key: 'campaignAddCreateFn', + value: function campaignAddCreateFn(Component, props) { + var _this4 = this; + + var url = this.props.sectionConfig.url; + + if (props.name === 'action_cancel') { + var extendedProps = Object.assign({}, props, { + handleClick: function handleClick(event) { + event.preventDefault(); + _this4.props.router.push(url); + } + }); + + return _react2.default.createElement(Component, _extends({ key: props.name }, extendedProps)); + } + + return _react2.default.createElement(Component, _extends({ key: props.name }, props)); + } + }, { + key: 'campaignListCreateFn', + value: function campaignListCreateFn(Component, props) { + var _this5 = this; + + var sectionUrl = this.props.sectionConfig.url; + var typeUrlParam = 'set'; + + if (props.schemaComponent === 'GridField') { + var extendedProps = Object.assign({}, props, { + data: Object.assign({}, props.data, { + handleDrillDown: function handleDrillDown(event, record) { + _this5.props.router.push(sectionUrl + '/' + typeUrlParam + '/' + record.ID + '/show'); + }, + handleEditRecord: function handleEditRecord(event, id) { + _this5.props.router.push(sectionUrl + '/' + typeUrlParam + '/' + id + '/edit'); + } + }) + }); + + return _react2.default.createElement(Component, _extends({ key: extendedProps.name }, extendedProps)); + } + + return _react2.default.createElement(Component, _extends({ key: props.name }, props)); + } + }, { + key: 'addCampaign', + value: function addCampaign() { + var path = this.getActionRoute(0, 'create'); + this.props.router.push(path); + } + }, { + key: 'getActionRoute', + value: function getActionRoute(id, view) { + return this.props.sectionConfig.url + '/set/' + id + '/' + view; + } + }]); + + return CampaignAdmin; +}(_SilverStripeComponent2.default); + +CampaignAdmin.propTypes = { + breadcrumbsActions: _react2.default.PropTypes.object.isRequired, + campaignId: _react2.default.PropTypes.string, + sectionConfig: _react2.default.PropTypes.shape({ + publishEndpoint: _react2.default.PropTypes.shape({ + url: _react2.default.PropTypes.string, + method: _react2.default.PropTypes.string + }), + form: _react2.default.PropTypes.shape({ + EditForm: _react2.default.PropTypes.shape({ + schemaUrl: _react2.default.PropTypes.string + }), + campaignEditForm: _react2.default.PropTypes.shape({ + schemaUrl: _react2.default.PropTypes.string + }), + campaignCreateForm: _react2.default.PropTypes.shape({ + schemaUrl: _react2.default.PropTypes.string + }) + }) + }), + securityId: _react2.default.PropTypes.string.isRequired, + view: _react2.default.PropTypes.string +}; + +function mapStateToProps(state, ownProps) { + var title = null; + var sectionConfig = state.config.sections.find(function (section) { + return section.name === sectionConfigKey; + }); + + if (ownProps.params.id > 0) { + var selector = (0, _reduxForm.formValueSelector)('Campaign.EditView', _getFormState2.default); + title = selector(state, 'Name'); + } + + return { + config: state.config, + campaignId: state.campaign.campaignId, + view: state.campaign.view, + breadcrumbs: state.breadcrumbs, + sectionConfig: sectionConfig, + securityId: state.config.SecurityID, + title: title + }; +} + +function mapDispatchToProps(dispatch) { + return { + breadcrumbsActions: (0, _redux.bindActionCreators)(breadcrumbsActions, dispatch), + campaignActions: (0, _redux.bindActionCreators)(campaignActions, dispatch) + }; +} + +exports.default = (0, _reactRouter.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(CampaignAdmin)); + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _SilverStripeComponent = __webpack_require__(1); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _reactBootstrapSs = __webpack_require__(27); + +var _formatWrittenNumber = __webpack_require__(33); + +var _formatWrittenNumber2 = _interopRequireDefault(_formatWrittenNumber); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var CampaignAdminItem = function (_SilverStripeComponen) { + _inherits(CampaignAdminItem, _SilverStripeComponen); + + function CampaignAdminItem() { + _classCallCheck(this, CampaignAdminItem); + + return _possibleConstructorReturn(this, (CampaignAdminItem.__proto__ || Object.getPrototypeOf(CampaignAdminItem)).apply(this, arguments)); + } + + _createClass(CampaignAdminItem, [{ + key: 'getNumReferTo', + value: function getNumReferTo() { + var numReferTo = this.props.item._links && this.props.item._links.references && this.props.item._links.references.length; + + return numReferTo || 0; + } + }, { + key: 'getNumReferredBy', + value: function getNumReferredBy() { + var numReferredBy = this.props.item._links && this.props.item._links.referenced_by && this.props.item._links.referenced_by.length; + + return numReferredBy || 0; + } + }, { + key: 'getReferToTooltipText', + value: function getReferToTooltipText() { + var numReferTo = this.getNumReferTo(); + return _i18n2.default.sprintf(_i18n2.default._t('CampaignAdmin.LINKED_TO', 'Requires %s item(s)'), (0, _formatWrittenNumber2.default)(numReferTo)); + } + }, { + key: 'getReferredByTooltipText', + value: function getReferredByTooltipText() { + var numReferredBy = this.getNumReferredBy(); + + return _i18n2.default.sprintf(_i18n2.default._t('CampaignAdmin.LINKED_FROM', 'Required by %s item(s)'), (0, _formatWrittenNumber2.default)(numReferredBy)); + } + }, { + key: 'render', + value: function render() { + var thumbnail = null; + var badge = {}; + var item = this.props.item; + var campaign = this.props.campaign; + + if (campaign.State === 'open') { + switch (item.ChangeType) { + case 'created': + badge.className = 'label label-warning list-group-item__status'; + badge.Title = _i18n2.default._t('CampaignAdmin.DRAFT', 'Draft'); + break; + case 'modified': + badge.className = 'label label-warning list-group-item__status'; + badge.Title = _i18n2.default._t('CampaignAdmin.MODIFIED', 'Modified'); + break; + case 'deleted': + badge.className = 'label label-error list-group-item__status'; + badge.Title = _i18n2.default._t('CampaignAdmin.REMOVED', 'Removed'); + break; + case 'none': + default: + badge.className = 'label label-success list-group-item__status'; + badge.Title = _i18n2.default._t('CampaignAdmin.NO_CHANGES', 'No changes'); + break; + } + } + + var links = this.renderLinks(); + + if (item.Thumbnail) { + thumbnail = _react2.default.createElement( + 'span', + { className: 'list-group-item__thumbnail' }, + _react2.default.createElement('img', { alt: item.Title, src: item.Thumbnail }) + ); + } + + return _react2.default.createElement( + 'div', + { className: 'fill-width' }, + thumbnail, + _react2.default.createElement( + 'div', + { className: 'list-group-item__details' }, + _react2.default.createElement( + 'h4', + { className: 'list-group-item__heading' }, + item.Title + ), + links, + badge.className && badge.Title && _react2.default.createElement( + 'span', + { className: badge.className }, + badge.Title + ) + ) + ); + } + }, { + key: 'renderLinks', + value: function renderLinks() { + var numReferTo = this.getNumReferTo(); + var numReferredBy = this.getNumReferredBy(); + + var tooltipTexts = []; + if (numReferTo > 0) { + tooltipTexts.push(this.getReferToTooltipText()); + } + if (numReferredBy > 0) { + tooltipTexts.push(_i18n2.default.sprintf(tooltipTexts.length === 0 ? this.getReferredByTooltipText() : this.getReferredByTooltipText().toLocaleLowerCase(), (0, _formatWrittenNumber2.default)(numReferredBy))); + } + + var tooltip = _react2.default.createElement( + _reactBootstrapSs.Tooltip, + { id: 'campaign-tooltip-' + this.props.item.ID }, + tooltipTexts.join(', ') + ); + + var links = null; + if (this.props.selected && numReferTo + numReferredBy > 0 || this.props.isLinked) { + var linksClasses = ['list-group-item__info', 'campaign-admin__item-links', this.props.isLinked ? 'campaign-admin__item-links--is-linked' : 'campaign-admin__item-links--has-links']; + + links = _react2.default.createElement( + 'div', + { className: linksClasses.join(' ') }, + _react2.default.createElement( + _reactBootstrapSs.OverlayTrigger, + { placement: 'left', overlay: tooltip }, + _react2.default.createElement( + 'span', + null, + _react2.default.createElement( + 'span', + { className: 'campaign-admin__item-links__number' }, + numReferTo + numReferredBy + ), + _react2.default.createElement('span', { className: 'font-icon-link' }) + ) + ) + ); + } + + return links; + } + }]); + + return CampaignAdminItem; +}(_SilverStripeComponent2.default); + +CampaignAdminItem.propTypes = { + campaign: _react2.default.PropTypes.object.isRequired, + item: _react2.default.PropTypes.object.isRequired, + isLinked: _react2.default.PropTypes.bool +}; + +exports.default = CampaignAdminItem; + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _redux = __webpack_require__(10); + +var _reactRedux = __webpack_require__(8); + +var _BreadcrumbsActions = __webpack_require__(6); + +var breadcrumbsActions = _interopRequireWildcard(_BreadcrumbsActions); + +var _RecordsActions = __webpack_require__(30); + +var recordActions = _interopRequireWildcard(_RecordsActions); + +var _CampaignActions = __webpack_require__(4); + +var campaignActions = _interopRequireWildcard(_CampaignActions); + +var _SilverStripeComponent = __webpack_require__(1); + +var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); + +var _Accordion = __webpack_require__(18); + +var _Accordion2 = _interopRequireDefault(_Accordion); + +var _AccordionBlock = __webpack_require__(19); + +var _AccordionBlock2 = _interopRequireDefault(_AccordionBlock); + +var _ListGroupItem = __webpack_require__(25); + +var _ListGroupItem2 = _interopRequireDefault(_ListGroupItem); + +var _Toolbar = __webpack_require__(11); + +var _Toolbar2 = _interopRequireDefault(_Toolbar); + +var _FormAction = __webpack_require__(7); + +var _FormAction2 = _interopRequireDefault(_FormAction); + +var _CampaignAdminItem = __webpack_require__(15); + +var _CampaignAdminItem2 = _interopRequireDefault(_CampaignAdminItem); + +var _Breadcrumb = __webpack_require__(5); + +var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb); + +var _Preview = __webpack_require__(26); + +var _Preview2 = _interopRequireDefault(_Preview); + +var _i18n = __webpack_require__(2); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _classnames = __webpack_require__(32); + +var _classnames2 = _interopRequireDefault(_classnames); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var CampaignAdminList = function (_SilverStripeComponen) { + _inherits(CampaignAdminList, _SilverStripeComponen); + + function CampaignAdminList(props) { + _classCallCheck(this, CampaignAdminList); + + var _this = _possibleConstructorReturn(this, (CampaignAdminList.__proto__ || Object.getPrototypeOf(CampaignAdminList)).call(this, props)); + + _this.handlePublish = _this.handlePublish.bind(_this); + _this.handleItemSelected = _this.handleItemSelected.bind(_this); + _this.setBreadcrumbs = _this.setBreadcrumbs.bind(_this); + _this.handleCloseItem = _this.handleCloseItem.bind(_this); + + if (!_this.isRecordLoaded()) { + _this.state = { + loading: true + }; + } else { + _this.state = { + loading: false + }; + } + return _this; + } + + _createClass(CampaignAdminList, [{ + key: 'componentDidMount', + value: function componentDidMount() { + var _this2 = this; + + var fetchURL = this.props.itemListViewEndpoint.url.replace(/:id/, this.props.campaignId); + _get(CampaignAdminList.prototype.__proto__ || Object.getPrototypeOf(CampaignAdminList.prototype), 'componentDidMount', this).call(this); + this.setBreadcrumbs(); + + if (!this.isRecordLoaded()) { + this.props.recordActions.fetchRecord(this.props.treeClass, 'get', fetchURL).then(function () { + _this2.setBreadcrumbs(); + _this2.setState({ loading: false }); + }); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this.props.campaignActions.setNewItem(null); + } + }, { + key: 'isRecordLoaded', + value: function isRecordLoaded() { + return Object.keys(this.props.record).length !== 0; + } + }, { + key: 'setBreadcrumbs', + value: function setBreadcrumbs() { + if (!this.props.record) { + return; + } + + var breadcrumbs = [{ + text: _i18n2.default._t('CampaignAdmin.CAMPAIGN', 'Campaigns'), + href: this.props.sectionConfig.url + }]; + breadcrumbs.push({ + text: this.props.record.Name, + href: this.props.sectionConfig.url + '/set/' + this.props.campaignId + '/show' + }); + + this.props.breadcrumbsActions.setBreadcrumbs(breadcrumbs); + } + }, { + key: 'getSelectedItem', + value: function getSelectedItem() { + var itemId = this.props.campaign.changeSetItemId; + var items = this.getItems() || []; + var selected = null; + + if (itemId) { + selected = items.find(function (item) { + return itemId === item.ID; + }); + } + + if (!selected && items.length > 0) { + selected = items[0]; + } + + return selected; + } + }, { + key: 'render', + value: function render() { + var _this3 = this; + + var itemId = this.props.campaign.changeSetItemId; + + var itemLinks = null; + var selectedClass = !itemId ? 'campaign-admin__campaign--hide-preview' : ''; + var campaignId = this.props.campaignId; + var campaign = this.props.record; + var newItem = this.props.newItem; + + var itemGroups = this.groupItemsForSet(); + + var accordionBlocks = []; + + var selectedItem = this.getSelectedItem(); + var selectedItemsLinkedTo = selectedItem && selectedItem._links && selectedItem._links.references || []; + var selectedItemsLinkedFrom = selectedItem && selectedItem._links && selectedItem._links.referenced_by || []; + + Object.keys(itemGroups).forEach(function (className) { + var group = itemGroups[className]; + var groupCount = group.items.length; + + var listGroupItems = []; + var title = '\n ' + (groupCount === 0 ? '' : groupCount) + '\n ' + (groupCount === 1 ? group.singular : group.plural) + '\n '; + var groupid = 'Set_' + campaignId + '_Group_' + className; + + group.items.forEach(function (item) { + if (!itemId) { + itemId = item.ID; + } + var selected = itemId === item.ID; + + if (selected && item._links) { + itemLinks = item._links; + } + + var itemClassNames = []; + if (item.ChangeType === 'none' || campaign.State === 'published') { + itemClassNames.push('list-group-item--inactive'); + } + if (selected) { + itemClassNames.push('active'); + } + + var isLinked = !!selectedItemsLinkedTo.find(function (linkToObj) { + return linkToObj.ChangeSetItemID === parseInt(item.ID, 10); + }); + + isLinked = isLinked || selectedItemsLinkedFrom.find(function (linkFromObj) { + return linkFromObj.ChangeSetItemID === item.ID; + }); + + listGroupItems.push(_react2.default.createElement( + _ListGroupItem2.default, + { + key: item.ID, + className: itemClassNames.join(' '), + handleClick: _this3.handleItemSelected, + handleClickArg: item.ID + }, + _react2.default.createElement(_CampaignAdminItem2.default, { + item: item, + campaign: _this3.props.record, + selected: selected, + isLinked: isLinked + }) + )); + }); + + var wrapperClassnames = (0, _classnames2.default)('list-group-wrapper', { + 'list-group-wrapper--empty': listGroupItems.length === 0 + }); + + accordionBlocks.push(_react2.default.createElement( + 'div', + { className: wrapperClassnames }, + _react2.default.createElement( + _AccordionBlock2.default, + { key: groupid, groupid: groupid, title: title }, + listGroupItems.length > 0 ? listGroupItems : _react2.default.createElement( + 'p', + { className: 'list-group-item' }, + group.noItemText + ) + ) + )); + }); + + var newItemInfo = newItem ? _react2.default.createElement( + 'p', + { className: 'alert alert-success alert--no-border', role: 'alert' }, + 'Nice one! You have successfully created a campaign.' + ) : null; + + var body = _react2.default.createElement( + _Accordion2.default, + null, + accordionBlocks + ); + var bodyClass = ['panel', 'panel--padded', 'panel--scrollable', 'flexbox-area-grow']; + + return _react2.default.createElement( + 'div', + { className: 'fill-width campaign-admin__campaign ' + selectedClass }, + _react2.default.createElement( + 'div', + { className: 'fill-height campaign-admin__campaign-items', 'aria-expanded': 'true' }, + _react2.default.createElement( + _Toolbar2.default, + { showBackButton: true, handleBackButtonClick: this.props.handleBackButtonClick }, + _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) + ), + newItemInfo, + _react2.default.createElement( + 'div', + { className: bodyClass.join(' ') }, + body + ), + _react2.default.createElement( + 'div', + { className: 'toolbar toolbar--south' }, + this.renderButtonToolbar() + ) + ), + this.renderPreview(itemLinks, itemId) + ); + } + }, { + key: 'renderPreview', + value: function renderPreview(itemLinks, itemId) { + var preview = null; + var previewClasses = (0, _classnames2.default)(['flexbox-area-grow', 'fill-height', 'preview', 'campaign-admin__campaign-preview', 'campaign-admin__campaign-preview--empty']); + + if (this.state.loading) { + preview = _react2.default.createElement( + 'div', + { className: previewClasses }, + _react2.default.createElement( + 'p', + null, + 'Loading...' + ) + ); + } else if (!this.getItems() || this.getItems().length === 0) { + preview = _react2.default.createElement( + 'div', + { className: previewClasses }, + _react2.default.createElement( + 'h2', + { className: 'campaign-admin__empty-heading' }, + 'Getting started' + ), + _react2.default.createElement( + 'p', + { className: 'campaign-admin__empty-info' }, + 'Select ', + _react2.default.createElement( + 'strong', + null, + 'Add to Campaign' + ), + ' from pages, files, and other content types' + ) + ); + } else { + preview = _react2.default.createElement(_Preview2.default, { itemLinks: itemLinks, itemId: itemId, onBack: this.handleCloseItem }); + } + + return preview; + } + }, { + key: 'handleItemSelected', + value: function handleItemSelected(event, itemId) { + this.props.campaignActions.selectChangeSetItem(itemId); + } + }, { + key: 'handleCloseItem', + value: function handleCloseItem() { + this.props.campaignActions.selectChangeSetItem(null); + } + }, { + key: 'renderButtonToolbar', + value: function renderButtonToolbar() { + var items = this.getItems(); + + var actionProps = {}; + + if (!items || items.length === 0) { + actionProps = Object.assign(actionProps, { + title: _i18n2.default._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), + buttonStyle: 'secondary-outline', + icon: 'rocket', + disabled: true + }); + } else if (this.props.record.State === 'open') { + actionProps = Object.assign(actionProps, { + title: _i18n2.default._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), + buttonStyle: 'primary', + loading: this.props.campaign.isPublishing, + handleClick: this.handlePublish, + icon: 'rocket' + }); + } else if (this.props.record.State === 'published') { + actionProps = Object.assign(actionProps, { + title: _i18n2.default._t('CampaignAdmin.REVERTCAMPAIGN', 'Revert'), + buttonStyle: 'secondary-outline', + icon: 'back-in-time', + disabled: true + }); + } + + return _react2.default.createElement( + 'div', + { className: 'btn-toolbar' }, + _react2.default.createElement(_FormAction2.default, actionProps) + ); + } + }, { + key: 'getItems', + value: function getItems() { + if (this.props.record && this.props.record._embedded) { + return this.props.record._embedded.items; + } + + return null; + } + }, { + key: 'groupItemsForSet', + value: function groupItemsForSet() { + var groups = this.getPlaceholderGroups(); + var items = this.getItems(); + if (!items) { + return groups; + } + + items.forEach(function (item) { + var classname = item.BaseClass; + + if (!groups[classname]) { + groups[classname] = { + singular: item.Singular, + plural: item.Plural, + items: [] + }; + } + + groups[classname].items.push(item); + }); + + return groups; + } + }, { + key: 'getPlaceholderGroups', + value: function getPlaceholderGroups() { + var groups = {}; + + if (this.props.record && this.props.record.placeholderGroups) { + this.props.record.placeholderGroups.forEach(function (group) { + groups[group.baseClass] = _extends({}, group); + groups[group.baseClass].items = [].concat(_toConsumableArray(group.items)); + }); + } + + return groups; + } + }, { + key: 'handlePublish', + value: function handlePublish(e) { + e.preventDefault(); + this.props.campaignActions.publishCampaign(this.props.publishApi, this.props.treeClass, this.props.campaignId); + } + }]); + + return CampaignAdminList; +}(_SilverStripeComponent2.default); + +CampaignAdminList.propTypes = { + campaign: _react2.default.PropTypes.shape({ + isPublishing: _react2.default.PropTypes.bool.isRequired, + changeSetItemId: _react2.default.PropTypes.number + }), + breadcrumbsActions: _react2.default.PropTypes.object.isRequired, + campaignActions: _react2.default.PropTypes.object.isRequired, + publishApi: _react2.default.PropTypes.func.isRequired, + record: _react2.default.PropTypes.object.isRequired, + recordActions: _react2.default.PropTypes.object.isRequired, + sectionConfig: _react2.default.PropTypes.object.isRequired, + handleBackButtonClick: _react2.default.PropTypes.func +}; + +function mapStateToProps(state, ownProps) { + var record = null; + var treeClass = ownProps.sectionConfig.treeClass; + if (state.records && state.records[treeClass] && ownProps.campaignId) { + record = state.records[treeClass][parseInt(ownProps.campaignId, 10)]; + } + return { + config: state.config, + record: record || {}, + campaign: state.campaign, + treeClass: treeClass, + newItem: state.campaign.newItem + }; +} + +function mapDispatchToProps(dispatch) { + return { + breadcrumbsActions: (0, _redux.bindActionCreators)(breadcrumbsActions, dispatch), + recordActions: (0, _redux.bindActionCreators)(recordActions, dispatch), + campaignActions: (0, _redux.bindActionCreators)(campaignActions, dispatch) + }; +} + +exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(CampaignAdminList); + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +var _deepFreezeStrict = __webpack_require__(22); + +var _deepFreezeStrict2 = _interopRequireDefault(_deepFreezeStrict); + +var _CampaignActionTypes = __webpack_require__(3); + +var _CampaignActionTypes2 = _interopRequireDefault(_CampaignActionTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var initialState = (0, _deepFreezeStrict2.default)({ + campaignId: null, + changeSetItemId: null, + isPublishing: false, + view: null, + newItem: null +}); + +function reducer() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; + var action = arguments[1]; + + switch (action.type) { + + case _CampaignActionTypes2.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM: + return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { + changeSetItemId: action.payload.changeSetItemId + })); + + case _CampaignActionTypes2.default.SET_CAMPAIGN_ACTIVE_CHANGESET: + return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { + campaignId: action.payload.campaignId, + view: action.payload.view, + changeSetItemId: null + })); + + case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_REQUEST: + return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { + isPublishing: true + })); + + case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_SUCCESS: + case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_FAILURE: + return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { + isPublishing: false + })); + + case _CampaignActionTypes2.default.SET_NEW_CAMPAIGN: + return (0, _deepFreezeStrict2.default)(_extends({}, state, { + newItem: action.payload.newItem + })); + + default: + return state; + + } +} + +exports.default = reducer; + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + +module.exports = Accordion; + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +module.exports = AccordionBlock; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +module.exports = Backend; + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +module.exports = Config; + +/***/ }), +/* 22 */ +/***/ (function(module, exports) { + +module.exports = DeepFreezeStrict; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +module.exports = FormBuilderLoader; + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + +module.exports = Injector; + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +module.exports = ListGroupItem; + +/***/ }), +/* 26 */ +/***/ (function(module, exports) { + +module.exports = Preview; + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + +module.exports = ReactBootstrap; + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + +module.exports = ReactRouteRegister; + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +module.exports = RecordsActionTypes; + +/***/ }), +/* 30 */ +/***/ (function(module, exports) { + +module.exports = RecordsActions; + +/***/ }), +/* 31 */ +/***/ (function(module, exports) { + +module.exports = ReduxForm; + +/***/ }), +/* 32 */ +/***/ (function(module, exports) { + +module.exports = classnames; + +/***/ }), +/* 33 */ +/***/ (function(module, exports) { + +module.exports = formatWrittenNumber; + +/***/ }), +/* 34 */ +/***/ (function(module, exports) { + +module.exports = getFormState; + +/***/ }) +/******/ ]); +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/client/dist/styles/bundle.css b/client/dist/styles/bundle.css index 9ef96769..0e5bdf38 100644 --- a/client/dist/styles/bundle.css +++ b/client/dist/styles/bundle.css @@ -1 +1,2 @@ -.campaign-admin__campaign{position:relative;height:100%}@media (max-width:991px){.campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview{display:none}.campaign-admin__campaign .list-group-item.active{background-color:#fff;color:#4f5861;z-index:0}}@media (max-width:991px) and (max-width:1199px){.campaign-admin__campaign .list-group-item.active{border:none}}@media (max-width:991px){.campaign-admin__campaign .list-group-item.active:hover{background-color:#f5f5f5;color:#4f5861;border-color:#e5e8eb}}.campaign-admin__campaign .campaign-admin__campaign-preview--empty{-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.campaign-admin__campaign .campaign-admin__empty-heading{font-size:1.693rem;margin-bottom:1em}.campaign-admin__campaign .campaign-admin__empty-info{padding-top:calc(270px + .5em);background-image:url(../images/empty-campaign-preview.png);background-repeat:no-repeat;background-position:50% 0;font-size:1.231rem}.campaign-admin__campaign-items{width:100%;z-index:1;position:relative}@media (min-width:992px){.campaign-admin__campaign-items{width:300px}}.campaign-admin__item-links,.campaign-admin__item-links--has-links,.campaign-admin__item-links--is-linked{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;color:#29abe2;position:absolute;right:1.2308rem;bottom:.82053rem;font-size:.923rem}.campaign-admin__item-links--has-links .font-icon-link,.campaign-admin__item-links--is-linked .font-icon-link,.campaign-admin__item-links .font-icon-link{font-size:16px;position:relative;top:3px;margin-right:1px;margin-left:3px}.campaign-admin__item-links--has-links .campaign-admin__item-links__number,.campaign-admin__item-links--is-linked .campaign-admin__item-links__number,.campaign-admin__item-links .campaign-admin__item-links__number{opacity:0}.list-group-item.active .campaign-admin__item-links--has-links{opacity:1}@media (min-width:992px){.list-group-item.active .campaign-admin__item-links--has-links{color:#fff}}.list-group-item.active .campaign-admin__item-links__number{opacity:1}.list-group-wrapper--empty .list-group{border-bottom:0}.list-group-wrapper--empty .list-group-item{background:transparent;font-style:italic;border-bottom:0;cursor:default}.list-group-wrapper--empty .accordion__title{cursor:default}.list-group-wrapper--empty .accordion__title:before{display:none}.campaign-admin__item-links--is-linked{opacity:1}.campaign-admin__item-links--is-linked .campaign-admin__item-links__number{display:none}.list-group-item:hover .campaign-admin__item-links--is-linked{opacity:1} \ No newline at end of file +.campaign-admin__campaign{position:relative;height:100%}@media (max-width:991px){.campaign-admin__campaign.campaign-admin__campaign--hide-preview .campaign-admin__campaign-preview{display:none}.campaign-admin__campaign .list-group-item.active{background-color:#fff;color:#4f5861;z-index:0}}@media (max-width:991px) and (max-width:1199px){.campaign-admin__campaign .list-group-item.active{border:none}}@media (max-width:991px){.campaign-admin__campaign .list-group-item.active:hover{background-color:#f5f5f5;color:#4f5861;border-color:#e5e8eb}}.campaign-admin__campaign .campaign-admin__campaign-preview--empty{-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.campaign-admin__campaign .campaign-admin__empty-heading{font-size:1.693rem;margin-bottom:1em}.campaign-admin__campaign .campaign-admin__empty-info{padding-top:calc(270px + .5em);background-image:url(../images/empty-campaign-preview.png);background-repeat:no-repeat;background-position:50% 0;font-size:1.231rem}.campaign-admin__campaign-items{width:100%;z-index:1;position:relative}@media (min-width:992px){.campaign-admin__campaign-items{width:300px}}.campaign-admin__item-links,.campaign-admin__item-links--has-links,.campaign-admin__item-links--is-linked{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;color:#29abe2;position:absolute;right:1.2308rem;bottom:.82053rem;font-size:.923rem}.campaign-admin__item-links--has-links .font-icon-link,.campaign-admin__item-links--is-linked .font-icon-link,.campaign-admin__item-links .font-icon-link{font-size:16px;position:relative;top:3px;margin-right:1px;margin-left:3px}.campaign-admin__item-links--has-links .campaign-admin__item-links__number,.campaign-admin__item-links--is-linked .campaign-admin__item-links__number,.campaign-admin__item-links .campaign-admin__item-links__number{opacity:0}.list-group-item.active .campaign-admin__item-links--has-links{opacity:1}@media (min-width:992px){.list-group-item.active .campaign-admin__item-links--has-links{color:#fff}}.list-group-item.active .campaign-admin__item-links__number{opacity:1}.list-group-wrapper--empty .list-group{border-bottom:0}.list-group-wrapper--empty .list-group-item{background:transparent;font-style:italic;border-bottom:0;cursor:default}.list-group-wrapper--empty .accordion__title{cursor:default}.list-group-wrapper--empty .accordion__title:before{display:none}.campaign-admin__item-links--is-linked{opacity:1}.campaign-admin__item-links--is-linked .campaign-admin__item-links__number{display:none}.list-group-item:hover .campaign-admin__item-links--is-linked{opacity:1} +/*# sourceMappingURL=bundle.css.map*/ \ No newline at end of file diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index a33747d9..b960e6aa 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -517,9 +517,16 @@ public function getCampaignEditForm($id) FieldList::create( FormAction::create('save', _t(__CLASS__.'.SAVE', 'Save')) ->setIcon('save') - ->setSavedTitle('Saved') - ->setSavedIcon('tick') - ->setSavedClasses('primary-outline'), + ->setSchemaState([ + 'data' => [ + 'pristineTitle' => 'Saved', + 'pristineIcon' => 'tick', + 'dirtyTitle' => 'Save changes', + 'dirtyIcon' => '', + 'pristineClass' => 'btn-primary-outline', + 'dirtyClass' => '', + ], + ]), FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) ->setUseButtonTag(true) ), From 12b80f0b4fde653f0685423f847cfef3fa5ed449 Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Wed, 2 Aug 2017 15:44:44 +1200 Subject: [PATCH 08/14] Build --- client/dist/js/bundle.js | 1610 +-------------------------------- client/dist/styles/bundle.css | 3 +- 2 files changed, 2 insertions(+), 1611 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index fc4a9f1e..04ef1500 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1,1609 +1 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 13); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = React; - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = SilverStripeComponent; - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -module.exports = i18n; - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - SET_CAMPAIGN_ACTIVE_CHANGESET: 'SET_CAMPAIGN_ACTIVE_CHANGESET', - SET_CAMPAIGN_SELECTED_CHANGESETITEM: 'SET_CAMPAIGN_SELECTED_CHANGESETITEM', - PUBLISH_CAMPAIGN_REQUEST: 'PUBLISH_CAMPAIGN_REQUEST', - PUBLISH_CAMPAIGN_SUCCESS: 'PUBLISH_CAMPAIGN_SUCCESS', - PUBLISH_CAMPAIGN_FAILURE: 'PUBLISH_CAMPAIGN_FAILURE', - SET_NEW_CAMPAIGN: 'SET_NEW_CAMPAIGN' -}; - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.selectChangeSetItem = selectChangeSetItem; -exports.showCampaignView = showCampaignView; -exports.publishCampaign = publishCampaign; -exports.setNewItem = setNewItem; - -var _CampaignActionTypes = __webpack_require__(3); - -var _CampaignActionTypes2 = _interopRequireDefault(_CampaignActionTypes); - -var _RecordsActionTypes = __webpack_require__(29); - -var _RecordsActionTypes2 = _interopRequireDefault(_RecordsActionTypes); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function selectChangeSetItem(changeSetItemId) { - return { - type: _CampaignActionTypes2.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM, - payload: { changeSetItemId: changeSetItemId } - }; -} - -function showCampaignView(campaignId, view) { - return function (dispatch) { - dispatch({ - type: _CampaignActionTypes2.default.SET_CAMPAIGN_ACTIVE_CHANGESET, - payload: { campaignId: campaignId, view: view } - }); - }; -} - -function publishCampaign(publishApi, recordType, campaignId) { - return function (dispatch) { - dispatch({ - type: _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_REQUEST, - payload: { campaignId: campaignId } - }); - - publishApi({ id: campaignId }).then(function (data) { - dispatch({ - type: _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_SUCCESS, - payload: { campaignId: campaignId } - }); - dispatch({ - type: _RecordsActionTypes2.default.FETCH_RECORD_SUCCESS, - payload: { recordType: recordType, data: data } - }); - }).catch(function (error) { - dispatch({ - type: _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_FAILURE, - payload: { error: error } - }); - }); - }; -} - -function setNewItem(itemId) { - return { - type: _CampaignActionTypes2.default.SET_NEW_CAMPAIGN, - payload: { newItem: itemId } - }; -} - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - -module.exports = Breadcrumb; - -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - -module.exports = BreadcrumbsActions; - -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - -module.exports = FormAction; - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - -module.exports = ReactRedux; - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - -module.exports = ReactRouter; - -/***/ }), -/* 10 */ -/***/ (function(module, exports) { - -module.exports = Redux; - -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - -module.exports = Toolbar; - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _reactRouter = __webpack_require__(9); - -var _Config = __webpack_require__(21); - -var _Config2 = _interopRequireDefault(_Config); - -var _Injector = __webpack_require__(24); - -var _Injector2 = _interopRequireDefault(_Injector); - -var _ReactRouteRegister = __webpack_require__(28); - -var _ReactRouteRegister2 = _interopRequireDefault(_ReactRouteRegister); - -var _CampaignAdmin = __webpack_require__(14); - -var _CampaignAdmin2 = _interopRequireDefault(_CampaignAdmin); - -var _CampaignReducer = __webpack_require__(17); - -var _CampaignReducer2 = _interopRequireDefault(_CampaignReducer); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -document.addEventListener('DOMContentLoaded', function () { - var sectionConfig = _Config2.default.getSection('SilverStripe\\CampaignAdmin\\CampaignAdmin'); - _ReactRouteRegister2.default.add({ - path: sectionConfig.url, - component: (0, _reactRouter.withRouter)(_CampaignAdmin2.default), - childRoutes: [{ path: ':type/:id/:view', component: _CampaignAdmin2.default }, { path: 'set/:id/:view', component: _CampaignAdmin2.default }] - }); - - _Injector2.default.reducer.register('campaign', _CampaignReducer2.default); -}); - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -__webpack_require__(12); - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _react = __webpack_require__(0); - -var _react2 = _interopRequireDefault(_react); - -var _reactRedux = __webpack_require__(8); - -var _reduxForm = __webpack_require__(31); - -var _redux = __webpack_require__(10); - -var _reactRouter = __webpack_require__(9); - -var _getFormState = __webpack_require__(34); - -var _getFormState2 = _interopRequireDefault(_getFormState); - -var _Backend = __webpack_require__(20); - -var _Backend2 = _interopRequireDefault(_Backend); - -var _CampaignActions = __webpack_require__(4); - -var campaignActions = _interopRequireWildcard(_CampaignActions); - -var _BreadcrumbsActions = __webpack_require__(6); - -var breadcrumbsActions = _interopRequireWildcard(_BreadcrumbsActions); - -var _Breadcrumb = __webpack_require__(5); - -var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb); - -var _SilverStripeComponent = __webpack_require__(1); - -var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); - -var _FormAction = __webpack_require__(7); - -var _FormAction2 = _interopRequireDefault(_FormAction); - -var _i18n = __webpack_require__(2); - -var _i18n2 = _interopRequireDefault(_i18n); - -var _Toolbar = __webpack_require__(11); - -var _Toolbar2 = _interopRequireDefault(_Toolbar); - -var _FormBuilderLoader = __webpack_require__(23); - -var _FormBuilderLoader2 = _interopRequireDefault(_FormBuilderLoader); - -var _CampaignAdminList = __webpack_require__(16); - -var _CampaignAdminList2 = _interopRequireDefault(_CampaignAdminList); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var sectionConfigKey = 'SilverStripe\\CampaignAdmin\\CampaignAdmin'; - -var CampaignAdmin = function (_SilverStripeComponen) { - _inherits(CampaignAdmin, _SilverStripeComponen); - - function CampaignAdmin(props) { - _classCallCheck(this, CampaignAdmin); - - var _this = _possibleConstructorReturn(this, (CampaignAdmin.__proto__ || Object.getPrototypeOf(CampaignAdmin)).call(this, props)); - - _this.publishApi = _Backend2.default.createEndpointFetcher({ - url: _this.props.sectionConfig.publishEndpoint.url, - method: _this.props.sectionConfig.publishEndpoint.method, - defaultData: { SecurityID: _this.props.securityId }, - payloadSchema: { - id: { urlReplacement: ':id', remove: true } - } - }); - - _this.handleBackButtonClick = _this.handleBackButtonClick.bind(_this); - _this.handleCreateCampaignSubmit = _this.handleCreateCampaignSubmit.bind(_this); - _this.handleFormAction = _this.handleFormAction.bind(_this); - return _this; - } - - _createClass(CampaignAdmin, [{ - key: 'componentWillMount', - value: function componentWillMount() { - var _props = this.props, - breadcrumbs = _props.breadcrumbs, - title = _props.title, - _props$params = _props.params, - view = _props$params.view, - id = _props$params.id; - - if (breadcrumbs.length === 0) { - this.setBreadcrumbs(view, id, title); - } - } - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(props) { - var title = props.title, - _props$params2 = props.params, - id = _props$params2.id, - view = _props$params2.view; - - var hasChangedRoute = this.props.params.id !== id || this.props.params.view !== view || this.props.title !== title; - if (hasChangedRoute) { - this.setBreadcrumbs(view, id, title); - } - } - }, { - key: 'setBreadcrumbs', - value: function setBreadcrumbs(view, id, title) { - var breadcrumbs = [{ - text: _i18n2.default._t('CampaignAdmin.CAMPAIGN', 'Campaigns'), - href: this.props.sectionConfig.url - }]; - switch (view) { - case 'show': - break; - case 'edit': - breadcrumbs.push({ - text: title, - href: this.getActionRoute(id, view) - }); - break; - case 'create': - breadcrumbs.push({ - text: _i18n2.default._t('CampaignAdmin.ADD_CAMPAIGN', 'Add Campaign'), - href: this.getActionRoute(id, view) - }); - break; - default: - break; - } - - this.props.breadcrumbsActions.setBreadcrumbs(breadcrumbs); - } - }, { - key: 'handleBackButtonClick', - value: function handleBackButtonClick(event) { - if (this.props.breadcrumbs.length > 1) { - var last = this.props.breadcrumbs[this.props.breadcrumbs.length - 2]; - if (last && last.href) { - event.preventDefault(); - this.props.router.push(last.href); - } - } - } - }, { - key: 'handleCreateCampaignSubmit', - value: function handleCreateCampaignSubmit(data, action, submitFn) { - var _this2 = this; - - var promise = submitFn(); - if (!promise) { - throw new Error('Promise was not returned for submitting'); - } - return promise.then(function (response) { - var hasErrors = response.errors && response.errors.length > 0; - if (action === 'action_save' && !hasErrors) { - var sectionUrl = _this2.props.sectionConfig.url; - var id = response.record.id; - _this2.props.campaignActions.setNewItem(id); - _this2.props.router.push(sectionUrl + '/set/' + id + '/show'); - } - - return response; - }); - } - }, { - key: 'handleFormAction', - value: function handleFormAction(event) { - var name = event.currentTarget.name; - - if (name === 'action_cancel') { - var url = this.props.sectionConfig.url; - this.props.router.push(url); - event.preventDefault(); - } - } - }, { - key: 'render', - value: function render() { - var view = null; - - switch (this.props.params.view) { - case 'show': - view = this.renderItemListView(); - break; - case 'edit': - view = this.renderDetailEditView(); - break; - case 'create': - view = this.renderCreateView(); - break; - default: - view = this.renderIndexView(); - } - - return view; - } - }, { - key: 'renderIndexView', - value: function renderIndexView() { - var schemaUrl = this.props.sectionConfig.form.EditForm.schemaUrl; - var formActionProps = { - title: _i18n2.default._t('CampaignAdmin.ADDCAMPAIGN'), - icon: 'plus', - extraClass: 'btn-primary', - handleClick: this.addCampaign.bind(this) - }; - var formBuilderProps = { - createFn: this.campaignListCreateFn.bind(this), - schemaUrl: schemaUrl, - identifier: 'Campaign.IndexView' - }; - - return _react2.default.createElement( - 'div', - { className: 'fill-height', 'aria-expanded': 'true' }, - _react2.default.createElement( - _Toolbar2.default, - null, - _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) - ), - _react2.default.createElement( - 'div', - { className: 'panel panel--padded panel--scrollable flexbox-area-grow' }, - _react2.default.createElement( - 'div', - { className: 'toolbar toolbar--content' }, - _react2.default.createElement( - 'div', - { className: 'btn-toolbar' }, - _react2.default.createElement(_FormAction2.default, formActionProps) - ) - ), - _react2.default.createElement(_FormBuilderLoader2.default, formBuilderProps) - ) - ); - } - }, { - key: 'renderItemListView', - value: function renderItemListView() { - var props = { - sectionConfig: this.props.sectionConfig, - campaignId: this.props.params.id, - itemListViewEndpoint: this.props.sectionConfig.itemListViewEndpoint, - publishApi: this.publishApi, - handleBackButtonClick: this.handleBackButtonClick.bind(this) - }; - - return _react2.default.createElement(_CampaignAdminList2.default, props); - } - }, { - key: 'renderDetailEditView', - value: function renderDetailEditView() { - if (this.props.params.id <= 0) { - return this.renderCreateView(); - } - var baseSchemaUrl = this.props.sectionConfig.form.campaignEditForm.schemaUrl; - var schemaUrl = baseSchemaUrl + '/' + this.props.params.id; - - return _react2.default.createElement( - 'div', - { className: 'fill-height' }, - _react2.default.createElement( - _Toolbar2.default, - { showBackButton: true, handleBackButtonClick: this.handleBackButtonClick }, - _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) - ), - _react2.default.createElement( - 'div', - { className: 'panel panel--padded panel--scrollable flexbox-area-grow form--inline' }, - _react2.default.createElement(_FormBuilderLoader2.default, { - handleAction: this.handleFormAction, - schemaUrl: schemaUrl, - identifier: 'Campaign.EditView' - }) - ) - ); - } - }, { - key: 'renderCreateView', - value: function renderCreateView() { - var schemaUrl = this.props.sectionConfig.form.campaignCreateForm.schemaUrl; - return _react2.default.createElement( - 'div', - { className: 'fill-height' }, - _react2.default.createElement( - _Toolbar2.default, - { showBackButton: true, handleBackButtonClick: this.handleBackButtonClick }, - _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) - ), - _react2.default.createElement( - 'div', - { className: 'panel panel--padded panel--scrollable flexbox-area-grow form--inline' }, - _react2.default.createElement(_FormBuilderLoader2.default, { - handleSubmit: this.handleCreateCampaignSubmit, - handleAction: this.handleFormAction, - schemaUrl: schemaUrl, - identifier: 'Campaign.CreateView' - }) - ) - ); - } - }, { - key: 'campaignEditCreateFn', - value: function campaignEditCreateFn(Component, props) { - var _this3 = this; - - var url = this.props.sectionConfig.url; - - if (props.name === 'action_cancel') { - var extendedProps = Object.assign({}, props, { - handleClick: function handleClick(event) { - event.preventDefault(); - _this3.props.router.push(url); - } - }); - - return _react2.default.createElement(Component, _extends({ key: props.id }, extendedProps)); - } - - return _react2.default.createElement(Component, _extends({ key: props.id }, props)); - } - }, { - key: 'campaignAddCreateFn', - value: function campaignAddCreateFn(Component, props) { - var _this4 = this; - - var url = this.props.sectionConfig.url; - - if (props.name === 'action_cancel') { - var extendedProps = Object.assign({}, props, { - handleClick: function handleClick(event) { - event.preventDefault(); - _this4.props.router.push(url); - } - }); - - return _react2.default.createElement(Component, _extends({ key: props.name }, extendedProps)); - } - - return _react2.default.createElement(Component, _extends({ key: props.name }, props)); - } - }, { - key: 'campaignListCreateFn', - value: function campaignListCreateFn(Component, props) { - var _this5 = this; - - var sectionUrl = this.props.sectionConfig.url; - var typeUrlParam = 'set'; - - if (props.schemaComponent === 'GridField') { - var extendedProps = Object.assign({}, props, { - data: Object.assign({}, props.data, { - handleDrillDown: function handleDrillDown(event, record) { - _this5.props.router.push(sectionUrl + '/' + typeUrlParam + '/' + record.ID + '/show'); - }, - handleEditRecord: function handleEditRecord(event, id) { - _this5.props.router.push(sectionUrl + '/' + typeUrlParam + '/' + id + '/edit'); - } - }) - }); - - return _react2.default.createElement(Component, _extends({ key: extendedProps.name }, extendedProps)); - } - - return _react2.default.createElement(Component, _extends({ key: props.name }, props)); - } - }, { - key: 'addCampaign', - value: function addCampaign() { - var path = this.getActionRoute(0, 'create'); - this.props.router.push(path); - } - }, { - key: 'getActionRoute', - value: function getActionRoute(id, view) { - return this.props.sectionConfig.url + '/set/' + id + '/' + view; - } - }]); - - return CampaignAdmin; -}(_SilverStripeComponent2.default); - -CampaignAdmin.propTypes = { - breadcrumbsActions: _react2.default.PropTypes.object.isRequired, - campaignId: _react2.default.PropTypes.string, - sectionConfig: _react2.default.PropTypes.shape({ - publishEndpoint: _react2.default.PropTypes.shape({ - url: _react2.default.PropTypes.string, - method: _react2.default.PropTypes.string - }), - form: _react2.default.PropTypes.shape({ - EditForm: _react2.default.PropTypes.shape({ - schemaUrl: _react2.default.PropTypes.string - }), - campaignEditForm: _react2.default.PropTypes.shape({ - schemaUrl: _react2.default.PropTypes.string - }), - campaignCreateForm: _react2.default.PropTypes.shape({ - schemaUrl: _react2.default.PropTypes.string - }) - }) - }), - securityId: _react2.default.PropTypes.string.isRequired, - view: _react2.default.PropTypes.string -}; - -function mapStateToProps(state, ownProps) { - var title = null; - var sectionConfig = state.config.sections.find(function (section) { - return section.name === sectionConfigKey; - }); - - if (ownProps.params.id > 0) { - var selector = (0, _reduxForm.formValueSelector)('Campaign.EditView', _getFormState2.default); - title = selector(state, 'Name'); - } - - return { - config: state.config, - campaignId: state.campaign.campaignId, - view: state.campaign.view, - breadcrumbs: state.breadcrumbs, - sectionConfig: sectionConfig, - securityId: state.config.SecurityID, - title: title - }; -} - -function mapDispatchToProps(dispatch) { - return { - breadcrumbsActions: (0, _redux.bindActionCreators)(breadcrumbsActions, dispatch), - campaignActions: (0, _redux.bindActionCreators)(campaignActions, dispatch) - }; -} - -exports.default = (0, _reactRouter.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(CampaignAdmin)); - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _react = __webpack_require__(0); - -var _react2 = _interopRequireDefault(_react); - -var _SilverStripeComponent = __webpack_require__(1); - -var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); - -var _i18n = __webpack_require__(2); - -var _i18n2 = _interopRequireDefault(_i18n); - -var _reactBootstrapSs = __webpack_require__(27); - -var _formatWrittenNumber = __webpack_require__(33); - -var _formatWrittenNumber2 = _interopRequireDefault(_formatWrittenNumber); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CampaignAdminItem = function (_SilverStripeComponen) { - _inherits(CampaignAdminItem, _SilverStripeComponen); - - function CampaignAdminItem() { - _classCallCheck(this, CampaignAdminItem); - - return _possibleConstructorReturn(this, (CampaignAdminItem.__proto__ || Object.getPrototypeOf(CampaignAdminItem)).apply(this, arguments)); - } - - _createClass(CampaignAdminItem, [{ - key: 'getNumReferTo', - value: function getNumReferTo() { - var numReferTo = this.props.item._links && this.props.item._links.references && this.props.item._links.references.length; - - return numReferTo || 0; - } - }, { - key: 'getNumReferredBy', - value: function getNumReferredBy() { - var numReferredBy = this.props.item._links && this.props.item._links.referenced_by && this.props.item._links.referenced_by.length; - - return numReferredBy || 0; - } - }, { - key: 'getReferToTooltipText', - value: function getReferToTooltipText() { - var numReferTo = this.getNumReferTo(); - return _i18n2.default.sprintf(_i18n2.default._t('CampaignAdmin.LINKED_TO', 'Requires %s item(s)'), (0, _formatWrittenNumber2.default)(numReferTo)); - } - }, { - key: 'getReferredByTooltipText', - value: function getReferredByTooltipText() { - var numReferredBy = this.getNumReferredBy(); - - return _i18n2.default.sprintf(_i18n2.default._t('CampaignAdmin.LINKED_FROM', 'Required by %s item(s)'), (0, _formatWrittenNumber2.default)(numReferredBy)); - } - }, { - key: 'render', - value: function render() { - var thumbnail = null; - var badge = {}; - var item = this.props.item; - var campaign = this.props.campaign; - - if (campaign.State === 'open') { - switch (item.ChangeType) { - case 'created': - badge.className = 'label label-warning list-group-item__status'; - badge.Title = _i18n2.default._t('CampaignAdmin.DRAFT', 'Draft'); - break; - case 'modified': - badge.className = 'label label-warning list-group-item__status'; - badge.Title = _i18n2.default._t('CampaignAdmin.MODIFIED', 'Modified'); - break; - case 'deleted': - badge.className = 'label label-error list-group-item__status'; - badge.Title = _i18n2.default._t('CampaignAdmin.REMOVED', 'Removed'); - break; - case 'none': - default: - badge.className = 'label label-success list-group-item__status'; - badge.Title = _i18n2.default._t('CampaignAdmin.NO_CHANGES', 'No changes'); - break; - } - } - - var links = this.renderLinks(); - - if (item.Thumbnail) { - thumbnail = _react2.default.createElement( - 'span', - { className: 'list-group-item__thumbnail' }, - _react2.default.createElement('img', { alt: item.Title, src: item.Thumbnail }) - ); - } - - return _react2.default.createElement( - 'div', - { className: 'fill-width' }, - thumbnail, - _react2.default.createElement( - 'div', - { className: 'list-group-item__details' }, - _react2.default.createElement( - 'h4', - { className: 'list-group-item__heading' }, - item.Title - ), - links, - badge.className && badge.Title && _react2.default.createElement( - 'span', - { className: badge.className }, - badge.Title - ) - ) - ); - } - }, { - key: 'renderLinks', - value: function renderLinks() { - var numReferTo = this.getNumReferTo(); - var numReferredBy = this.getNumReferredBy(); - - var tooltipTexts = []; - if (numReferTo > 0) { - tooltipTexts.push(this.getReferToTooltipText()); - } - if (numReferredBy > 0) { - tooltipTexts.push(_i18n2.default.sprintf(tooltipTexts.length === 0 ? this.getReferredByTooltipText() : this.getReferredByTooltipText().toLocaleLowerCase(), (0, _formatWrittenNumber2.default)(numReferredBy))); - } - - var tooltip = _react2.default.createElement( - _reactBootstrapSs.Tooltip, - { id: 'campaign-tooltip-' + this.props.item.ID }, - tooltipTexts.join(', ') - ); - - var links = null; - if (this.props.selected && numReferTo + numReferredBy > 0 || this.props.isLinked) { - var linksClasses = ['list-group-item__info', 'campaign-admin__item-links', this.props.isLinked ? 'campaign-admin__item-links--is-linked' : 'campaign-admin__item-links--has-links']; - - links = _react2.default.createElement( - 'div', - { className: linksClasses.join(' ') }, - _react2.default.createElement( - _reactBootstrapSs.OverlayTrigger, - { placement: 'left', overlay: tooltip }, - _react2.default.createElement( - 'span', - null, - _react2.default.createElement( - 'span', - { className: 'campaign-admin__item-links__number' }, - numReferTo + numReferredBy - ), - _react2.default.createElement('span', { className: 'font-icon-link' }) - ) - ) - ); - } - - return links; - } - }]); - - return CampaignAdminItem; -}(_SilverStripeComponent2.default); - -CampaignAdminItem.propTypes = { - campaign: _react2.default.PropTypes.object.isRequired, - item: _react2.default.PropTypes.object.isRequired, - isLinked: _react2.default.PropTypes.bool -}; - -exports.default = CampaignAdminItem; - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - -var _react = __webpack_require__(0); - -var _react2 = _interopRequireDefault(_react); - -var _redux = __webpack_require__(10); - -var _reactRedux = __webpack_require__(8); - -var _BreadcrumbsActions = __webpack_require__(6); - -var breadcrumbsActions = _interopRequireWildcard(_BreadcrumbsActions); - -var _RecordsActions = __webpack_require__(30); - -var recordActions = _interopRequireWildcard(_RecordsActions); - -var _CampaignActions = __webpack_require__(4); - -var campaignActions = _interopRequireWildcard(_CampaignActions); - -var _SilverStripeComponent = __webpack_require__(1); - -var _SilverStripeComponent2 = _interopRequireDefault(_SilverStripeComponent); - -var _Accordion = __webpack_require__(18); - -var _Accordion2 = _interopRequireDefault(_Accordion); - -var _AccordionBlock = __webpack_require__(19); - -var _AccordionBlock2 = _interopRequireDefault(_AccordionBlock); - -var _ListGroupItem = __webpack_require__(25); - -var _ListGroupItem2 = _interopRequireDefault(_ListGroupItem); - -var _Toolbar = __webpack_require__(11); - -var _Toolbar2 = _interopRequireDefault(_Toolbar); - -var _FormAction = __webpack_require__(7); - -var _FormAction2 = _interopRequireDefault(_FormAction); - -var _CampaignAdminItem = __webpack_require__(15); - -var _CampaignAdminItem2 = _interopRequireDefault(_CampaignAdminItem); - -var _Breadcrumb = __webpack_require__(5); - -var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb); - -var _Preview = __webpack_require__(26); - -var _Preview2 = _interopRequireDefault(_Preview); - -var _i18n = __webpack_require__(2); - -var _i18n2 = _interopRequireDefault(_i18n); - -var _classnames = __webpack_require__(32); - -var _classnames2 = _interopRequireDefault(_classnames); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CampaignAdminList = function (_SilverStripeComponen) { - _inherits(CampaignAdminList, _SilverStripeComponen); - - function CampaignAdminList(props) { - _classCallCheck(this, CampaignAdminList); - - var _this = _possibleConstructorReturn(this, (CampaignAdminList.__proto__ || Object.getPrototypeOf(CampaignAdminList)).call(this, props)); - - _this.handlePublish = _this.handlePublish.bind(_this); - _this.handleItemSelected = _this.handleItemSelected.bind(_this); - _this.setBreadcrumbs = _this.setBreadcrumbs.bind(_this); - _this.handleCloseItem = _this.handleCloseItem.bind(_this); - - if (!_this.isRecordLoaded()) { - _this.state = { - loading: true - }; - } else { - _this.state = { - loading: false - }; - } - return _this; - } - - _createClass(CampaignAdminList, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var _this2 = this; - - var fetchURL = this.props.itemListViewEndpoint.url.replace(/:id/, this.props.campaignId); - _get(CampaignAdminList.prototype.__proto__ || Object.getPrototypeOf(CampaignAdminList.prototype), 'componentDidMount', this).call(this); - this.setBreadcrumbs(); - - if (!this.isRecordLoaded()) { - this.props.recordActions.fetchRecord(this.props.treeClass, 'get', fetchURL).then(function () { - _this2.setBreadcrumbs(); - _this2.setState({ loading: false }); - }); - } - } - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - this.props.campaignActions.setNewItem(null); - } - }, { - key: 'isRecordLoaded', - value: function isRecordLoaded() { - return Object.keys(this.props.record).length !== 0; - } - }, { - key: 'setBreadcrumbs', - value: function setBreadcrumbs() { - if (!this.props.record) { - return; - } - - var breadcrumbs = [{ - text: _i18n2.default._t('CampaignAdmin.CAMPAIGN', 'Campaigns'), - href: this.props.sectionConfig.url - }]; - breadcrumbs.push({ - text: this.props.record.Name, - href: this.props.sectionConfig.url + '/set/' + this.props.campaignId + '/show' - }); - - this.props.breadcrumbsActions.setBreadcrumbs(breadcrumbs); - } - }, { - key: 'getSelectedItem', - value: function getSelectedItem() { - var itemId = this.props.campaign.changeSetItemId; - var items = this.getItems() || []; - var selected = null; - - if (itemId) { - selected = items.find(function (item) { - return itemId === item.ID; - }); - } - - if (!selected && items.length > 0) { - selected = items[0]; - } - - return selected; - } - }, { - key: 'render', - value: function render() { - var _this3 = this; - - var itemId = this.props.campaign.changeSetItemId; - - var itemLinks = null; - var selectedClass = !itemId ? 'campaign-admin__campaign--hide-preview' : ''; - var campaignId = this.props.campaignId; - var campaign = this.props.record; - var newItem = this.props.newItem; - - var itemGroups = this.groupItemsForSet(); - - var accordionBlocks = []; - - var selectedItem = this.getSelectedItem(); - var selectedItemsLinkedTo = selectedItem && selectedItem._links && selectedItem._links.references || []; - var selectedItemsLinkedFrom = selectedItem && selectedItem._links && selectedItem._links.referenced_by || []; - - Object.keys(itemGroups).forEach(function (className) { - var group = itemGroups[className]; - var groupCount = group.items.length; - - var listGroupItems = []; - var title = '\n ' + (groupCount === 0 ? '' : groupCount) + '\n ' + (groupCount === 1 ? group.singular : group.plural) + '\n '; - var groupid = 'Set_' + campaignId + '_Group_' + className; - - group.items.forEach(function (item) { - if (!itemId) { - itemId = item.ID; - } - var selected = itemId === item.ID; - - if (selected && item._links) { - itemLinks = item._links; - } - - var itemClassNames = []; - if (item.ChangeType === 'none' || campaign.State === 'published') { - itemClassNames.push('list-group-item--inactive'); - } - if (selected) { - itemClassNames.push('active'); - } - - var isLinked = !!selectedItemsLinkedTo.find(function (linkToObj) { - return linkToObj.ChangeSetItemID === parseInt(item.ID, 10); - }); - - isLinked = isLinked || selectedItemsLinkedFrom.find(function (linkFromObj) { - return linkFromObj.ChangeSetItemID === item.ID; - }); - - listGroupItems.push(_react2.default.createElement( - _ListGroupItem2.default, - { - key: item.ID, - className: itemClassNames.join(' '), - handleClick: _this3.handleItemSelected, - handleClickArg: item.ID - }, - _react2.default.createElement(_CampaignAdminItem2.default, { - item: item, - campaign: _this3.props.record, - selected: selected, - isLinked: isLinked - }) - )); - }); - - var wrapperClassnames = (0, _classnames2.default)('list-group-wrapper', { - 'list-group-wrapper--empty': listGroupItems.length === 0 - }); - - accordionBlocks.push(_react2.default.createElement( - 'div', - { className: wrapperClassnames }, - _react2.default.createElement( - _AccordionBlock2.default, - { key: groupid, groupid: groupid, title: title }, - listGroupItems.length > 0 ? listGroupItems : _react2.default.createElement( - 'p', - { className: 'list-group-item' }, - group.noItemText - ) - ) - )); - }); - - var newItemInfo = newItem ? _react2.default.createElement( - 'p', - { className: 'alert alert-success alert--no-border', role: 'alert' }, - 'Nice one! You have successfully created a campaign.' - ) : null; - - var body = _react2.default.createElement( - _Accordion2.default, - null, - accordionBlocks - ); - var bodyClass = ['panel', 'panel--padded', 'panel--scrollable', 'flexbox-area-grow']; - - return _react2.default.createElement( - 'div', - { className: 'fill-width campaign-admin__campaign ' + selectedClass }, - _react2.default.createElement( - 'div', - { className: 'fill-height campaign-admin__campaign-items', 'aria-expanded': 'true' }, - _react2.default.createElement( - _Toolbar2.default, - { showBackButton: true, handleBackButtonClick: this.props.handleBackButtonClick }, - _react2.default.createElement(_Breadcrumb2.default, { multiline: true }) - ), - newItemInfo, - _react2.default.createElement( - 'div', - { className: bodyClass.join(' ') }, - body - ), - _react2.default.createElement( - 'div', - { className: 'toolbar toolbar--south' }, - this.renderButtonToolbar() - ) - ), - this.renderPreview(itemLinks, itemId) - ); - } - }, { - key: 'renderPreview', - value: function renderPreview(itemLinks, itemId) { - var preview = null; - var previewClasses = (0, _classnames2.default)(['flexbox-area-grow', 'fill-height', 'preview', 'campaign-admin__campaign-preview', 'campaign-admin__campaign-preview--empty']); - - if (this.state.loading) { - preview = _react2.default.createElement( - 'div', - { className: previewClasses }, - _react2.default.createElement( - 'p', - null, - 'Loading...' - ) - ); - } else if (!this.getItems() || this.getItems().length === 0) { - preview = _react2.default.createElement( - 'div', - { className: previewClasses }, - _react2.default.createElement( - 'h2', - { className: 'campaign-admin__empty-heading' }, - 'Getting started' - ), - _react2.default.createElement( - 'p', - { className: 'campaign-admin__empty-info' }, - 'Select ', - _react2.default.createElement( - 'strong', - null, - 'Add to Campaign' - ), - ' from pages, files, and other content types' - ) - ); - } else { - preview = _react2.default.createElement(_Preview2.default, { itemLinks: itemLinks, itemId: itemId, onBack: this.handleCloseItem }); - } - - return preview; - } - }, { - key: 'handleItemSelected', - value: function handleItemSelected(event, itemId) { - this.props.campaignActions.selectChangeSetItem(itemId); - } - }, { - key: 'handleCloseItem', - value: function handleCloseItem() { - this.props.campaignActions.selectChangeSetItem(null); - } - }, { - key: 'renderButtonToolbar', - value: function renderButtonToolbar() { - var items = this.getItems(); - - var actionProps = {}; - - if (!items || items.length === 0) { - actionProps = Object.assign(actionProps, { - title: _i18n2.default._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), - buttonStyle: 'secondary-outline', - icon: 'rocket', - disabled: true - }); - } else if (this.props.record.State === 'open') { - actionProps = Object.assign(actionProps, { - title: _i18n2.default._t('CampaignAdmin.PUBLISHCAMPAIGN', 'Publish campaign'), - buttonStyle: 'primary', - loading: this.props.campaign.isPublishing, - handleClick: this.handlePublish, - icon: 'rocket' - }); - } else if (this.props.record.State === 'published') { - actionProps = Object.assign(actionProps, { - title: _i18n2.default._t('CampaignAdmin.REVERTCAMPAIGN', 'Revert'), - buttonStyle: 'secondary-outline', - icon: 'back-in-time', - disabled: true - }); - } - - return _react2.default.createElement( - 'div', - { className: 'btn-toolbar' }, - _react2.default.createElement(_FormAction2.default, actionProps) - ); - } - }, { - key: 'getItems', - value: function getItems() { - if (this.props.record && this.props.record._embedded) { - return this.props.record._embedded.items; - } - - return null; - } - }, { - key: 'groupItemsForSet', - value: function groupItemsForSet() { - var groups = this.getPlaceholderGroups(); - var items = this.getItems(); - if (!items) { - return groups; - } - - items.forEach(function (item) { - var classname = item.BaseClass; - - if (!groups[classname]) { - groups[classname] = { - singular: item.Singular, - plural: item.Plural, - items: [] - }; - } - - groups[classname].items.push(item); - }); - - return groups; - } - }, { - key: 'getPlaceholderGroups', - value: function getPlaceholderGroups() { - var groups = {}; - - if (this.props.record && this.props.record.placeholderGroups) { - this.props.record.placeholderGroups.forEach(function (group) { - groups[group.baseClass] = _extends({}, group); - groups[group.baseClass].items = [].concat(_toConsumableArray(group.items)); - }); - } - - return groups; - } - }, { - key: 'handlePublish', - value: function handlePublish(e) { - e.preventDefault(); - this.props.campaignActions.publishCampaign(this.props.publishApi, this.props.treeClass, this.props.campaignId); - } - }]); - - return CampaignAdminList; -}(_SilverStripeComponent2.default); - -CampaignAdminList.propTypes = { - campaign: _react2.default.PropTypes.shape({ - isPublishing: _react2.default.PropTypes.bool.isRequired, - changeSetItemId: _react2.default.PropTypes.number - }), - breadcrumbsActions: _react2.default.PropTypes.object.isRequired, - campaignActions: _react2.default.PropTypes.object.isRequired, - publishApi: _react2.default.PropTypes.func.isRequired, - record: _react2.default.PropTypes.object.isRequired, - recordActions: _react2.default.PropTypes.object.isRequired, - sectionConfig: _react2.default.PropTypes.object.isRequired, - handleBackButtonClick: _react2.default.PropTypes.func -}; - -function mapStateToProps(state, ownProps) { - var record = null; - var treeClass = ownProps.sectionConfig.treeClass; - if (state.records && state.records[treeClass] && ownProps.campaignId) { - record = state.records[treeClass][parseInt(ownProps.campaignId, 10)]; - } - return { - config: state.config, - record: record || {}, - campaign: state.campaign, - treeClass: treeClass, - newItem: state.campaign.newItem - }; -} - -function mapDispatchToProps(dispatch) { - return { - breadcrumbsActions: (0, _redux.bindActionCreators)(breadcrumbsActions, dispatch), - recordActions: (0, _redux.bindActionCreators)(recordActions, dispatch), - campaignActions: (0, _redux.bindActionCreators)(campaignActions, dispatch) - }; -} - -exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(CampaignAdminList); - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -var _deepFreezeStrict = __webpack_require__(22); - -var _deepFreezeStrict2 = _interopRequireDefault(_deepFreezeStrict); - -var _CampaignActionTypes = __webpack_require__(3); - -var _CampaignActionTypes2 = _interopRequireDefault(_CampaignActionTypes); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var initialState = (0, _deepFreezeStrict2.default)({ - campaignId: null, - changeSetItemId: null, - isPublishing: false, - view: null, - newItem: null -}); - -function reducer() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; - var action = arguments[1]; - - switch (action.type) { - - case _CampaignActionTypes2.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM: - return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { - changeSetItemId: action.payload.changeSetItemId - })); - - case _CampaignActionTypes2.default.SET_CAMPAIGN_ACTIVE_CHANGESET: - return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { - campaignId: action.payload.campaignId, - view: action.payload.view, - changeSetItemId: null - })); - - case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_REQUEST: - return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { - isPublishing: true - })); - - case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_SUCCESS: - case _CampaignActionTypes2.default.PUBLISH_CAMPAIGN_FAILURE: - return (0, _deepFreezeStrict2.default)(Object.assign({}, state, { - isPublishing: false - })); - - case _CampaignActionTypes2.default.SET_NEW_CAMPAIGN: - return (0, _deepFreezeStrict2.default)(_extends({}, state, { - newItem: action.payload.newItem - })); - - default: - return state; - - } -} - -exports.default = reducer; - -/***/ }), -/* 18 */ -/***/ (function(module, exports) { - -module.exports = Accordion; - -/***/ }), -/* 19 */ -/***/ (function(module, exports) { - -module.exports = AccordionBlock; - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - -module.exports = Backend; - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - -module.exports = Config; - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - -module.exports = DeepFreezeStrict; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = FormBuilderLoader; - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - -module.exports = Injector; - -/***/ }), -/* 25 */ -/***/ (function(module, exports) { - -module.exports = ListGroupItem; - -/***/ }), -/* 26 */ -/***/ (function(module, exports) { - -module.exports = Preview; - -/***/ }), -/* 27 */ -/***/ (function(module, exports) { - -module.exports = ReactBootstrap; - -/***/ }), -/* 28 */ -/***/ (function(module, exports) { - -module.exports = ReactRouteRegister; - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - -module.exports = RecordsActionTypes; - -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - -module.exports = RecordsActions; - -/***/ }), -/* 31 */ -/***/ (function(module, exports) { - -module.exports = ReduxForm; - -/***/ }), -/* 32 */ -/***/ (function(module, exports) { - -module.exports = classnames; - -/***/ }), -/* 33 */ -/***/ (function(module, exports) { - -module.exports = formatWrittenNumber; - -/***/ }), -/* 34 */ -/***/ (function(module, exports) { - -module.exports = getFormState; - -/***/ }) -/******/ ]); -//# sourceMappingURL=bundle.js.map \ No newline at end of file +!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN:"SET_NEW_CAMPAIGN"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewItem=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t Date: Wed, 2 Aug 2017 16:59:26 +1200 Subject: [PATCH 09/14] Add i18n for pristine/dirty titles --- lang/en.yml | 2 ++ src/CampaignAdmin.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lang/en.yml b/lang/en.yml index 4dba426d..fa4202af 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -19,5 +19,7 @@ en: MENUTITLE: Campaigns CREATE: Create SAVE: Save + SAVED: Saved + SAVECHANGES: Save changes SAVEDERROR: Error. SAVEDUP: Saved. diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index b960e6aa..d1a70d64 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -519,9 +519,9 @@ public function getCampaignEditForm($id) ->setIcon('save') ->setSchemaState([ 'data' => [ - 'pristineTitle' => 'Saved', + 'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'), 'pristineIcon' => 'tick', - 'dirtyTitle' => 'Save changes', + 'dirtyTitle' => _t(__CLASS__.'SAVECHANGES', 'Save changes'), 'dirtyIcon' => '', 'pristineClass' => 'btn-primary-outline', 'dirtyClass' => '', From 32edfa0d8d6518690c30465607208e1c73e10f83 Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Thu, 3 Aug 2017 12:31:43 +1200 Subject: [PATCH 10/14] Fix some of the feedback addressed --- client/dist/js/bundle.js | 2 +- .../CampaignAdmin/CampaignAdminList.js | 17 +-- client/src/state/campaign/CampaignActions.js | 2 +- package.json | 6 +- src/CampaignAdmin.php | 2 +- yarn.lock | 104 +++++++++--------- 6 files changed, 67 insertions(+), 66 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 04ef1500..746098cc 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN:"SET_NEW_CAMPAIGN"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewItem=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"setBreadcrumbs",value:function(){if(this.props.record){var e=[{text:V.default._t("CampaignAdmin.CAMPAIGN","Campaigns"),href:this.props.sectionConfig.url}];e.push({text:this.props.record.Name,href:this.props.sectionConfig.url+"/set/"+this.props.campaignId+"/show"}),this.props.breadcrumbsActions.setBreadcrumbs(e)}}},{key:"getSelectedItem",value:function(){var e=this.props.campaign.changeSetItemId,t=this.getItems()||[],n=null;return e&&(n=t.find(function(t){return e===t.ID})),!n&&t.length>0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;tsetIcon('save'), FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) ->setUseButtonTag(true) diff --git a/yarn.lock b/yarn.lock index 4773cfcb..ed264c7b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -298,19 +298,19 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.0.0, babel-core@^6.24.0, babel-core@^6.7.4: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" +babel-core@^6.0.0, babel-core@^6.24.0, babel-core@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.1.tgz#8c428564dce1e1f41fb337ec34f4c3b022b5ad83" dependencies: babel-code-frame "^6.22.0" - babel-generator "^6.24.0" - babel-helpers "^6.23.0" + babel-generator "^6.24.1" + babel-helpers "^6.24.1" babel-messages "^6.23.0" - babel-register "^6.24.0" + babel-register "^6.24.1" babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.1" - babel-types "^6.23.0" + babel-template "^6.24.1" + babel-traverse "^6.24.1" + babel-types "^6.24.1" babylon "^6.11.0" convert-source-map "^1.1.0" debug "^2.1.1" @@ -322,19 +322,19 @@ babel-core@^6.0.0, babel-core@^6.24.0, babel-core@^6.7.4: slash "^1.0.0" source-map "^0.5.0" -babel-core@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.1.tgz#8c428564dce1e1f41fb337ec34f4c3b022b5ad83" +babel-core@^6.7.4: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" dependencies: babel-code-frame "^6.22.0" - babel-generator "^6.24.1" - babel-helpers "^6.24.1" + babel-generator "^6.24.0" + babel-helpers "^6.23.0" babel-messages "^6.23.0" - babel-register "^6.24.1" + babel-register "^6.24.0" babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" + babel-template "^6.23.0" + babel-traverse "^6.23.1" + babel-types "^6.23.0" babylon "^6.11.0" convert-source-map "^1.1.0" debug "^2.1.1" @@ -346,26 +346,26 @@ babel-core@^6.24.1: slash "^1.0.0" source-map "^0.5.0" -babel-generator@^6.18.0, babel-generator@^6.24.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" +babel-generator@^6.18.0, babel-generator@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.1.tgz#e715f486c58ded25649d888944d52aa07c5d9497" dependencies: babel-messages "^6.23.0" babel-runtime "^6.22.0" - babel-types "^6.23.0" + babel-types "^6.24.1" detect-indent "^4.0.0" jsesc "^1.3.0" lodash "^4.2.0" source-map "^0.5.0" trim-right "^1.0.1" -babel-generator@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.1.tgz#e715f486c58ded25649d888944d52aa07c5d9497" +babel-generator@^6.24.0: + version "6.24.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" dependencies: babel-messages "^6.23.0" babel-runtime "^6.22.0" - babel-types "^6.24.1" + babel-types "^6.23.0" detect-indent "^4.0.0" jsesc "^1.3.0" lodash "^4.2.0" @@ -1112,66 +1112,66 @@ babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" +babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333" dependencies: babel-runtime "^6.22.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" + babel-traverse "^6.24.1" + babel-types "^6.24.1" babylon "^6.11.0" lodash "^4.2.0" -babel-template@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333" +babel-template@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" dependencies: babel-runtime "^6.22.0" - babel-traverse "^6.24.1" - babel-types "^6.24.1" + babel-traverse "^6.23.0" + babel-types "^6.23.0" babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: - version "6.23.1" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" +babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.24.1.tgz#ab36673fd356f9a0948659e7b338d5feadb31695" dependencies: babel-code-frame "^6.22.0" babel-messages "^6.23.0" babel-runtime "^6.22.0" - babel-types "^6.23.0" + babel-types "^6.24.1" babylon "^6.15.0" debug "^2.2.0" globals "^9.0.0" invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.24.1.tgz#ab36673fd356f9a0948659e7b338d5feadb31695" +babel-traverse@^6.23.1: + version "6.23.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: babel-code-frame "^6.22.0" babel-messages "^6.23.0" babel-runtime "^6.22.0" - babel-types "^6.24.1" + babel-types "^6.23.0" babylon "^6.15.0" debug "^2.2.0" globals "^9.0.0" invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" dependencies: babel-runtime "^6.22.0" esutils "^2.0.2" lodash "^4.2.0" to-fast-properties "^1.0.1" -babel-types@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" +babel-types@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: babel-runtime "^6.22.0" esutils "^2.0.2" @@ -3591,11 +3591,11 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.1.x, minimist@^1.1.1, minimist@^1.1.3: +minimist@1.1.x, minimist@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.1.3.tgz#3bedfd91a92d39016fcfaa1c681e8faa1a1efda8" -minimist@^1.2.0: +minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" From ccdda08e396d4be5316f03ff88571b8f53629f4a Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Thu, 3 Aug 2017 13:15:07 +1200 Subject: [PATCH 11/14] Fix move placeholders to config and added extension hook for placeholder groups --- client/dist/js/bundle.js | 2 +- .../CampaignAdmin/CampaignAdminList.js | 2 +- lang/en.yml | 1 + src/CampaignAdmin.php | 55 ++++++++++--------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 746098cc..38ca0806 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN:"SET_NEW_CAMPAIGN"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewItem=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"setBreadcrumbs",value:function(){if(this.props.record){var e=[{text:V.default._t("CampaignAdmin.CAMPAIGN","Campaigns"),href:this.props.sectionConfig.url}];e.push({text:this.props.record.Name,href:this.props.sectionConfig.url+"/set/"+this.props.campaignId+"/show"}),this.props.breadcrumbsActions.setBreadcrumbs(e)}}},{key:"getSelectedItem",value:function(){var e=this.props.campaign.changeSetItemId,t=this.getItems()||[],n=null;return e&&(n=t.find(function(t){return e===t.ID})),!n&&t.length>0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"setBreadcrumbs",value:function(){if(this.props.record){var e=[{text:V.default._t("CampaignAdmin.CAMPAIGN","Campaigns"),href:this.props.sectionConfig.url}];e.push({text:this.props.record.Name,href:this.props.sectionConfig.url+"/set/"+this.props.campaignId+"/show"}),this.props.breadcrumbsActions.setBreadcrumbs(e)}}},{key:"getSelectedItem",value:function(){var e=this.props.campaign.changeSetItemId,t=this.getItems()||[],n=null;return e&&(n=t.find(function(t){return e===t.ID})),!n&&t.length>0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemsText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t 0 ? listGroupItems : -

{group.noItemText}

+

{group.noItemsText}

}
diff --git a/lang/en.yml b/lang/en.yml index fa4202af..306751fd 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -17,6 +17,7 @@ en: CANCEL: Cancel ERROR_DUPLICATE_NAME: 'Name "{Name}" already exists' MENUTITLE: Campaigns + NOITEMSTEXT: Add items from the {section} section CREATE: Create SAVE: Save SAVED: Saved diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 31b3822a..52a52508 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -2,28 +2,30 @@ namespace SilverStripe\CampaignAdmin; +use LogicException; use SilverStripe\Admin\LeftAndMain; use SilverStripe\Admin\LeftAndMainFormRequestHandler; use SilverStripe\Control\Controller; -use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPRequest; +use SilverStripe\Control\HTTPResponse; +use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; +use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Manifest\ModuleLoader; -use SilverStripe\Forms\HiddenField; -use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; +use SilverStripe\Forms\FormAction; +use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\RequiredFields; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\SS_List; +use SilverStripe\ORM\UnexpectedDataException; use SilverStripe\ORM\ValidationResult; +use SilverStripe\Security\PermissionProvider; use SilverStripe\Security\Security; +use SilverStripe\Security\SecurityToken; use SilverStripe\Versioned\ChangeSet; use SilverStripe\Versioned\ChangeSetItem; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\UnexpectedDataException; -use SilverStripe\Security\SecurityToken; -use SilverStripe\Security\PermissionProvider; -use LogicException; use SilverStripe\View\Requirements; /** @@ -81,6 +83,8 @@ class CampaignAdmin extends LeftAndMain implements PermissionProvider private static $required_permission_codes = 'CMS_ACCESS_CampaignAdmin'; + private static $placeholder_group_classes = []; + public function getClientConfig() { return array_merge(parent::getClientConfig(), [ @@ -159,28 +163,27 @@ protected function getPlaceholderGroups() { $groups = []; - if (class_exists('SilverStripe\CMS\Model\SiteTree')) { - $class = singleton('SilverStripe\CMS\Model\SiteTree'); - $groups[] = [ - 'baseClass' => DataObject::getSchema()->baseDataClass('SilverStripe\CMS\Model\SiteTree'), - 'singular' => $class->i18n_singular_name(), - 'plural' => $class->i18n_plural_name(), - 'noItemText' => 'Add from ' . $class->i18n_plural_name() . ' area', - 'items' => [] - ]; - } - - if (class_exists('SilverStripe\AssetAdmin\Controller\AssetAdmin')) { - $class = singleton('SilverStripe\Assets\File'); + $classes = Config::inst()->get(self::class, 'placeholder_group_classes'); + + foreach ($classes as $class) { + /** @var DataObject $item */ + $item = Injector::inst()->get($class); + if (!$item) { + continue; + } $groups[] = [ - 'baseClass' => DataObject::getSchema()->baseDataClass('SilverStripe\Assets\File'), - 'singular' => $class->i18n_singular_name(), - 'plural' => $class->i18n_plural_name(), - 'noItemText' => 'Add from ' . $class->i18n_plural_name() . ' area', + 'baseClass' => DataObject::getSchema()->baseDataClass($class), + 'singular' => $item->i18n_singular_name(), + 'plural' => $item->i18n_plural_name(), + 'noItemsText' => _t(__CLASS__.'.NOITEMSTEXT', 'Add items from the {section} section', [ + 'section' => $item->i18n_plural_name(), + ]), 'items' => [] ]; } - + + $this->extend('updatePlaceholderGroups', $groups); + return $groups; } From 1d4e5244256ed8b7d14005a9877e60417a7ac84d Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Thu, 3 Aug 2017 13:24:03 +1200 Subject: [PATCH 12/14] Fix translations in list --- client/dist/js/bundle.js | 2 +- client/lang/en.js | 5 ++- client/lang/src/en.json | 5 ++- .../CampaignAdmin/CampaignAdminList.js | 44 ++++++++----------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 38ca0806..8ebeba7f 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t){e.exports=React},function(e,t){e.exports=SilverStripeComponent},function(e,t){e.exports=i18n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",SET_CAMPAIGN_SELECTED_CHANGESETITEM:"SET_CAMPAIGN_SELECTED_CHANGESETITEM",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE",SET_NEW_CAMPAIGN:"SET_NEW_CAMPAIGN"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e){return{type:u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM,payload:{changeSetItemId:e}}}function i(e,t){return function(n){n({type:u.default.SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}})}}function o(e,t,n){return function(a){a({type:u.default.PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:n}}),e({id:n}).then(function(e){a({type:u.default.PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:n}}),a({type:p.default.FETCH_RECORD_SUCCESS,payload:{recordType:t,data:e}})}).catch(function(e){a({type:u.default.PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}function s(e){return{type:u.default.SET_NEW_CAMPAIGN,payload:{newItem:e}}}Object.defineProperty(t,"__esModule",{value:!0}),t.selectChangeSetItem=r,t.showCampaignView=i,t.publishCampaign=o,t.setNewItem=s;var l=n(3),u=a(l),c=n(29),p=a(c)},function(e,t){e.exports=Breadcrumb},function(e,t){e.exports=BreadcrumbsActions},function(e,t){e.exports=FormAction},function(e,t){e.exports=ReactRedux},function(e,t){e.exports=ReactRouter},function(e,t){e.exports=Redux},function(e,t){e.exports=Toolbar},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=n(9),i=n(21),o=a(i),s=n(24),l=a(s),u=n(28),c=a(u),p=n(14),d=a(p),f=n(17),m=a(f);document.addEventListener("DOMContentLoaded",function(){var e=o.default.getSection("SilverStripe\\CampaignAdmin\\CampaignAdmin");c.default.add({path:e.url,component:(0,r.withRouter)(d.default),childRoutes:[{path:":type/:id/:view",component:d.default},{path:"set/:id/:view",component:d.default}]}),l.default.reducer.register("campaign",m.default)})},function(e,t,n){"use strict";n(12)},function(e,t,n){"use strict";function a(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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n=null,a=e.config.sections.find(function(e){return e.name===U});return t.params.id>0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(I,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(T.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"setBreadcrumbs",value:function(){if(this.props.record){var e=[{text:V.default._t("CampaignAdmin.CAMPAIGN","Campaigns"),href:this.props.sectionConfig.url}];e.push({text:this.props.record.Name,href:this.props.sectionConfig.url+"/set/"+this.props.campaignId+"/show"}),this.props.breadcrumbsActions.setBreadcrumbs(e)}}},{key:"getSelectedItem",value:function(){var e=this.props.campaign.changeSetItemId,t=this.getItems()||[],n=null;return e&&(n=t.find(function(t){return e===t.ID})),!n&&t.length>0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemsText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},"Nice one! You have successfully created a campaign."):null,f=h.default.createElement(T.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);return this.state.loading?h.default.createElement("div",{className:n},h.default.createElement("p",null,"Loading...")):this.getItems()&&0!==this.getItems().length?h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem}):h.default.createElement("div",{className:n},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},"Select ",h.default.createElement("strong",null,"Add to Campaign")," from pages, files, and other content types"))}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&(n=(0,h.formValueSelector)("Campaign.EditView",_.default)(e,"Name")),{config:e.config,campaignId:e.campaign.campaignId,view:e.campaign.view,breadcrumbs:e.breadcrumbs,sectionConfig:a,securityId:e.config.SecurityID,title:n}}function u(e){return{breadcrumbsActions:(0,g.bindActionCreators)(k,e),campaignActions:(0,g.bindActionCreators)(A,e)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t1){var t=this.props.breadcrumbs[this.props.breadcrumbs.length-2];t&&t.href&&(e.preventDefault(),this.props.router.push(t.href))}}},{key:"handleCreateCampaignSubmit",value:function(e,t,n){var a=this,r=n();if(!r)throw new Error("Promise was not returned for submitting");return r.then(function(e){var n=e.errors&&e.errors.length>0;if("action_save"===t&&!n){var r=a.props.sectionConfig.url,i=e.record.id;a.props.campaignActions.setNewItem(i),a.props.router.push(r+"/set/"+i+"/show")}return e})}},{key:"handleFormAction",value:function(e){if("action_cancel"===e.currentTarget.name){var t=this.props.sectionConfig.url;this.props.router.push(t),e.preventDefault()}}},{key:"render",value:function(){var e=null;switch(this.props.params.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;case"create":e=this.renderCreateView();break;default:e=this.renderIndexView()}return e}},{key:"renderIndexView",value:function(){var e=this.props.sectionConfig.form.EditForm.schemaUrl,t={title:B.default._t("CampaignAdmin.ADDCAMPAIGN"),icon:"plus",extraClass:"btn-primary",handleClick:this.addCampaign.bind(this)},n={createFn:this.campaignListCreateFn.bind(this),schemaUrl:e,identifier:"Campaign.IndexView"};return f.default.createElement("div",{className:"fill-height","aria-expanded":"true"},f.default.createElement(j.default,null,f.default.createElement(S.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow"},f.default.createElement("div",{className:"toolbar toolbar--content"},f.default.createElement("div",{className:"btn-toolbar"},f.default.createElement(O.default,t))),f.default.createElement(G.default,n)))}},{key:"renderItemListView",value:function(){var e={sectionConfig:this.props.sectionConfig,campaignId:this.props.params.id,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi,handleBackButtonClick:this.handleBackButtonClick.bind(this)};return f.default.createElement(D.default,e)}},{key:"renderDetailEditView",value:function(){if(this.props.params.id<=0)return this.renderCreateView();var e=this.props.sectionConfig.form.campaignEditForm.schemaUrl,t=e+"/"+this.props.params.id;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(S.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleAction:this.handleFormAction,schemaUrl:t,identifier:"Campaign.EditView"})))}},{key:"renderCreateView",value:function(){var e=this.props.sectionConfig.form.campaignCreateForm.schemaUrl;return f.default.createElement("div",{className:"fill-height"},f.default.createElement(j.default,{showBackButton:!0,handleBackButtonClick:this.handleBackButtonClick},f.default.createElement(S.default,{multiline:!0})),f.default.createElement("div",{className:"panel panel--padded panel--scrollable flexbox-area-grow form--inline"},f.default.createElement(G.default,{handleSubmit:this.handleCreateCampaignSubmit,handleAction:this.handleFormAction,schemaUrl:e,identifier:"Campaign.CreateView"})))}},{key:"campaignEditCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.id},r))}return f.default.createElement(e,c({key:t.id},t))}},{key:"campaignAddCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("action_cancel"===t.name){var r=Object.assign({},t,{handleClick:function(e){e.preventDefault(),n.props.router.push(a)}});return f.default.createElement(e,c({key:t.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"campaignListCreateFn",value:function(e,t){var n=this,a=this.props.sectionConfig.url;if("GridField"===t.schemaComponent){var r=Object.assign({},t,{data:Object.assign({},t.data,{handleDrillDown:function(e,t){n.props.router.push(a+"/set/"+t.ID+"/show")},handleEditRecord:function(e,t){n.props.router.push(a+"/set/"+t+"/edit")}})});return f.default.createElement(e,c({key:r.name},r))}return f.default.createElement(e,c({key:t.name},t))}},{key:"addCampaign",value:function(){var e=this.getActionRoute(0,"create");this.props.router.push(e)}},{key:"getActionRoute",value:function(e,t){return this.props.sectionConfig.url+"/set/"+e+"/"+t}}]),t}(w.default);F.propTypes={breadcrumbsActions:f.default.PropTypes.object.isRequired,campaignId:f.default.PropTypes.string,sectionConfig:f.default.PropTypes.shape({publishEndpoint:f.default.PropTypes.shape({url:f.default.PropTypes.string,method:f.default.PropTypes.string}),form:f.default.PropTypes.shape({EditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignEditForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string}),campaignCreateForm:f.default.PropTypes.shape({schemaUrl:f.default.PropTypes.string})})}),securityId:f.default.PropTypes.string.isRequired,view:f.default.PropTypes.string},t.default=(0,b.withRouter)((0,m.connect)(l,u)(F))},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&n.push(this.getReferToTooltipText()),t>0&&n.push(f.default.sprintf(0===n.length?this.getReferredByTooltipText():this.getReferredByTooltipText().toLocaleLowerCase(),(0,g.default)(t)));var a=u.default.createElement(m.Tooltip,{id:"campaign-tooltip-"+this.props.item.ID},n.join(", ")),r=null;if(this.props.selected&&e+t>0||this.props.isLinked){var i=["list-group-item__info","campaign-admin__item-links",this.props.isLinked?"campaign-admin__item-links--is-linked":"campaign-admin__item-links--has-links"];r=u.default.createElement("div",{className:i.join(" ")},u.default.createElement(m.OverlayTrigger,{placement:"left",overlay:a},u.default.createElement("span",null,u.default.createElement("span",{className:"campaign-admin__item-links__number"},e+t),u.default.createElement("span",{className:"font-icon-link"}))))}return r}}]),t}(p.default);b.propTypes={campaign:u.default.PropTypes.object.isRequired,item:u.default.PropTypes.object.isRequired,isLinked:u.default.PropTypes.bool},t.default=b},function(e,t,n){"use strict";function a(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 i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:this.props;return 0!==Object.keys(e.record).length}},{key:"setBreadcrumbs",value:function(){if(this.props.record){var e=[{text:V.default._t("CampaignAdmin.CAMPAIGN","Campaigns"),href:this.props.sectionConfig.url}];e.push({text:this.props.record.Name,href:this.props.sectionConfig.url+"/set/"+this.props.campaignId+"/show"}),this.props.breadcrumbsActions.setBreadcrumbs(e)}}},{key:"getSelectedItem",value:function(){var e=this.props.campaign.changeSetItemId,t=this.getItems()||[],n=null;return e&&(n=t.find(function(t){return e===t.ID})),!n&&t.length>0&&(n=t[0]),n}},{key:"render",value:function(){var e=this,t=this.props.campaign.changeSetItemId,n=null,a=t?"":"campaign-admin__campaign--hide-preview",r=this.props.campaignId,i=this.props.record,o=this.props.newItem,s=this.groupItemsForSet(),l=[],u=this.getSelectedItem(),c=u&&u._links&&u._links.references||[],p=u&&u._links&&u._links.referenced_by||[];Object.keys(s).forEach(function(a){var o=s[a],u=o.items.length,d=[],f="\n "+(0===u?"":u)+"\n "+(1===u?o.singular:o.plural)+"\n ",m="Set_"+r+"_Group_"+a;o.items.forEach(function(a){t||(t=a.ID);var r=t===a.ID;r&&a._links&&(n=a._links);var o=[];"none"!==a.ChangeType&&"published"!==i.State||o.push("list-group-item--inactive"),r&&o.push("active");var s=!!c.find(function(e){return e.ChangeSetItemID===parseInt(a.ID,10)});s=s||p.find(function(e){return e.ChangeSetItemID===a.ID}),d.push(h.default.createElement(O.default,{key:a.ID,className:o.join(" "),handleClick:e.handleItemSelected,handleClickArg:a.ID},h.default.createElement(G.default,{item:a,campaign:e.props.record,selected:r,isLinked:s})))});var g=(0,W.default)("list-group-wrapper",{"list-group-wrapper--empty":0===d.length});l.push(h.default.createElement("div",{className:g},h.default.createElement(w.default,{key:m,groupid:m,title:f},d.length>0?d:h.default.createElement("p",{className:"list-group-item"},o.noItemsText))))});var d=o?h.default.createElement("p",{className:"alert alert-success alert--no-border",role:"alert"},V.default._t("CampaignAdmin.NEWCAMPAIGNSUCCESS","Nice one! You have successfully created a campaign.")):null,f=h.default.createElement(S.default,null,l),m=["panel","panel--padded","panel--scrollable","flexbox-area-grow"];return h.default.createElement("div",{className:"fill-width campaign-admin__campaign "+a},h.default.createElement("div",{className:"fill-height campaign-admin__campaign-items","aria-expanded":"true"},h.default.createElement(B.default,{showBackButton:!0,handleBackButtonClick:this.props.handleBackButtonClick},h.default.createElement(D.default,{multiline:!0})),d,h.default.createElement("div",{className:m.join(" ")},f),h.default.createElement("div",{className:"toolbar toolbar--south"},this.renderButtonToolbar())),this.renderPreview(n,t))}},{key:"renderPreview",value:function(e,t){var n=null,a=(0,W.default)(["flexbox-area-grow","fill-height","preview","campaign-admin__campaign-preview","campaign-admin__campaign-preview--empty"]);if(this.state.loading)n=h.default.createElement("div",{className:a},h.default.createElement("p",null,V.default._t("CampaignAdmin.LOADING","Loading...")));else if(this.getItems()&&0!==this.getItems().length)n=h.default.createElement(F.default,{itemLinks:e,itemId:t,onBack:this.handleCloseItem});else{var r=V.default._t("CampaignAdmin.SELECTFROMSECTIONS",'Select "Add to Campaign" from pages, files, and other admin sections with content types');n=h.default.createElement("div",{className:a},h.default.createElement("h2",{className:"campaign-admin__empty-heading"},"Getting started"),h.default.createElement("p",{className:"campaign-admin__empty-info"},r))}return n}},{key:"handleItemSelected",value:function(e,t){this.props.campaignActions.selectChangeSetItem(t)}},{key:"handleCloseItem",value:function(){this.props.campaignActions.selectChangeSetItem(null)}},{key:"renderButtonToolbar",value:function(){var e=this.getItems(),t={};return e&&0!==e.length?"open"===this.props.record.State?t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"primary",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=Object.assign(t,{title:V.default._t("CampaignAdmin.REVERTCAMPAIGN","Revert"),buttonStyle:"secondary-outline",icon:"back-in-time",disabled:!0})):t=Object.assign(t,{title:V.default._t("CampaignAdmin.PUBLISHCAMPAIGN","Publish campaign"),buttonStyle:"secondary-outline",icon:"rocket",disabled:!0}),h.default.createElement("div",{className:"btn-toolbar"},h.default.createElement(j.default,t))}},{key:"getItems",value:function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.items:null}},{key:"groupItemsForSet",value:function(){var e=this.getPlaceholderGroups(),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:"getPlaceholderGroups",value:function(){var e={};return this.props.record&&this.props.record.placeholderGroups&&this.props.record.placeholderGroups.forEach(function(t){e[t.baseClass]=p({},t),e[t.baseClass].items=[].concat(i(t.items))}),e}},{key:"handlePublish",value:function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.treeClass,this.props.campaignId)}}]),t}(k.default);Q.propTypes={campaign:h.default.PropTypes.shape({isPublishing:h.default.PropTypes.bool.isRequired,changeSetItemId:h.default.PropTypes.number}),breadcrumbsActions:h.default.PropTypes.object.isRequired,campaignActions:h.default.PropTypes.object.isRequired,publishApi:h.default.PropTypes.func.isRequired,record:h.default.PropTypes.object.isRequired,recordActions:h.default.PropTypes.object.isRequired,sectionConfig:h.default.PropTypes.object.isRequired,handleBackButtonClick:h.default.PropTypes.func},t.default=(0,b.connect)(u,c)(Q)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=arguments[1];switch(t.type){case u.default.SET_CAMPAIGN_SELECTED_CHANGESETITEM:return(0,s.default)(Object.assign({},e,{changeSetItemId:t.payload.changeSetItemId}));case u.default.SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s.default)(Object.assign({},e,{campaignId:t.payload.campaignId,view:t.payload.view,changeSetItemId:null}));case u.default.PUBLISH_CAMPAIGN_REQUEST:return(0,s.default)(Object.assign({},e,{isPublishing:!0}));case u.default.PUBLISH_CAMPAIGN_SUCCESS:case u.default.PUBLISH_CAMPAIGN_FAILURE:return(0,s.default)(Object.assign({},e,{isPublishing:!1}));case u.default.SET_NEW_CAMPAIGN:return(0,s.default)(i({},e,{newItem:t.payload.newItem}));default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t { - listGroupItems.length > 0 ? - listGroupItems : -

{group.noItemsText}

+ listGroupItems.length > 0 + ? listGroupItems + :

{group.noItemsText}

}
); }); - const newItemInfo = newItem ? - (

- Nice one! You have successfully created a campaign. -

) : - null; + const newItemInfo = newItem + ? ( +

+ {i18n._t( + 'CampaignAdmin.NEWCAMPAIGNSUCCESS', + 'Nice one! You have successfully created a campaign.' + )} +

+ ) + : null; const body = {accordionBlocks}; const bodyClass = [ @@ -252,15 +257,19 @@ class CampaignAdminList extends SilverStripeComponent { if (this.state.loading) { preview = (
-

Loading...

+

{i18n._t('CampaignAdmin.LOADING', 'Loading...')}

); } else if (!this.getItems() || this.getItems().length === 0) { + const message = i18n._t( + 'CampaignAdmin.SELECTFROMSECTIONS', + 'Select "Add to Campaign" from pages, files, and other admin sections with content types' + ); preview = (

Getting started

- Select Add to Campaign from pages, files, and other content types + {message}

); @@ -288,13 +297,6 @@ class CampaignAdminList extends SilverStripeComponent { renderButtonToolbar() { const items = this.getItems(); - // let itemSummaryLabel = i18n.sprintf( - // items.length === 1 - // ? i18n._t('CampaignAdmin.ITEM_SUMMARY_SINGULAR') - // : i18n._t('CampaignAdmin.ITEM_SUMMARY_PLURAL'), - // items.length - // ); - let actionProps = {}; if (!items || items.length === 0) { @@ -322,14 +324,6 @@ class CampaignAdminList extends SilverStripeComponent { }); } - // TODO Fix indicator positioning - // const itemCountIndicator = ( - // - //   - //  {itemSummaryLabel} - // - // ); - return (
From e223da70f337f395e29714c2ae1a8eab9eaa13e2 Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Thu, 3 Aug 2017 16:46:29 +1200 Subject: [PATCH 13/14] Minor fixes per Chris/Damian feedback --- lang/en.yml | 1 - src/CampaignAdmin.php | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lang/en.yml b/lang/en.yml index 306751fd..9f4b6978 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -21,6 +21,5 @@ en: CREATE: Create SAVE: Save SAVED: Saved - SAVECHANGES: Save changes SAVEDERROR: Error. SAVEDUP: Saved. diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 52a52508..bcf3f65a 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -82,8 +82,6 @@ class CampaignAdmin extends LeftAndMain implements PermissionProvider private static $thumbnail_height = 64; private static $required_permission_codes = 'CMS_ACCESS_CampaignAdmin'; - - private static $placeholder_group_classes = []; public function getClientConfig() { @@ -159,11 +157,14 @@ public function readCampaigns() return $response; } + /** + * @return array + */ protected function getPlaceholderGroups() { $groups = []; - $classes = Config::inst()->get(self::class, 'placeholder_group_classes'); + $classes = Config::inst()->get(ChangeSet::class, 'important_classes'); foreach ($classes as $class) { /** @var DataObject $item */ @@ -518,14 +519,14 @@ public function getCampaignEditForm($id) 'campaignEditForm', $fields, FieldList::create( - FormAction::create('save', _t(__CLASS__.'.SAVE', 'Save')) + FormAction::create('save', _t(__CLASS__.'SAVE', 'Save')) ->setIcon('save') ->setSchemaState([ 'data' => [ 'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'), 'pristineIcon' => 'tick', - 'dirtyTitle' => _t(__CLASS__.'SAVECHANGES', 'Save changes'), - 'dirtyIcon' => '', + 'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'), + 'dirtyIcon' => 'save', 'pristineClass' => 'btn-primary-outline', 'dirtyClass' => '', ], From 28282169b3a9a04a47d5dd7c8e3495a84c4a895a Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Thu, 3 Aug 2017 16:57:54 +1200 Subject: [PATCH 14/14] Fix class check --- src/CampaignAdmin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index bcf3f65a..6f6f6b1f 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -167,11 +167,11 @@ protected function getPlaceholderGroups() $classes = Config::inst()->get(ChangeSet::class, 'important_classes'); foreach ($classes as $class) { - /** @var DataObject $item */ - $item = Injector::inst()->get($class); - if (!$item) { + if (!class_exists($class)) { continue; } + /** @var DataObject $item */ + $item = Injector::inst()->get($class); $groups[] = [ 'baseClass' => DataObject::getSchema()->baseDataClass($class), 'singular' => $item->i18n_singular_name(),