From 178bd480eb141f6dc0eb8d07097d85d0e80a8e07 Mon Sep 17 00:00:00 2001 From: Paul Clarke Date: Mon, 12 Dec 2016 15:25:18 +1300 Subject: [PATCH] API Changes required for asset search behaviour --- admin/client/dist/js/bundle.js | 350 +++++++++--------- admin/client/dist/styles/bundle.css | 28 +- admin/client/lang/en.js | 11 + admin/client/lang/src/en.js | 11 + admin/client/src/boot/BootInjector.js | 2 + admin/client/src/bundles/bundle.js | 1 + .../src/components/Breadcrumb/Breadcrumb.js | 7 +- .../src/components/Breadcrumb/Breadcrumb.scss | 5 +- .../CompositeField/CompositeField.js | 6 +- .../src/components/FieldGroup/FieldGroup.js | 13 + .../src/components/FieldGroup/FieldGroup.scss | 15 + .../src/components/FieldGroup/README.md | 5 + admin/client/src/components/Form/Form.scss | 14 + .../SingleSelectField/SingleSelectField.js | 3 +- .../src/components/TextField/TextField.js | 2 +- admin/client/src/lib/DataFormat.js | 42 ++- admin/client/src/lib/Injector.js | 1 + admin/client/src/styles/_variables.scss | 12 + admin/client/src/styles/bundle.scss | 1 + admin/code/LeftAndMain.php | 13 +- .../Admin/Includes/BackLink_Button.ss | 2 +- .../Admin/Includes/LeftAndMain_MenuToggle.ss | 4 +- .../SilverStripe/Admin/LeftAndMain.ss | 1 + package.json | 1 - src/Forms/CompositeField.php | 9 + src/Forms/FieldGroup.php | 2 + src/Forms/FormFactory.php | 2 +- tests/php/Forms/FormSchemaTest.php | 5 + 28 files changed, 376 insertions(+), 192 deletions(-) create mode 100644 admin/client/src/components/FieldGroup/FieldGroup.js create mode 100644 admin/client/src/components/FieldGroup/FieldGroup.scss create mode 100644 admin/client/src/components/FieldGroup/README.md diff --git a/admin/client/dist/js/bundle.js b/admin/client/dist/js/bundle.js index e02a984f4..37aa5792c 100644 --- a/admin/client/dist/js/bundle.js +++ b/admin/client/dist/js/bundle.js @@ -1,7 +1,7 @@ webpackJsonp([5],[function(e,t,n){"use strict" -n(2),n(3),n(6),n(19),n(21),n(27),n(29),n(31),n(33),n(36),n(106),n(114),n(118),n(128),n(129),n(130),n(131),n(132),n(133),n(135),n(138),n(140),n(142),n(145),n(148),n(150),n(154),n(156),n(158),n(159),n(168), -n(169),n(171),n(172),n(173),n(174),n(175),n(176),n(177),n(178),n(179),n(180),n(181),n(182),n(183),n(186),n(188),n(189),n(190),n(191),n(195),n(196),n(197),n(198),n(199),n(196),n(191),n(202),n(204),n(206), -n(207)},,function(e,t){"use strict" +n(2),n(3),n(6),n(19),n(21),n(27),n(29),n(31),n(32),n(34),n(37),n(107),n(115),n(119),n(129),n(130),n(131),n(132),n(133),n(134),n(136),n(139),n(141),n(143),n(146),n(149),n(151),n(153),n(155),n(157),n(158), +n(167),n(168),n(170),n(171),n(172),n(173),n(174),n(175),n(176),n(177),n(178),n(179),n(180),n(181),n(182),n(185),n(187),n(188),n(189),n(190),n(194),n(195),n(196),n(197),n(198),n(195),n(190),n(201),n(203), +n(205),n(206)},,function(e,t){"use strict" function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}) var i=function(){function e(e,t){for(var n=0;n1}},{key:"handleChange",value:function d(e){"function"==typeof this.props.onChange&&this.props.onChange(e,{ +}):s(e,{componentClass:"input",type:this.props.type.toLowerCase()})),e}},{key:"isMultiline",value:function u(){return this.props.data&&this.props.data.rows>1}},{key:"handleChange",value:function d(e){"function"==typeof this.props.onChange&&this.props.onChange(e,{ id:this.props.id,value:e.target.value})}}]),t}(f["default"]) g.propTypes={extraClass:c["default"].PropTypes.string,id:c["default"].PropTypes.string,name:c["default"].PropTypes.string.isRequired,onChange:c["default"].PropTypes.func,value:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.number]), readOnly:c["default"].PropTypes.bool,disabled:c["default"].PropTypes.bool,placeholder:c["default"].PropTypes.string,type:c["default"].PropTypes.string},g.defaultProps={value:"",extraClass:"",className:"", -type:"text"},t.TextField=g,t["default"]=(0,h["default"])(g)},function(e,t){e.exports=FieldHolder},function(e,t,n){(function(t){e.exports=t.LiteralField=n(139)}).call(t,function(){return this}())},function(e,t,n){ +type:"text"},t.TextField=g,t["default"]=(0,h["default"])(g)},function(e,t){e.exports=FieldHolder},function(e,t,n){(function(t){e.exports=t.LiteralField=n(140)}).call(t,function(){return this}())},function(e,t,n){ "use strict" function i(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 o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called") @@ -810,7 +810,7 @@ function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).app value:function i(){return{className:this.props.className+" "+this.props.extraClass,id:this.props.id,name:this.props.name}}},{key:"render",value:function u(){return c["default"].createElement("div",s({},this.getInputProps(),{ dangerouslySetInnerHTML:this.getContent()}))}}]),t}(f["default"]) p.propTypes={id:c["default"].PropTypes.string,name:c["default"].PropTypes.string.isRequired,extraClass:c["default"].PropTypes.string,value:c["default"].PropTypes.string},p.defaultProps={extraClass:"",className:"" -},t["default"]=p},function(e,t,n){(function(t){e.exports=t.Toolbar=n(141)}).call(t,function(){return this}())},function(e,t,n){"use strict" +},t["default"]=p},function(e,t,n){(function(t){e.exports=t.Toolbar=n(142)}).call(t,function(){return this}())},function(e,t,n){"use strict" function i(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 o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called") @@ -827,7 +827,7 @@ return u["default"].createElement("div",{className:"toolbar toolbar--north"},u[" }},{key:"handleBackButtonClick",value:function i(e){return"undefined"!=typeof this.props.handleBackButtonClick?void this.props.handleBackButtonClick(e):void e.preventDefault()}}]),t}(d["default"]) f.propTypes={handleBackButtonClick:u["default"].PropTypes.func,showBackButton:u["default"].PropTypes.bool,breadcrumbs:u["default"].PropTypes.array},f.defaultProps={showBackButton:!1},t["default"]=f},function(e,t,n){ -(function(t){e.exports=t.Breadcrumb=n(143)}).call(t,function(){return this}())},function(e,t,n){"use strict" +(function(t){e.exports=t.Breadcrumb=n(144)}).call(t,function(){return this}())},function(e,t,n){"use strict" function i(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 o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called") @@ -835,20 +835,20 @@ return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("funct 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){return{crumbs:e.breadcrumbs }}Object.defineProperty(t,"__esModule",{value:!0}),t.Breadcrumb=void 0 var l=function(){function e(e,t){for(var n=0;n",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(h),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,w=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={ -javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},T={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},E=n(165) +var c=/^([a-z0-9.+-]+:)/i,d=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=["<",">",'"',"`"," ","\r","\n","\t"],h=["{","}","|","\\","^","`"].concat(p),m=["'"].concat(h),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={ +javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},T={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},E=n(164) i.prototype.parse=function(e,t,n){if(!u.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e) var i=e.indexOf("?"),r=i!==-1&&i127?"x":F[M] -if(!D.match(b)){var U=I.slice(0,S),L=I.slice(S+1),B=F.match(w) +if(!D.match(b)){var U=I.slice(0,S),L=I.slice(S+1),B=F.match(_) B&&(U.push(B[1]),L.unshift(B[2])),L.length&&(s="/"+L.join(".")+s),this.hostname=U.join(".") break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=l.toASCII(this.hostname)) var H=this.port?":"+this.port:"",$=this.hostname||"" -this.host=$+H,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[h])for(var S=0,A=m.length;S0)&&n.host.split("@") P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return n.search=e.search,n.query=e.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(), -n}if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n -for(var O=_.slice(-1)[0],S=(n.host||e.host||_.length>1)&&("."===O||".."===O)||""===O,k=0,j=_.length;j>=0;j--)O=_[j],"."===O?_.splice(j,1):".."===O?(_.splice(j,1),k++):k&&(_.splice(j,1),k--) -if(!b&&!w)for(;k--;k)_.unshift("..") -!b||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),S&&"/"!==_.join("/").substr(-1)&&_.push("") -var x=""===_[0]||_[0]&&"/"===_[0].charAt(0) -if(E){n.hostname=n.host=x?"":_.length?_.shift():"" +n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n +for(var O=w.slice(-1)[0],S=(n.host||e.host||w.length>1)&&("."===O||".."===O)||""===O,k=0,j=w.length;j>=0;j--)O=w[j],"."===O?w.splice(j,1):".."===O?(w.splice(j,1),k++):k&&(w.splice(j,1),k--) +if(!b&&!_)for(;k--;k)w.unshift("..") +!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),S&&"/"!==w.join("/").substr(-1)&&w.push("") +var x=""===w[0]||w[0]&&"/"===w[0].charAt(0) +if(E){n.hostname=n.host=x?"":w.length?w.shift():"" var P=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@") -P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return b=b||n.host&&_.length,b&&!x&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")), +P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return b=b||n.host&&w.length,b&&!x&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")), n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=d.exec(e) t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){var i;(function(e,r){!function(o){function a(e){throw RangeError(F[e])}function s(e,t){ for(var n=e.length,i=[];n--;)i[n]=t(e[n]) @@ -994,22 +996,22 @@ for(e=n?M(e/S):e>>1,e+=M(e/t);e>D*P>>1;i+=T)e=M(e/D) return M(i+(D+1)*e/(e+O))}function h(e){var t=[],n=e.length,i,r=0,o=j,s=k,l,u,f,h,m,g,v,y,b for(l=e.lastIndexOf(x),l<0&&(l=0),u=0;u=128&&a("not-basic"),t.push(e.charCodeAt(u)) for(f=l>0?l+1:0;f=n&&a("invalid-input"),v=d(e.charCodeAt(f++)),(v>=T||v>M((C-r)/m))&&a("overflow"),r+=v*m,y=g<=s?E:g>=s+P?P:g-s,!(vM(C/b)&&a("overflow"),m*=b -i=t.length+1,s=p(r-h,i,0==h),M(r/i)>C-o&&a("overflow"),o+=M(r/i),r%=i,t.splice(r++,0,o)}return c(t)}function m(e){var t,n,i,r,o,s,l,c,d,h,m,g=[],v,y,b,w +i=t.length+1,s=p(r-h,i,0==h),M(r/i)>C-o&&a("overflow"),o+=M(r/i),r%=i,t.splice(r++,0,o)}return c(t)}function m(e){var t,n,i,r,o,s,l,c,d,h,m,g=[],v,y,b,_ for(e=u(e),v=e.length,t=j,n=0,o=k,s=0;s=t&&mM((C-n)/y)&&a("overflow"),n+=(l-t)*y,t=l,s=0;sC&&a("overflow"),m==t){for(c=n,d=T;h=d<=o?E:d>=o+P?P:d-o,!(cM((C-n)/y)&&a("overflow"),n+=(l-t)*y,t=l,s=0;sC&&a("overflow"),m==t){for(c=n,d=T;h=d<=o?E:d>=o+P?P:d-o,!(c= 0x80 (not a basic code point)", +})}var y="object"==typeof t&&t&&!t.nodeType&&t,b="object"==typeof e&&e&&!e.nodeType&&e,_="object"==typeof r&&r +_.global!==_&&_.window!==_&&_.self!==_||(o=_) +var w,C=2147483647,T=36,E=1,P=26,O=38,S=700,k=72,j=128,x="-",R=/^xn--/,I=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)", "invalid-input":"Invalid input"},D=T-E,M=Math.floor,N=String.fromCharCode,U -_={version:"1.3.2",ucs2:{decode:u,encode:c},decode:h,encode:m,toASCII:v,toUnicode:g},i=function(){return _}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}(this)}).call(t,n(18)(e),function(){return this}()) +w={version:"1.3.2",ucs2:{decode:u,encode:c},decode:h,encode:m,toASCII:v,toUnicode:g},i=function(){return w}.call(t,n,t,e),!(void 0!==i&&(e.exports=i))}(this)}).call(t,n(18)(e),function(){return this}()) },function(e,t){"use strict" e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){ "use strict" -t.decode=t.parse=n(166),t.encode=t.stringify=n(167)},function(e,t){"use strict" +t.decode=t.parse=n(165),t.encode=t.stringify=n(166)},function(e,t){"use strict" function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,i,r){t=t||"&",i=i||"=" var o={} if("string"!=typeof e||0===e.length)return o @@ -1048,14 +1050,14 @@ return n.hrefNoSearch+"?"+o["default"].param(i)+(n.hash||"")},getSearchParams:fu return u.convertSearchToArray(t.search)},convertSearchToArray:function y(e){var t,n,i,r={} for(e=e.replace(/^\?/,""),t=e?e.split("&"):[],n=0;n0){if(e.each(r,function(n,i){t.is("#"+i.id)&&(o=e("#"+i.selected))}),e(o).length<1)return void this.focusFirstInput() if(s=e(o).closest(".ss-tabset").find(".ui-tabs-nav .ui-tabs-active .ui-tabs-anchor").attr("id"),l="tab-"+e(o).closest(".ss-tabset .ui-tabs-panel").attr("id"),a&&l!==s)return u=e(o).closest(".togglecomposite"),u.length>0&&u.accordion("activate",u.find(".ui-accordion-header")),c=e(o).position().top,e(o).is(":visible")||(o="#"+e(o).closest(".field").attr("id"),c=e(o).position().top), -e(o).focus(),c>e(window).height()/2&&t.find(".cms-content-fields").scrollTop(c)}else this.focusFirstInput()}},focusFirstInput:function _(){this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(":visible:first").focus() +e(o).focus(),c>e(window).height()/2&&t.find(".cms-content-fields").scrollTop(c)}else this.focusFirstInput()}},focusFirstInput:function w(){this.find(':input:not(:submit)[data-skip-autofocus!="true"]').filter(":visible:first").focus() }}),e(".cms-edit-form .btn-toolbar input.action[type=submit], .cms-edit-form .btn-toolbar button.action").entwine({onclick:function C(e){return this.is(":disabled")?(e.preventDefault(),!1):this._super(e)===!1||e.defaultPrevented||e.isDefaultPrevented()?void 0:(this.parents("form").trigger("submit",[this]), e.preventDefault(),!1)}}),e(".cms-edit-form .btn-toolbar input.action[type=submit].ss-ui-action-cancel, .cms-edit-form .btn-toolbar button.action.ss-ui-action-cancel").entwine({onclick:function T(e){window.history.length>1?window.history.back():this.parents("form").trigger("submit",[this]), @@ -1454,7 +1456,7 @@ e(".cms-menu-list li").hoverIntent(function(){e(this).toggleFlyout(!0)},function }}),e(".cms-menu-list li").entwine({onmatch:function b(){this.find("ul").length&&this.find("a:first").append(''),this._super() -},onunmatch:function w(){this._super()},toggle:function _(){this[this.hasClass("opened")?"close":"open"]()},open:function C(){var e=this.getMenuItem() +},onunmatch:function _(){this._super()},toggle:function w(){this[this.hasClass("opened")?"close":"open"]()},open:function C(){var e=this.getMenuItem() e&&e.open(),this.find("li.clone")&&this.find("li.clone").remove(),this.addClass("opened").find("ul").show(),this.find(".toggle-children").addClass("opened")},close:function T(){this.removeClass("opened").find("ul").hide(), this.find(".toggle-children").removeClass("opened")},select:function E(){var e=this.getMenuItem() if(this.addClass("current").open(),this.siblings().removeClass("current").close(),this.siblings().find("li").removeClass("current"),e){var t=e.siblings() @@ -1475,7 +1477,7 @@ this.toggleCSS(t),this.toggleIndicator(t),this._super()},toggleCSS:function R(e) void 0===t?e.setPersistedCollapsedState(e.hasClass("collapsed")):void 0!==t&&i===!1&&e.clearPersistedCollapsedState(),e.setPersistedStickyState(i),this.toggleCSS(i),this.toggleIndicator(i),this._super() }})})},function(e,t,n){"use strict" -function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(116),s=i(a) +function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(117),s=i(a) o["default"].entwine("ss.preview",function(e){e(".cms-preview").entwine({AllowedStates:["StageLink","LiveLink","ArchiveLink"],CurrentStateName:null,CurrentSizeName:"auto",IsPreviewEnabled:!1,DefaultMode:"split", Sizes:{auto:{width:"100%",height:"100%"},mobile:{width:"335px",height:"568px"},mobileLandscape:{width:"583px",height:"320px"},tablet:{width:"783px",height:"1024px"},tabletLandscape:{width:"1039px",height:"768px" },desktop:{width:"1024px",height:"800px"}},changeState:function t(n,i){var r=this,o=this._getNavigatorStates() @@ -1512,8 +1514,8 @@ t.addClass("split-disabled"),t.find(".disabled-tooltip").show()},_block:function this.find(".cms-preview-overlay").hide(),this},_initialiseFromContent:function y(){var t,n return e(".cms-previewable").length?(t=this.loadState("mode"),n=this.loadState("size"),this._moveNavigator(),t&&"content"==t||(this.enablePreview(),this._loadCurrentState()),this.redraw(),t&&this.changeMode(t), n&&this.changeSize(n)):this.disablePreview(),this},"from .cms-container":{onafterstatechange:function b(e,t){t.xhr.getResponseHeader("X-ControllerURL")||this._initialiseFromContent()}},PendingURL:null, -oncolumnvisibilitychanged:function w(){var e=this.getPendingURL() -e&&!this.is(".column-hidden")&&(this.setPendingURL(null),this._loadUrl(e),this._unblock())},"from .cms-container .cms-edit-form":{onaftersubmitform:function _(){this._initialiseFromContent()}},_loadUrl:function C(e){ +oncolumnvisibilitychanged:function _(){var e=this.getPendingURL() +e&&!this.is(".column-hidden")&&(this.setPendingURL(null),this._loadUrl(e),this._unblock())},"from .cms-container .cms-edit-form":{onaftersubmitform:function w(){this._initialiseFromContent()}},_loadUrl:function C(e){ return this.find("iframe").addClass("loading").attr("src",e),this},_getNavigatorStates:function T(){var t=e.map(this.getAllowedStates(),function(t){var n=e(".cms-preview-states .state-name[data-name="+t+"]") @@ -1552,7 +1554,7 @@ e(".cms-preview").changeSize(n)}}),e(".preview-selector select.preview-dropdown" return"undefined"!=typeof i&&n.removeClass(i),n.addClass(t),n.attr("data-icon",t),this}}),e(".preview-mode-selector .chosen-drop li:last-child").entwine({onmatch:function U(){e(".preview-mode-selector").hasClass("split-disabled")?this.parent().append('
'):this.parent().append('') }}),e(".preview-device-outer").entwine({onclick:function L(){this.parent(".preview__device").toggleClass("rotate")}})})},function(e,t,n){(function(e){"use strict" -function t(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=t(i),o=n(116),a=t(o) +function t(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=t(i),o=n(117),a=t(o) r["default"].entwine("ss.tree",function(t){t("#Form_BatchActionsForm").entwine({Actions:[],getTree:function n(){return t(".cms-tree")},fromTree:{oncheck_node:function i(e,t){this.serializeFromTree()},onuncheck_node:function r(e,t){ this.serializeFromTree()}},onmatch:function o(){var e=this e.getTree().bind("load_node.jstree",function(t,n){e.refreshSelected()})},onunmatch:function s(){var e=this @@ -1598,10 +1600,10 @@ for(i in e.modified)r=o.getNodeByID(i),o.jstree("set_text",r,e.modified[i].TreeT t(a).effect("highlight")}if(e.deleted)for(i in e.deleted)r=o.getNodeByID(i),r.length&&o.jstree("delete_node",r) if(e.error)for(i in e.error)r=o.getNodeByID(i),t(r).addClass("failed")},dataType:"json"}),n.preventDefault(),!1}}),t(".cms-content-batchactions-button").entwine({onmatch:function v(){this._super(),this.updateTree() -},onunmatch:function y(){this._super()},onclick:function b(e){this.updateTree()},updateTree:function w(){var e=t(".cms-tree"),n=t("#Form_BatchActionsForm") +},onunmatch:function y(){this._super()},onclick:function b(e){this.updateTree()},updateTree:function _(){var e=t(".cms-tree"),n=t("#Form_BatchActionsForm") this._super(),this.data("active")?(e.addClass("multiple"),e.removeClass("draggable"),n.serializeFromTree()):(e.removeClass("multiple"),e.addClass("draggable")),t("#Form_BatchActionsForm").refreshSelected() -}}),t("#Form_BatchActionsForm select[name=Action]").entwine({onchange:function _(e){var n=t(e.target.form),i=n.find(":submit"),r=t(e.target).val() +}}),t("#Form_BatchActionsForm select[name=Action]").entwine({onchange:function w(e){var n=t(e.target.form),i=n.find(":submit"),r=t(e.target).val() r&&r!=-1?i.removeAttr("disabled").button("refresh"):i.attr("disabled","disabled").button("refresh"),t("#Form_BatchActionsForm").refreshSelected(),this.trigger("chosen:updated"),this._super(e)}})})}).call(t,n(1)) },function(e,t,n){"use strict" @@ -1620,7 +1622,7 @@ this.addClass("description-toggle-enabled"),n.on("click",function(){i[e?"hide":" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) o["default"].entwine("ss",function(e){e(".TreeDropdownField").entwine({"from .cms-container form":{onaftersubmitform:function t(e){this.find(".tree-holder").empty(),this._super()}}})})},function(e,t,n){ "use strict" -function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(5),s=i(a),l=n(184),u=i(l),c=n(108),d=n(185),f=i(d) +function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(5),s=i(a),l=n(183),u=i(l),c=n(109),d=n(184),f=i(d) o["default"].entwine("ss",function(e){e(".cms-content-actions .add-to-campaign-action,#add-to-campaign__action").entwine({onclick:function t(){var t=e("#add-to-campaign__dialog-wrapper") return t.length||(t=e('
'),e("body").append(t)),t.open(),!1}}),e("#add-to-campaign__dialog-wrapper").entwine({onunmatch:function n(){this._clearModal()},open:function i(){ this._renderModal(!0)},close:function r(){this._renderModal(!1)},_renderModal:function o(t){var n=this,i=function h(){return n.close()},r=function m(){return n._handleSubmitModal.apply(n,arguments)},o=e("form.cms-edit-form :input[name=ID]").val(),a=window.ss.store,l="SilverStripe\\CMS\\Controllers\\CMSPageEditController",d=a.getState().config.sections[l],p=d.form.AddToCampaignForm.schemaUrl+"/"+o @@ -1630,7 +1632,7 @@ u["default"].render(s["default"].createElement(c.Provider,{store:a},s["default"] responseClassGood:"modal__response modal__response--good"})),this[0])},_clearModal:function a(){u["default"].unmountComponentAtNode(this[0])},_handleSubmitModal:function l(e,t,n){return n()}})})},,function(e,t){ e.exports=FormBuilderModal},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) -n(171),n(187) +n(170),n(186) var a=function s(e){var t=(0,o["default"])((0,o["default"])(this).contents()).find(".message") if(t&&t.html()){var n=(0,o["default"])(window.parent.document).find("#Form_EditForm_Members").get(0) n&&n.refresh() @@ -1658,7 +1660,7 @@ e(this).prop("checked","checked")}):t.each(function(){e(this).prop("checked",e(t })}})})},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) -n(171),o["default"].entwine("ss",function(e){e(".cms-content-tools #Form_SearchForm").entwine({onsubmit:function t(e){this.trigger("beforeSubmit")}}),e(".importSpec").entwine({onmatch:function n(){this.find("div.details").hide(), +n(170),o["default"].entwine("ss",function(e){e(".cms-content-tools #Form_SearchForm").entwine({onsubmit:function t(e){this.trigger("beforeSubmit")}}),e(".importSpec").entwine({onmatch:function n(){this.find("div.details").hide(), this.find("a.detailsLink").click(function(){return e("#"+e(this).attr("href").replace(/.*#/,"")).slideToggle(),!1}),this._super()},onunmatch:function i(){this._super()}})})},function(e,t,n){"use strict" @@ -1673,8 +1675,8 @@ t.toggleClass("active"),t.find(".toggle-content").css("minHeight",n)}})},functio function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r);(0,o["default"])(document).on("click",".confirmedpassword .showOnClick a",function(){var e=(0,o["default"])(".showOnClickContainer",(0, o["default"])(this).parent()) return e.toggle("fast",function(){e.find('input[type="hidden"]').val(e.is(":visible")?1:0)}),!1})},function(e,t,n){"use strict" -function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(116),s=i(a) -window.tmpl=n(192),n(193),n(194),o["default"].widget("blueimpUIX.fileupload",o["default"].blueimpUI.fileupload,{_initTemplates:function l(){this.options.templateContainer=document.createElement(this._files.prop("nodeName")), +function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(117),s=i(a) +window.tmpl=n(191),n(192),n(193),o["default"].widget("blueimpUIX.fileupload",o["default"].blueimpUI.fileupload,{_initTemplates:function l(){this.options.templateContainer=document.createElement(this._files.prop("nodeName")), this.options.uploadTemplate=window.tmpl(this.options.uploadTemplateName),this.options.downloadTemplate=window.tmpl(this.options.downloadTemplateName)},_enableFileInputButton:function u(){o["default"].blueimpUI.fileupload.prototype._enableFileInputButton.call(this), this.element.find(".ss-uploadfield-addfile").show()},_disableFileInputButton:function c(){o["default"].blueimpUI.fileupload.prototype._disableFileInputButton.call(this),this.element.find(".ss-uploadfield-addfile").hide() @@ -1784,22 +1786,22 @@ t.length&&t.removeClass("selected") var n=e.nextAll("li.selected") n.length&&n.removeClass("selected"),(0,o["default"])(this).focus()})})},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) -n(170),o["default"].fn.extend({ssDatepicker:function a(e){return(0,o["default"])(this).each(function(){if(!((0,o["default"])(this).prop("disabled")||(0,o["default"])(this).prop("readonly")||(0,o["default"])(this).data("datepicker"))){ +n(169),o["default"].fn.extend({ssDatepicker:function a(e){return(0,o["default"])(this).each(function(){if(!((0,o["default"])(this).prop("disabled")||(0,o["default"])(this).prop("readonly")||(0,o["default"])(this).data("datepicker"))){ (0,o["default"])(this).siblings("button").addClass("ui-icon ui-icon-calendar") var t=(0,o["default"])(this).closest(".field.date"),n=o["default"].extend(e||{},(0,o["default"])(this).data(),(0,o["default"])(this).data("jqueryuiconfig"),{}) n.showcalendar&&(n.locale&&o["default"].datepicker.regional[n.locale]&&(n=o["default"].extend(n,o["default"].datepicker.regional[n.locale],{})),n.min&&(n.minDate=o["default"].datepicker.parseDate("yy-mm-dd",n.min)), n.max&&(n.maxDate=o["default"].datepicker.parseDate("yy-mm-dd",n.max)),n.dateFormat=n.jquerydateformat,(0,o["default"])(this).datepicker(n))}})}}),(0,o["default"])(document).on("click",".field.date input.text,input.text.date",function(){ (0,o["default"])(this).ssDatepicker(),(0,o["default"])(this).data("datepicker")&&(0,o["default"])(this).datepicker("show")})},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) -n(170),o["default"].entwine("ss",function(e){e(".ss-toggle").entwine({onadd:function t(){this._super(),this.accordion({heightStyle:"content",collapsible:!0,active:!this.hasClass("ss-toggle-start-closed")&&0 +n(169),o["default"].entwine("ss",function(e){e(".ss-toggle").entwine({onadd:function t(){this._super(),this.accordion({heightStyle:"content",collapsible:!0,active:!this.hasClass("ss-toggle-start-closed")&&0 })},onremove:function n(){this.data("accordion")&&this.accordion("destroy"),this._super()},getTabSet:function i(){return this.closest(".ss-tabset")},fromTabSet:{ontabsshow:function r(){this.accordion("resize") }}})})},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) o["default"].entwine("ss",function(e){e(".memberdatetimeoptionset").entwine({onmatch:function t(){this.find(".toggle-content").hide(),this._super()}}),e(".memberdatetimeoptionset .toggle").entwine({onclick:function n(t){ return e(this).closest(".form__field-description").parent().find(".toggle-content").toggle(),!1}})})},function(e,t,n){(function(e){"use strict" -function t(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=t(i),o=n(116),a=t(o) -n(200),n(201),r["default"].entwine("ss",function(t){var n,i +function t(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),r=t(i),o=n(117),a=t(o) +n(199),n(200),r["default"].entwine("ss",function(t){var n,i t(window).bind("resize.treedropdownfield",function(){var e=function a(){t(".TreeDropdownField").closePanel()} if(t.browser.msie&&parseInt(t.browser.version,10)<9){var r=t(window).width(),o=t(window).height() r==n&&o==i||(n=r,i=o,e())}else e()}) @@ -1838,13 +1840,13 @@ var s=!0 o.jstree("destroy").bind("loaded.jstree",function(e,t){var r=i.getValue(),a=o.find('*[data-id="'+r+'"]'),l=t.inst.get_selected() r&&a!=l&&t.inst.select_node(a),s=!1,n&&n.apply(i)}).jstree(i.getTreeConfig()).bind("select_node.jstree",function(e,n){var r=n.rslt.obj,o=t(r).data("id") s||i.getValue()!=o?(i.data("metadata",t.extend({id:o},t(r).getMetaData())),i.setTitle(n.inst.get_text(r)),i.setValue(o)):(i.data("metadata",null),i.setTitle(null),i.setValue(null),n.inst.deselect_node(r)), -s||i.closePanel(),s=!1}),i.setCurrentXhr(null)}}),this.setCurrentXhr(a)},getTreeConfig:function w(){var e=this +s||i.closePanel(),s=!1}),i.setCurrentXhr(null)}}),this.setCurrentXhr(a)},getTreeConfig:function _(){var e=this return{core:{html_titles:!0,animation:0},html_data:{data:this.getPanel().find(".tree-holder").html(),ajax:{url:function n(i){var n=t.path.parseUrl(e.data("urlTree")).hrefNoSearch return n+"/"+(t(i).data("id")?t(i).data("id"):0)},data:function i(n){var i=t.query.load(e.data("urlTree")).keys,r=e.getRequestParams() return r=t.extend({},i,r,{ajax:1})}}},ui:{select_limit:1,initially_select:[this.getPanel().find(".current").attr("id")]},themes:{theme:"apple"},types:{types:{"default":{check_node:function r(e){return!e.hasClass("disabled") },uncheck_node:function o(e){return!e.hasClass("disabled")},select_node:function a(e){return!e.hasClass("disabled")},deselect_node:function s(e){return!e.hasClass("disabled")}}}},plugins:["html_data","ui","themes","types"] -}},getRequestParams:function _(){return{}}}),t(".TreeDropdownField .tree-holder li").entwine({getMetaData:function C(){var e=this.attr("class").match(/class-([^\s]*)/i),t=e?e[1]:"" +}},getRequestParams:function w(){return{}}}),t(".TreeDropdownField .tree-holder li").entwine({getMetaData:function C(){var e=this.attr("class").match(/class-([^\s]*)/i),t=e?e[1]:"" return{ClassName:t}}}),t(".TreeDropdownField *").entwine({getField:function T(){return this.parents(".TreeDropdownField:first")}}),t(".TreeDropdownField").entwine({onclick:function E(e){return this.togglePanel(), !1}}),t(".TreeDropdownField .treedropdownfield-panel").entwine({onclick:function P(e){return!1}}),t(".TreeDropdownField.searchable").entwine({onadd:function O(){this._super() var e=a["default"]._t("TreeDropdownField.ENTERTOSEARCH") @@ -1867,7 +1869,7 @@ onadd:function M(){this._super(),this.bind("change.TreeDropdownField",function() },,,function(module,exports,__webpack_require__){"use strict" function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}var _extends=Object.assign||function(e){for(var t=1;t").append(n).html()},updateFromNode:function ye(e){}}),e("form. return{src:this.find(".thumbnail-preview").attr("src"),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null,"class":this.find(":input[name=CSSClass]").val(),alt:this.find(":input[name=AltText]").val(), -title:this.find(":input[name=Title]").val(),"data-fileid":this.find(":input[name=FileID]").val()}},getExtraData:function we(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val() +title:this.find(":input[name=Title]").val(),"data-fileid":this.find(":input[name=FileID]").val()}},getExtraData:function _e(){var e=this.find(":input[name=Width]").val(),t=this.find(":input[name=Height]").val() return{CaptionText:this.find(":input[name=CaptionText]").val(),Url:this.find(":input[name=URL]").val(),thumbnail:this.find(".thumbnail-preview").attr("src"),width:e?parseInt(e,10):null,height:t?parseInt(t,10):null, -cssclass:this.find(":input[name=CSSClass]").val()}},getHTML:function _e(){var t,n=this.getAttributes(),i=this.getExtraData(),r=e("").attr(n).addClass("ss-htmleditorfield-file embed") +cssclass:this.find(":input[name=CSSClass]").val()}},getHTML:function we(){var t,n=this.getAttributes(),i=this.getExtraData(),r=e("").attr(n).addClass("ss-htmleditorfield-file embed") return e.each(i,function(e,t){r.attr("data-"+e,t)}),t=i.CaptionText?e('

'+i.CaptionText+"

").prepend(r):r, e("
").append(t).html()},updateFromNode:function Ce(e){this.find(":input[name=AltText]").val(e.attr("alt")),this.find(":input[name=Title]").val(e.attr("title")),this.find(":input[name=Width]").val(e.width()), this.find(":input[name=Height]").val(e.height()),this.find(":input[name=Title]").val(e.attr("title")),this.find(":input[name=CSSClass]").val(e.data("cssclass")),this.find(":input[name=FileID]").val(e.data("fileid")) @@ -2105,7 +2107,7 @@ return a&&a.not(c).length&&a.replaceWith(c),l&&l.prepend(s),a||(n.repaint(),n.in e.noticeAdd({text:i,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})}})})},function(e,t){e.exports=ReactApollo},function(e,t,n){"use strict" function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r) -n(170),n(205),n(200),o["default"].entwine("ss",function(e){e(".ss-tabset").entwine({IgnoreTabState:!1,onadd:function t(){var e=window.location.hash +n(169),n(204),n(199),o["default"].entwine("ss",function(e){e(".ss-tabset").entwine({IgnoreTabState:!1,onadd:function t(){var e=window.location.hash this.redrawTabs(),""!==e&&this.openTabFromURL(e),this._super()},onremove:function n(){this.data("tabs")&&this.tabs("destroy"),this._super()},redrawTabs:function i(){this.rewriteHashlinks(),this.tabs()}, openTabFromURL:function r(t){var n e.each(this.find(".ui-tabs-anchor"),function(){if(this.href.indexOf(t)!==-1&&1===e(t).length)return n=e(this),!1}),void 0!==n&&e(document).ready("ajaxComplete",function(){n.click()})},rewriteHashlinks:function o(){ @@ -2113,8 +2115,8 @@ e(this).find("ul a").each(function(){if(e(this).attr("href")){var t=e(this).attr t&&e(this).attr("href",document.location.href.replace(/#.*/,"")+t[0])}})}}),e(".ui-tabs-active .ui-tabs-anchor").entwine({onmatch:function a(){this.addClass("nav-link active")},onunmatch:function s(){this.removeClass("active") }})})},,function(e,t,n){"use strict" -function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(116),s=i(a) -n(170),n(200),o["default"].entwine("ss",function(e){e(".grid-field").entwine({reload:function t(n,i){var r=this,o=this.closest("form"),a=this.find(":input:focus").attr("name"),l=o.find(":input").serializeArray() +function i(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),o=i(r),a=n(117),s=i(a) +n(169),n(199),o["default"].entwine("ss",function(e){e(".grid-field").entwine({reload:function t(n,i){var r=this,o=this.closest("form"),a=this.find(":input:focus").attr("name"),l=o.find(":input").serializeArray() n||(n={}),n.data||(n.data=[]),n.data=n.data.concat(l),window.location.search&&(n.data=window.location.search.replace(/^\?/,"")+"&"+e.param(n.data)),o.addClass("loading"),e.ajax(e.extend({},{headers:{"X-Pjax":"CurrentField" @@ -2141,8 +2143,8 @@ this.toggleDisabled(),this.find('input[type="text"]').on("keyup",function(){e.to ;(n&&i||!n&&!i)&&e.button("option","disabled",!i)}}),e(".grid-field .grid-field__col-compact .action.gridfield-button-delete, .cms-edit-form .btn-toolbar button.action.action-delete").entwine({onclick:function v(e){ return confirm(s["default"]._t("TABLEFIELD.DELETECONFIRMMESSAGE"))?void this._super(e):(e.preventDefault(),!1)}}),e(".grid-field .action.gridfield-button-print").entwine({UUID:null,onmatch:function y(){ -this._super(),this.setUUID((new Date).getTime())},onunmatch:function b(){this._super()},onclick:function w(e){var t=this.actionurl() -return window.open(t),e.preventDefault(),!1}}),e(".ss-gridfield-print-iframe").entwine({onmatch:function _(){this._super(),this.hide().bind("load",function(){this.focus() +this._super(),this.setUUID((new Date).getTime())},onunmatch:function b(){this._super()},onclick:function _(e){var t=this.actionurl() +return window.open(t),e.preventDefault(),!1}}),e(".ss-gridfield-print-iframe").entwine({onmatch:function w(){this._super(),this.hide().bind("load",function(){this.focus() var e=this.contentWindow||this e.print()})},onunmatch:function C(){this._super()}}),e(".grid-field .action.no-ajax").entwine({onclick:function T(e){return window.location.href=this.actionurl(),e.preventDefault(),!1}}),e(".grid-field .action-detail").entwine({ onclick:function E(){return this.getGridField().showDetailView(e(this).prop("href")),!1}}),e(".grid-field[data-selectable]").entwine({getSelectedItems:function P(){return this.find(".ss-gridfield-item.ui-selected") @@ -2174,7 +2176,7 @@ 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 o(){var e=h["default"].get("absoluteBaseUrl"),t=new I["default"]({shouldBatch:!0,addTypename:!0,dataIdFromObject:function T(e){ return e.id>=0&&e.__typename?e.__typename+":"+e.id:null},networkInterface:(0,R.createNetworkInterface)({uri:e+"graphql/",opts:{credentials:"same-origin"}})}) -g["default"].add("config",w["default"]),g["default"].add("form",d.reducer),g["default"].add("schemas",C["default"]),g["default"].add("records",E["default"]),g["default"].add("campaign",O["default"]),g["default"].add("breadcrumbs",k["default"]), +g["default"].add("config",_["default"]),g["default"].add("form",d.reducer),g["default"].add("schemas",C["default"]),g["default"].add("records",E["default"]),g["default"].add("campaign",O["default"]),g["default"].add("breadcrumbs",k["default"]), g["default"].add("routing",f.routerReducer),g["default"].add("apollo",t.reducer()),x["default"].start() var n={},i=(0,l.combineReducers)(g["default"].getAll()),r=[c["default"],t.middleware()],o=h["default"].get("environment"),a=h["default"].get("debugging"),u=l.applyMiddleware.apply(void 0,r),p=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__,m=window.__REDUX_DEVTOOLS_EXTENSION__||window.devToolsExtension @@ -2182,23 +2184,23 @@ var n={},i=(0,l.combineReducers)(g["default"].getAll()),r=[c["default"],t.middle "dev"===o&&a&&("function"==typeof p?u=p(l.applyMiddleware.apply(void 0,r)):"function"==typeof m&&(u=(0,l.compose)(l.applyMiddleware.apply(void 0,r),m()))) var v=u(l.createStore),b=v(i,n) b.dispatch(y.setConfig(h["default"].getAll())),window.ss=window.ss||{},window.ss.store=b,window.ss=window.ss||{},window.ss.apolloClient=t -var _=new s["default"](b,t) -_.start(window.location.pathname),window.jQuery&&window.jQuery("body").addClass("js-react-boot")}var a=n(208),s=r(a),l=n(109),u=n(230),c=r(u),d=n(111),f=n(229),p=n(149),h=r(p),m=n(231),g=r(m),v=n(232),y=i(v),b=n(234),w=r(b),_=n(235),C=r(_),T=n(236),E=r(T),P=n(237),O=r(P),S=n(239),k=r(S),j=n(240),x=r(j),R=n(255),I=r(R),A=n(256),F=r(A),D=n(10),M=r(D) +var w=new s["default"](b,t) +w.start(window.location.pathname),window.jQuery&&window.jQuery("body").addClass("js-react-boot")}var a=n(207),s=r(a),l=n(110),u=n(229),c=r(u),d=n(112),f=n(228),p=n(150),h=r(p),m=n(230),g=r(m),v=n(231),y=i(v),b=n(233),_=r(b),w=n(234),C=r(w),T=n(235),E=r(T),P=n(236),O=r(P),S=n(238),k=r(S),j=n(239),x=r(j),R=n(255),I=r(R),A=n(256),F=r(A),D=n(10),M=r(D) M["default"].polyfill(),window.onload=o},function(e,t,n){"use strict" function i(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")}Object.defineProperty(t,"__esModule",{value:!0}) var o=function(){function e(e,t){for(var n=0;n.form-group{ + margin-top:0; + display:inline-block; + margin-right:.6154rem; + min-width:166px; + vertical-align:bottom; +} + +.field-group-component>.form-group .form__field-label{ + font-size:.846rem; + color:#66727d; +} + .list-group{ margin-left:-1.5385rem; margin-right:-1.5385rem; @@ -14929,7 +14942,6 @@ div.TreeDropdownField a.jstree-loading .jstree-pageicon{ line-height:14px; margin-bottom:0; float:left; - width:70%; max-height:52px; } @@ -14938,6 +14950,10 @@ div.TreeDropdownField a.jstree-loading .jstree-pageicon{ float:none; } +.breadcrumb>li.breadcrumb__item--last.breadcrumb__item--no-crumb:before,.breadcrumb__item--last.breadcrumb__item--no-crumb:before{ + content:""; +} + .breadcrumb__item-title--last,.cms h2.breadcrumb__item-title--last{ margin:0; font-size:1.23rem; @@ -15760,6 +15776,16 @@ input.checkbox,input.radio,input[type=checkbox],input[type=radio]{ margin-left:-1.5385rem; } +.field input[type=date].creditcard,.field input[type=date].text,.field input[type=date].TreeDropdownField,.field input[type=datetime-local].creditcard,.field input[type=datetime-local].text,.field input[type=datetime-local].TreeDropdownField,.field input[type=month].creditcard,.field input[type=month].text,.field input[type=month].TreeDropdownField,.field input[type=time].creditcard,.field input[type=time].text,.field input[type=time].TreeDropdownField,input[type=date].form-control,input[type=datetime-local].form-control,input[type=month].form-control,input[type=time].form-control{ + min-height:calc(.5385rem * 2 + 20px + 2px); +} + +@media screen and (-webkit-min-device-pixel-ratio:0){ + .field input[type=date].creditcard,.field input[type=date].text,.field input[type=date].TreeDropdownField,.field input[type=datetime-local].creditcard,.field input[type=datetime-local].text,.field input[type=datetime-local].TreeDropdownField,.field input[type=month].creditcard,.field input[type=month].text,.field input[type=month].TreeDropdownField,.field input[type=time].creditcard,.field input[type=time].text,.field input[type=time].TreeDropdownField,input[type=date].form-control,input[type=datetime-local].form-control,input[type=month].form-control,input[type=time].form-control{ + line-height:1.539; + } +} + @media (min-width:992px){ .cms-edit-form:not(.AssetAdmin) .form-group,.form--inline .form-group,.ss-insert-link .form__fieldgroup .form-group{ display:-webkit-box; diff --git a/admin/client/lang/en.js b/admin/client/lang/en.js index d54f08071..b69fd3ac3 100644 --- a/admin/client/lang/en.js +++ b/admin/client/lang/en.js @@ -23,6 +23,17 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') { "LeftAndMain.CONFIRMUNSAVED": "Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page.", "LeftAndMain.CONFIRMUNSAVEDSHORT": "WARNING: Your changes have not been saved.", "LeftAndMain.PAGEWASDELETED": "This page was deleted. To edit a page, select it from the left.", + "LeftAndMain.SEARCHCLEARRESULTS": "Clear search", + "LeftAndMain.SEARCHRESULTS": "Search results", + "LeftAndMain.SEARCHRESULTSMESSAGE": "Search results {parts}", + "LeftAndMain.SEARCHRESULTSMESSAGEKEYWORDS": "with keywords '{Name}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDBETWEEN": "created between '{CreatedFrom}' and '{CreatedTo}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDFROM": "created after '{CreatedFrom}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDTO": "created before '{CreatedTo}'", + "LeftAndMain.SEARCHRESULTSMESSAGECATEGORY": "categorised as '{AppCategory}'", + "LeftAndMain.SEARCHRESULTSMESSAGELIMIT": "limited to the folder '{Folder}'", + "LeftAndMain.JOIN": ",", + "LeftAndMain.JOINLAST": "and", "ModelAdmin.DELETED": "Deleted", "ModelAdmin.REALLYDELETE": "Do you really want to delete?", "ModelAdmin.SAVED": "Saved", diff --git a/admin/client/lang/src/en.js b/admin/client/lang/src/en.js index 05b42674b..e1087a492 100644 --- a/admin/client/lang/src/en.js +++ b/admin/client/lang/src/en.js @@ -16,6 +16,17 @@ "LeftAndMain.CONFIRMUNSAVED": "Are you sure you want to navigate away from this page?\n\nWARNING: Your changes have not been saved.\n\nPress OK to continue, or Cancel to stay on the current page.", "LeftAndMain.CONFIRMUNSAVEDSHORT": "WARNING: Your changes have not been saved.", "LeftAndMain.PAGEWASDELETED": "This page was deleted. To edit a page, select it from the left.", + "LeftAndMain.SEARCHCLEARRESULTS": "Clear search", + "LeftAndMain.SEARCHRESULTS": "Search results", + "LeftAndMain.SEARCHRESULTSMESSAGE": "Search results {parts}", + "LeftAndMain.SEARCHRESULTSMESSAGEKEYWORDS": "with keywords '{Name}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDBETWEEN": "edited between '{CreatedFrom}' to '{CreatedTo}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDFROM": "edited from '{CreatedFrom}'", + "LeftAndMain.SEARCHRESULTSMESSAGEEDITEDTO": "edited before '{CreatedTo}'", + "LeftAndMain.SEARCHRESULTSMESSAGECATEGORY": "categorised as '{AppCategory}'", + "LeftAndMain.SEARCHRESULTSMESSAGELIMIT": "limited to the folder '{Folder}'", + "LeftAndMain.JOIN": ",", + "LeftAndMain.JOINLAST": "and", "ModelAdmin.DELETED": "Deleted", "ModelAdmin.REALLYDELETE": "Do you really want to delete?", "ModelAdmin.SAVED": "Saved", diff --git a/admin/client/src/boot/BootInjector.js b/admin/client/src/boot/BootInjector.js index 0c172f7f2..e701d3fc8 100644 --- a/admin/client/src/boot/BootInjector.js +++ b/admin/client/src/boot/BootInjector.js @@ -15,6 +15,7 @@ import CompositeField from 'components/CompositeField/CompositeField'; import Tabs from 'components/Tabs/Tabs'; import TabItem from 'components/Tabs/TabItem'; import FormAction from 'components/FormAction/FormAction'; +import FieldGroup from 'components/FieldGroup/FieldGroup'; /** * TODO remove when dependency injector for javascript is incorporated @@ -29,6 +30,7 @@ class BootInjector { injector.register('CheckboxSetField', CheckboxSetField); injector.register('OptionsetField', OptionsetField); injector.register('GridField', GridField); + injector.register('FieldGroup', FieldGroup); injector.register('SingleSelectField', SingleSelectField); injector.register('PopoverField', PopoverField); injector.register('HeaderField', HeaderField); diff --git a/admin/client/src/bundles/bundle.js b/admin/client/src/bundles/bundle.js index eb87cb146..19758895f 100644 --- a/admin/client/src/bundles/bundle.js +++ b/admin/client/src/bundles/bundle.js @@ -8,6 +8,7 @@ require('expose?schemaFieldValues!lib/schemaFieldValues'); require('expose?FieldHolder!components/FieldHolder/FieldHolder'); require('expose?Form!components/Form/Form'); require('expose?FormConstants!components/Form/FormConstants'); +require('expose?FormAlert!components/FormAlert/FormAlert'); require('expose?FormAction!components/FormAction/FormAction'); require('expose?SchemaActions!state/schema/SchemaActions'); require('expose?FormBuilder!components/FormBuilder/FormBuilder'); diff --git a/admin/client/src/components/Breadcrumb/Breadcrumb.js b/admin/client/src/components/Breadcrumb/Breadcrumb.js index ea5aeee89..4295028fd 100644 --- a/admin/client/src/components/Breadcrumb/Breadcrumb.js +++ b/admin/client/src/components/Breadcrumb/Breadcrumb.js @@ -32,9 +32,14 @@ class Breadcrumb extends SilverStripeComponent { this.props.crumbs.slice(-1).map((crumb, index) => { const iconClassNames = ['breadcrumb__icon', crumb.icon ? crumb.icon.className : ''] .join(' '); + const itemClassNames = ['breadcrumb__item', 'breadcrumb__item--last']; + + if (crumb.noCrumb) { + itemClassNames.push('breadcrumb__item--no-crumb'); + } return [ -
  • +
  • {crumb.text} {crumb.icon && diff --git a/admin/client/src/components/Breadcrumb/Breadcrumb.scss b/admin/client/src/components/Breadcrumb/Breadcrumb.scss index fd6f19f6d..8aca96907 100644 --- a/admin/client/src/components/Breadcrumb/Breadcrumb.scss +++ b/admin/client/src/components/Breadcrumb/Breadcrumb.scss @@ -3,7 +3,6 @@ line-height: 14px; margin-bottom: 0; float: left; - width: 70%; max-height: $toolbar-height; } @@ -11,6 +10,10 @@ .breadcrumb__item--last { display: block; float: none; + + &.breadcrumb__item--no-crumb:before { + content: ""; + } } .cms h2.breadcrumb__item-title--last, // TODO Fix CMS clash diff --git a/admin/client/src/components/CompositeField/CompositeField.js b/admin/client/src/components/CompositeField/CompositeField.js index 6ca365fb1..937d71fec 100644 --- a/admin/client/src/components/CompositeField/CompositeField.js +++ b/admin/client/src/components/CompositeField/CompositeField.js @@ -18,10 +18,14 @@ class CompositeField extends SilverStripeComponent { return null; } + getClassName() { + return `${this.props.className} ${this.props.extraClass}`; + } + render() { const legend = this.getLegend(); const Tag = this.props.data.tag || 'div'; - const className = `${this.props.className} ${this.props.extraClass}`; + const className = this.getClassName(); return ( diff --git a/admin/client/src/components/FieldGroup/FieldGroup.js b/admin/client/src/components/FieldGroup/FieldGroup.js new file mode 100644 index 000000000..4e7ab290a --- /dev/null +++ b/admin/client/src/components/FieldGroup/FieldGroup.js @@ -0,0 +1,13 @@ +import CompositeField from 'components/CompositeField/CompositeField'; +import fieldHolder from 'components/FieldHolder/FieldHolder'; + +class FieldGroup extends CompositeField { + getClassName() { + return `field-group-component ${super.getClassName()}`; + } +} + +// Field group is essentially a composite field, but wrapped with a typical field holder +export { FieldGroup }; + +export default fieldHolder(FieldGroup); diff --git a/admin/client/src/components/FieldGroup/FieldGroup.scss b/admin/client/src/components/FieldGroup/FieldGroup.scss new file mode 100644 index 000000000..10ede43af --- /dev/null +++ b/admin/client/src/components/FieldGroup/FieldGroup.scss @@ -0,0 +1,15 @@ + // Note: Intentionally non-bem due to the way composite fields affect nested styles +.field-group-component { + > .form-group { + margin-top: 0; + display: inline-block; + margin-right: $spacer-x / 2; + min-width: 166px; + vertical-align: bottom; // Align fields with no labels + + .form__field-label { + font-size: $font-size-xs; + color: $text-muted; + } + } +} diff --git a/admin/client/src/components/FieldGroup/README.md b/admin/client/src/components/FieldGroup/README.md new file mode 100644 index 000000000..feca64492 --- /dev/null +++ b/admin/client/src/components/FieldGroup/README.md @@ -0,0 +1,5 @@ +# FieldGroup + +A group of fields with a title + +See CompositeField diff --git a/admin/client/src/components/Form/Form.scss b/admin/client/src/components/Form/Form.scss index 6fe85c55b..c32f49d4f 100644 --- a/admin/client/src/components/Form/Form.scss +++ b/admin/client/src/components/Form/Form.scss @@ -301,6 +301,20 @@ input.radio { } } +// Fix height of date-fields collapsing in IE +input[type=date], +input[type=time], +input[type=datetime-local], +input[type=month] { + &.form-control { + min-height: calc(#{$input-padding-y} * 2 + #{$line-height-base} + 2px); + + // Reduce huge line-height for BS date-fields + @media screen and (-webkit-min-device-pixel-ratio: 0) { + line-height: $line-height; + } + } +} // TEMPORARY // Apply .form--inline to forms to state whether or not the label and input should become inline diff --git a/admin/client/src/components/SingleSelectField/SingleSelectField.js b/admin/client/src/components/SingleSelectField/SingleSelectField.js index a4ab9fb9d..37917fe29 100644 --- a/admin/client/src/components/SingleSelectField/SingleSelectField.js +++ b/admin/client/src/components/SingleSelectField/SingleSelectField.js @@ -81,7 +81,8 @@ class SingleSelectField extends SilverStripeComponent { getInputProps() { const props = { bsClass: this.props.bsClass, - className: `${this.props.className} ${this.props.extraClass}`, + // @TODO Prevent entwine chosen applying chosen + className: `${this.props.className} ${this.props.extraClass} no-chosen`, id: this.props.id, name: this.props.name, disabled: this.props.disabled, diff --git a/admin/client/src/components/TextField/TextField.js b/admin/client/src/components/TextField/TextField.js index f144f80b0..efa8bbf5d 100644 --- a/admin/client/src/components/TextField/TextField.js +++ b/admin/client/src/components/TextField/TextField.js @@ -54,7 +54,7 @@ class TextField extends SilverStripeComponent { } else { Object.assign(props, { componentClass: 'input', - type: this.props.type, + type: this.props.type.toLowerCase(), }); } } diff --git a/admin/client/src/lib/DataFormat.js b/admin/client/src/lib/DataFormat.js index c4e628576..98168612f 100644 --- a/admin/client/src/lib/DataFormat.js +++ b/admin/client/src/lib/DataFormat.js @@ -1,20 +1,38 @@ import i18n from 'i18n'; -import QueryString from 'query-string'; +import qs from 'qs'; -export function urlQuery(location, newQuery) { +/** + * Merge existing querystring with new querystring object + * + * @param {Object} locationQuery - Current browser querystring object (window.location.query) + * @param {Object} newQuery - New object to update. Set to null to clear instead of merge. + * @returns {String} + */ +export function urlQuery(locationQuery, newQuery) { if (newQuery === null) { - return null; - } - if (newQuery) { - const mergedQuery = Object.assign({}, location.query, newQuery); - const query = QueryString.stringify(mergedQuery); - - if (query) { - return `?${query}`; - } return ''; } - return location.search; + let mergedQuery = locationQuery || {}; + if (newQuery) { + mergedQuery = Object.assign({}, mergedQuery, newQuery); + } + const query = qs.stringify(mergedQuery); + if (query) { + return `?${query}`; + } + return ''; +} + +/** + * Turn flatterned querystring object into recursive nested objects, + * similarly to how PHP handles nested querystring objects. + * E.g. turn `{'query[val]': bob}` into `{query: { val: bob }}` + * + * @param {String} query - Querystring string + * @return {Object} - Unflattened query object + */ +export function decodeQuery(query) { + return qs.parse(query.replace(/^\?/, '')); } export function fileSize(size) { diff --git a/admin/client/src/lib/Injector.js b/admin/client/src/lib/Injector.js index 8edd272a2..eba64e986 100644 --- a/admin/client/src/lib/Injector.js +++ b/admin/client/src/lib/Injector.js @@ -29,6 +29,7 @@ class Injector { getComponentByDataType(dataType) { switch (dataType) { case 'Text': + case 'Date': case 'DateTime': return this.components.TextField; case 'Hidden': diff --git a/admin/client/src/styles/_variables.scss b/admin/client/src/styles/_variables.scss index 841f61343..d1bc5d6cf 100644 --- a/admin/client/src/styles/_variables.scss +++ b/admin/client/src/styles/_variables.scss @@ -723,6 +723,7 @@ $close-text-shadow: 0 1px 0 #fff; // $pre-scrollable-max-height: 340px; // Panel sizes + $cms-panel-xs: 60px; $cms-panel-sm: 300px; $cms-panel-md: 448px; @@ -730,6 +731,7 @@ $cms-panel-lg: 638px; // Shadows + $shadow-level-1: rgba(0, 0, 0, .1); $shadow-level-2: rgba(0, 0, 0, .15); $shadow-level-3: rgba(0, 0, 0, .2); @@ -737,18 +739,21 @@ $shadow-level-4: rgba(0, 0, 0, .25); $shadow-level-5: rgba(0, 0, 0, .3); // TODO tidy all shadows cms wide (including AssetAdmin) + $shadow-light: $shadow-level-3; $shadow-lighter: $shadow-level-1; $dropdown-shadow: 0 0 3px $shadow-level-3; $gallery-item-shadow: 0 1px 4px $shadow-level-3; // Gives items depth of different levels + $z-depth-1: 0 2px 5px 0 $shadow-level-1, 0 2px 10px 0 $shadow-level-1; $z-depth-2: 0 8px 12px 0 $shadow-level-3, 0 6px 20px 0 $shadow-level-2; $z-depth-3: 0 12px 20px 0 $shadow-level-4, 0 17px 40px 0 $shadow-level-3; $z-depth-4: 0 16px 28px 0 $shadow-level-5, 0 25px 55px 0 $shadow-level-5; // Masks: typically behind modals, drag drop areas + $page-mask-light: rgba(236, 239, 241, .9); @@ -775,6 +780,13 @@ $desktop-height: 768px; $desktop-width: 1366px; +// Search panel sizes + +$search-width: 360px; +$search-width-lg: 500px; +$search-width-max: 100%; + + // Transition speeds $transition-speed-slow: 1s; diff --git a/admin/client/src/styles/bundle.scss b/admin/client/src/styles/bundle.scss index a125f6c4e..cf43e5475 100644 --- a/admin/client/src/styles/bundle.scss +++ b/admin/client/src/styles/bundle.scss @@ -42,6 +42,7 @@ // Components @import "../components/Accordion/Accordion"; +@import "../components/FieldGroup/FieldGroup"; @import "../components/ListGroup/ListGroup"; @import "../components/Breadcrumb/Breadcrumb"; @import "../components/FormBuilderModal/FormBuilderModal"; diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index f4a83f10a..32e50c13b 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -347,16 +347,21 @@ class LeftAndMain extends Controller implements PermissionProvider if (!$formName) { return (new HTTPResponse('Missing request params', 400)); } - - if (!$this->hasMethod("get{$formName}")) { + + $formMethod = "get{$formName}"; + if (!$this->hasMethod($formMethod)) { return (new HTTPResponse('Form not found', 404)); } if (!$this->hasAction($formName)) { return (new HTTPResponse('Form not accessible', 401)); } - - $form = $this->{"get{$formName}"}($itemID); + + if ($itemID) { + $form = $this->{$formMethod}($itemID); + } else { + $form = $this->{$formMethod}(); + } $schemaID = $request->getURL(); return $this->getSchemaResponse($schemaID, $form); } diff --git a/admin/templates/SilverStripe/Admin/Includes/BackLink_Button.ss b/admin/templates/SilverStripe/Admin/Includes/BackLink_Button.ss index f8a18f86f..c125d3a9c 100644 --- a/admin/templates/SilverStripe/Admin/Includes/BackLink_Button.ss +++ b/admin/templates/SilverStripe/Admin/Includes/BackLink_Button.ss @@ -1,5 +1,5 @@ <% if $Backlink %> <% end_if %> diff --git a/admin/templates/SilverStripe/Admin/Includes/LeftAndMain_MenuToggle.ss b/admin/templates/SilverStripe/Admin/Includes/LeftAndMain_MenuToggle.ss index 87d59aa3e..6b7534c7f 100644 --- a/admin/templates/SilverStripe/Admin/Includes/LeftAndMain_MenuToggle.ss +++ b/admin/templates/SilverStripe/Admin/Includes/LeftAndMain_MenuToggle.ss @@ -1,4 +1,4 @@ Auto -» -« +»Expand panel +«Collapse panel diff --git a/admin/templates/SilverStripe/Admin/LeftAndMain.ss b/admin/templates/SilverStripe/Admin/LeftAndMain.ss index d2426b342..2ad6bf8c3 100644 --- a/admin/templates/SilverStripe/Admin/LeftAndMain.ss +++ b/admin/templates/SilverStripe/Admin/LeftAndMain.ss @@ -18,5 +18,6 @@

  • $EditorToolbar + diff --git a/package.json b/package.json index d9da2d089..8ae203faa 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "merge": "^1.2.0", "page.js": "^4.13.3", "qs": "^6.1.0", - "query-string": "^3.0.3", "react": "^15.3.1", "react-addons-css-transition-group": "^15.3.1", "react-apollo": "^0.7.0", diff --git a/src/Forms/CompositeField.php b/src/Forms/CompositeField.php index 36112c53f..706ea0e2c 100644 --- a/src/Forms/CompositeField.php +++ b/src/Forms/CompositeField.php @@ -48,6 +48,8 @@ class CompositeField extends FormField protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_STRUCTURAL; + protected $schemaComponent = 'CompositeField'; + public function __construct($children = null) { if ($children instanceof FieldList) { @@ -83,6 +85,13 @@ class CompositeField extends FormField $defaults['data']['tag'] = $this->getTag(); $defaults['data']['legend'] = $this->getLegend(); + // Scaffolded children will inherit this data + $defaults['data']['inherited'] = [ + 'data' => [ + 'fieldholder' => 'small' + ], + ]; + return $defaults; } diff --git a/src/Forms/FieldGroup.php b/src/Forms/FieldGroup.php index 5a29c06cc..9c40c3f12 100644 --- a/src/Forms/FieldGroup.php +++ b/src/Forms/FieldGroup.php @@ -61,6 +61,8 @@ use SilverStripe\ORM\ValidationResult; class FieldGroup extends CompositeField { + protected $schemaComponent = 'FieldGroup'; + protected $zebra; /** diff --git a/src/Forms/FormFactory.php b/src/Forms/FormFactory.php index 329d2a599..0f3db1a9d 100644 --- a/src/Forms/FormFactory.php +++ b/src/Forms/FormFactory.php @@ -30,7 +30,7 @@ interface FormFactory /** * Return list of mandatory context keys * - * @return mixed + * @return array */ public function getRequiredContext(); } diff --git a/tests/php/Forms/FormSchemaTest.php b/tests/php/Forms/FormSchemaTest.php index d84fcc25c..1421ae86e 100644 --- a/tests/php/Forms/FormSchemaTest.php +++ b/tests/php/Forms/FormSchemaTest.php @@ -306,6 +306,11 @@ class FormSchemaTest extends SapphireTest 'tag' => 'div', 'legend' => null, 'buttonTooltip' => null, + 'inherited' => [ + 'data' => [ + 'fieldholder' => 'small' + ], + ], ], 'validation' => [], 'children' => [