From f70cb0822910d74ddfad7adebfbde07d802e40a3 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 14 Apr 2016 12:23:21 +1200 Subject: [PATCH] Improve i18n on campaigns section --- admin/javascript/dist/bundle-framework.js | 4 ++-- .../src/sections/campaign-admin/controller.js | 3 +++ .../src/sections/campaign-admin/item.js | 19 +++++++++++++------ .../src/sections/campaign-admin/preview.js | 3 +++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/admin/javascript/dist/bundle-framework.js b/admin/javascript/dist/bundle-framework.js index 06a33964b..c72be74b8 100644 --- a/admin/javascript/dist/bundle-framework.js +++ b/admin/javascript/dist/bundle-framework.js @@ -1,3 +1,3 @@ -!function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return o(r?r:e)},l,l.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=200&&e.status<300))throw r=new Error(e.statusText),r.response=e,r;return t=e}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t-1?r[s]=i:r.push(i),(0,c["default"])(a({},e,o({},n,r)));case l["default"].DELETE_RECORD_REQUEST:return e;case l["default"].DELETE_RECORD_FAILURE:return e;case l["default"].DELETE_RECORD_SUCCESS:return n=t.payload.recordType,r=e[n].filter(function(e){return e.ID!==t.payload.id}),(0,c["default"])(a({},e,o({},n,r)));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t1)for(var r=1;re;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}J=0}function h(){try{var t=e,r=t("vertx");return q=r.runOnLoop||r.runOnContext,u()}catch(n){return p()}}function y(e,t){var r=this,n=r._state;if(n===ie&&!e||n===ae&&!t)return this;var o=new this.constructor(v),i=r._result;if(n){var a=arguments[n-1];X(function(){F(n,o,a,i)})}else S(r,o,e,t);return o}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(v);return T(r,e),r}function v(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function E(e){try{return e.then}catch(t){return se.error=t,se}}function w(e,t,r,n){try{e.call(t,r,n)}catch(o){return o}}function _(e,t,r){X(function(e){var n=!1,o=w(r,t,function(r){n||(n=!0,t!==r?T(e,r):R(e,r))},function(t){n||(n=!0,x(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,x(e,o))},e)}function O(e,t){t._state===ie?R(e,t._result):t._state===ae?x(e,t._result):S(t,void 0,function(t){T(e,t)},function(t){x(e,t)})}function C(e,t,r){t.constructor===e.constructor&&r===re&&constructor.resolve===ne?O(e,t):r===se?x(e,se.error):void 0===r?R(e,t):i(r)?_(e,t,r):R(e,t)}function T(e,t){e===t?x(e,b()):o(t)?C(e,t,E(t)):R(e,t)}function j(e){e._onerror&&e._onerror(e._result),P(e)}function R(e,t){e._state===oe&&(e._result=t,e._state=ie,0!==e._subscribers.length&&X(P,e))}function x(e,t){e._state===oe&&(e._state=ae,e._result=t,X(j,e))}function S(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ie]=r,o[i+ae]=n,0===i&&e._state&&X(P,e)}function P(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,o,i=e._result,a=0;aa;a++)S(n.resolve(e[a]),void 0,t,r);return o}function U(e){var t=this,r=new t(v);return x(r,e),r}function M(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function H(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function k(e){this._id=pe++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==e&&("function"!=typeof e&&M(),this instanceof k?I(this,e):H())}function B(e,t){this._instanceConstructor=e,this.promise=new e(v),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&R(this.promise,this._result))):x(this.promise,this._validationError())}function G(){var e;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(e.Promise=de)}var V;V=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var q,Q,z,K=V,J=0,X=function(e,t){te[J]=e,te[J+1]=t,J+=2,2===J&&(Q?Q(d):z())},Y="undefined"!=typeof window?window:void 0,$=Y||{},W=$.MutationObserver||$.WebKitMutationObserver,Z="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);z=Z?c():W?l():ee?f():void 0===Y&&"function"==typeof e?h():p();var re=y,ne=m,oe=void 0,ie=1,ae=2,se=new D,ce=new D,ue=N,le=L,fe=U,pe=0,de=k;k.all=ue,k.race=le,k.resolve=ne,k.reject=fe,k._setScheduler=a,k._setAsap=s,k._asap=X,k.prototype={constructor:k,then:re,"catch":function(e){return this.then(null,e)}};var he=B;B.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},B.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===oe&&e>r;r++)this._eachEntry(t[r],r)},B.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===ne){var o=E(e);if(o===re&&e._state!==oe)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===de){var i=new r(v);C(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){t(e)}),t)}else this._willSettleAt(n(e),t)},B.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===oe&&(this._remaining--,e===ae?x(n,r):this._result[t]=r),0===this._remaining&&R(n,this._result)},B.prototype._willSettleAt=function(e,t){var r=this;S(e,void 0,function(e){r._settledAt(ie,t,e)},function(e){r._settledAt(ae,t,e)})};var ye=G,me={Promise:de,polyfill:ye};"function"==typeof define&&define.amd?define(function(){return me}):"undefined"!=typeof t&&t.exports?t.exports=me:"undefined"!=typeof this&&(this.ES6Promise=me),ye()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:23}],25:[function(e,t,r){e("whatwg-fetch"),t.exports=self.fetch.bind(self)},{"whatwg-fetch":26}],26:[function(e,t,r){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function r(e){return"string"!=typeof e&&(e=String(e)),e}function n(e){this.map={},e instanceof n?e.forEach(function(e,t){this.append(t,e)},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function o(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function i(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function a(e){var t=new FileReader;return t.readAsArrayBuffer(e),i(t)}function s(e){var t=new FileReader;return t.readAsText(e),i(t)}function c(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(h.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(h.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!h.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},h.blob?(this.blob=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(a)},this.text=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return s(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var e=o(this);return e?e:Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}function l(e,t){t=t||{};var r=t.body;if(l.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new n(e.headers)),this.method=e.method,this.mode=e.mode,r||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new n(t.headers)),this.method=u(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function p(e){var t=new n,r=e.getAllResponseHeaders().trim().split("\n");return r.forEach(function(e){var r=e.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();t.append(n,o)}),t}function d(e,t){t||(t={}),this.type="default",this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof n?t.headers:new n(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){n.prototype.append=function(e,n){e=t(e),n=r(n);var o=this.map[e];o||(o=[],this.map[e]=o),o.push(n)},n.prototype["delete"]=function(e){delete this.map[t(e)]},n.prototype.get=function(e){var r=this.map[t(e)];return r?r[0]:null},n.prototype.getAll=function(e){return this.map[t(e)]||[]},n.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},n.prototype.set=function(e,n){this.map[t(e)]=[r(n)]},n.prototype.forEach=function(e,t){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){e.call(t,n,r,this)},this)},this)};var h={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this)},c.call(l.prototype),c.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new n(this.headers),url:this.url})},d.error=function(){var e=new d(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];d.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new d(null,{status:t,headers:{location:e}})},e.Headers=n,e.Request=l,e.Response=d,e.fetch=function(e,t){return new Promise(function(r,n){function o(){return"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0}var i;i=l.prototype.isPrototypeOf(e)&&!t?e:new l(e,t);var a=new XMLHttpRequest;a.onload=function(){var e=1223===a.status?204:a.status;if(100>e||e>599)return void n(new TypeError("Network request failed"));var t={status:e,statusText:a.statusText,headers:p(a),url:o()},i="response"in a?a.response:a.responseText;r(new d(i,t))},a.onerror=function(){n(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials&&(a.withCredentials=!0),"responseType"in a&&h.blob&&(a.responseType="blob"),i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],27:[function(e,t,r){"use strict";var n=e("./stringify"),o=e("./parse");t.exports={stringify:n,parse:o}},{"./parse":28,"./stringify":29}],28:[function(e,t,r){"use strict";var n=e("./utils"),o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};o.parseValues=function(e,t){for(var r={},o=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),i=0;i=0&&r.parseArrays&&s<=r.arrayLimit?(n=[],n[s]=o.parseObject(e,t,r)):n[a]=o.parseObject(e,t,r)}return n},o.parseKeys=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,i=/^([^\[\]]*)/,a=/(\[[^\[\]]*\])/g,s=i.exec(n),c=[];if(s[1]){if(!r.plainObjects&&Object.prototype.hasOwnProperty(s[1])&&!r.allowPrototypes)return;c.push(s[1])}for(var u=0;null!==(s=a.exec(n))&&ut;++t)e[t]="%"+((16>t?"0":"")+t.toString(16)).toUpperCase();return e}();r.arrayToObject=function(e,t){for(var r=t.plainObjects?Object.create(null):{},n=0;n=48&&57>=i||i>=65&&90>=i||i>=97&&122>=i?r+=t.charAt(o):128>i?r+=n[i]:2048>i?r+=n[192|i>>6]+n[128|63&i]:55296>i||i>=57344?r+=n[224|i>>12]+n[128|i>>6&63]+n[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(o)),r+=n[240|i>>18]+n[128|i>>12&63]+n[128|i>>6&63]+n[128|63&i])}return r},r.compact=function(e,t){if("object"!=typeof e||null===e)return e;var n=t||[],o=n.indexOf(e);if(-1!==o)return n[o];if(n.push(e),Array.isArray(e)){for(var i=[],a=0;a=200&&e.status<300))throw r=new Error(e.statusText),r.response=e,r;return t=e}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t-1?r[s]=i:r.push(i),(0,c["default"])(a({},e,o({},n,r)));case l["default"].DELETE_RECORD_REQUEST:return e;case l["default"].DELETE_RECORD_FAILURE:return e;case l["default"].DELETE_RECORD_SUCCESS:return n=t.payload.recordType,r=e[n].filter(function(e){return e.ID!==t.payload.id}),(0,c["default"])(a({},e,o({},n,r)));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t1)for(var r=1;re;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}J=0}function h(){try{var t=e,r=t("vertx");return q=r.runOnLoop||r.runOnContext,u()}catch(n){return p()}}function y(e,t){var r=this,n=r._state;if(n===ie&&!e||n===ae&&!t)return this;var o=new this.constructor(v),i=r._result;if(n){var a=arguments[n-1];X(function(){F(n,o,a,i)})}else S(r,o,e,t);return o}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(v);return T(r,e),r}function v(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function E(e){try{return e.then}catch(t){return se.error=t,se}}function w(e,t,r,n){try{e.call(t,r,n)}catch(o){return o}}function _(e,t,r){X(function(e){var n=!1,o=w(r,t,function(r){n||(n=!0,t!==r?T(e,r):R(e,r))},function(t){n||(n=!0,x(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,x(e,o))},e)}function O(e,t){t._state===ie?R(e,t._result):t._state===ae?x(e,t._result):S(t,void 0,function(t){T(e,t)},function(t){x(e,t)})}function C(e,t,r){t.constructor===e.constructor&&r===re&&constructor.resolve===ne?O(e,t):r===se?x(e,se.error):void 0===r?R(e,t):i(r)?_(e,t,r):R(e,t)}function T(e,t){e===t?x(e,b()):o(t)?C(e,t,E(t)):R(e,t)}function j(e){e._onerror&&e._onerror(e._result),P(e)}function R(e,t){e._state===oe&&(e._result=t,e._state=ie,0!==e._subscribers.length&&X(P,e))}function x(e,t){e._state===oe&&(e._state=ae,e._result=t,X(j,e))}function S(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ie]=r,o[i+ae]=n,0===i&&e._state&&X(P,e)}function P(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,o,i=e._result,a=0;aa;a++)S(n.resolve(e[a]),void 0,t,r);return o}function M(e){var t=this,r=new t(v);return x(r,e),r}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function H(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function k(e){this._id=pe++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==e&&("function"!=typeof e&&U(),this instanceof k?I(this,e):H())}function B(e,t){this._instanceConstructor=e,this.promise=new e(v),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?R(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&R(this.promise,this._result))):x(this.promise,this._validationError())}function G(){var e;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(e.Promise=de)}var V;V=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var q,Q,z,K=V,J=0,X=function(e,t){te[J]=e,te[J+1]=t,J+=2,2===J&&(Q?Q(d):z())},Y="undefined"!=typeof window?window:void 0,$=Y||{},W=$.MutationObserver||$.WebKitMutationObserver,Z="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);z=Z?c():W?l():ee?f():void 0===Y&&"function"==typeof e?h():p();var re=y,ne=m,oe=void 0,ie=1,ae=2,se=new D,ce=new D,ue=N,le=L,fe=M,pe=0,de=k;k.all=ue,k.race=le,k.resolve=ne,k.reject=fe,k._setScheduler=a,k._setAsap=s,k._asap=X,k.prototype={constructor:k,then:re,"catch":function(e){return this.then(null,e)}};var he=B;B.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},B.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===oe&&e>r;r++)this._eachEntry(t[r],r)},B.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===ne){var o=E(e);if(o===re&&e._state!==oe)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===de){var i=new r(v);C(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){t(e)}),t)}else this._willSettleAt(n(e),t)},B.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===oe&&(this._remaining--,e===ae?x(n,r):this._result[t]=r),0===this._remaining&&R(n,this._result)},B.prototype._willSettleAt=function(e,t){var r=this;S(e,void 0,function(e){r._settledAt(ie,t,e)},function(e){r._settledAt(ae,t,e)})};var ye=G,me={Promise:de,polyfill:ye};"function"==typeof define&&define.amd?define(function(){return me}):"undefined"!=typeof t&&t.exports?t.exports=me:"undefined"!=typeof this&&(this.ES6Promise=me),ye()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:23}],25:[function(e,t,r){e("whatwg-fetch"),t.exports=self.fetch.bind(self)},{"whatwg-fetch":26}],26:[function(e,t,r){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function r(e){return"string"!=typeof e&&(e=String(e)),e}function n(e){this.map={},e instanceof n?e.forEach(function(e,t){this.append(t,e)},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function o(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function i(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function a(e){var t=new FileReader;return t.readAsArrayBuffer(e),i(t)}function s(e){var t=new FileReader;return t.readAsText(e),i(t)}function c(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(h.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(h.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!h.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},h.blob?(this.blob=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(a)},this.text=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return s(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var e=o(this);return e?e:Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}function l(e,t){t=t||{};var r=t.body;if(l.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new n(e.headers)),this.method=e.method,this.mode=e.mode,r||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new n(t.headers)),this.method=u(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function p(e){var t=new n,r=e.getAllResponseHeaders().trim().split("\n");return r.forEach(function(e){var r=e.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();t.append(n,o)}),t}function d(e,t){t||(t={}),this.type="default",this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof n?t.headers:new n(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){n.prototype.append=function(e,n){e=t(e),n=r(n);var o=this.map[e];o||(o=[],this.map[e]=o),o.push(n)},n.prototype["delete"]=function(e){delete this.map[t(e)]},n.prototype.get=function(e){var r=this.map[t(e)];return r?r[0]:null},n.prototype.getAll=function(e){return this.map[t(e)]||[]},n.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},n.prototype.set=function(e,n){this.map[t(e)]=[r(n)]},n.prototype.forEach=function(e,t){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){e.call(t,n,r,this)},this)},this)};var h={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this)},c.call(l.prototype),c.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new n(this.headers),url:this.url})},d.error=function(){var e=new d(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];d.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new d(null,{status:t,headers:{location:e}})},e.Headers=n,e.Request=l,e.Response=d,e.fetch=function(e,t){return new Promise(function(r,n){function o(){return"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0}var i;i=l.prototype.isPrototypeOf(e)&&!t?e:new l(e,t);var a=new XMLHttpRequest;a.onload=function(){var e=1223===a.status?204:a.status;if(100>e||e>599)return void n(new TypeError("Network request failed"));var t={status:e,statusText:a.statusText,headers:p(a),url:o()},i="response"in a?a.response:a.responseText;r(new d(i,t))},a.onerror=function(){n(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials&&(a.withCredentials=!0),"responseType"in a&&h.blob&&(a.responseType="blob"),i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],27:[function(e,t,r){"use strict";var n=e("./stringify"),o=e("./parse");t.exports={stringify:n,parse:o}},{"./parse":28,"./stringify":29}],28:[function(e,t,r){"use strict";var n=e("./utils"),o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};o.parseValues=function(e,t){for(var r={},o=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),i=0;i=0&&r.parseArrays&&s<=r.arrayLimit?(n=[],n[s]=o.parseObject(e,t,r)):n[a]=o.parseObject(e,t,r)}return n},o.parseKeys=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,i=/^([^\[\]]*)/,a=/(\[[^\[\]]*\])/g,s=i.exec(n),c=[];if(s[1]){if(!r.plainObjects&&Object.prototype.hasOwnProperty(s[1])&&!r.allowPrototypes)return;c.push(s[1])}for(var u=0;null!==(s=a.exec(n))&&ut;++t)e[t]="%"+((16>t?"0":"")+t.toString(16)).toUpperCase();return e}();r.arrayToObject=function(e,t){for(var r=t.plainObjects?Object.create(null):{},n=0;n=48&&57>=i||i>=65&&90>=i||i>=97&&122>=i?r+=t.charAt(o):128>i?r+=n[i]:2048>i?r+=n[192|i>>6]+n[128|63&i]:55296>i||i>=57344?r+=n[224|i>>12]+n[128|i>>6&63]+n[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(o)),r+=n[240|i>>18]+n[128|i>>12&63]+n[128|i>>6&63]+n[128|63&i])}return r},r.compact=function(e,t){if("object"!=typeof e||null===e)return e;var n=t||[],o=n.indexOf(e);if(-1!==o)return n[o];if(n.push(e),Array.isArray(e)){for(var i=[],a=0;aEdit

; } diff --git a/admin/javascript/src/sections/campaign-admin/item.js b/admin/javascript/src/sections/campaign-admin/item.js index 8ee05e458..a9167f992 100644 --- a/admin/javascript/src/sections/campaign-admin/item.js +++ b/admin/javascript/src/sections/campaign-admin/item.js @@ -1,5 +1,6 @@ import React from 'react'; import SilverStripeComponent from 'silverstripe-component'; +import i18n from 'i18n'; /** * Describes an individual campaign item @@ -7,23 +8,29 @@ import SilverStripeComponent from 'silverstripe-component'; class CampaignItem extends SilverStripeComponent { render() { let thumbnail = ''; - let badge = ''; + const badge = {}; const item = this.props.item; + // @todo customise these status messages for already-published changesets + // change badge switch (item.ChangeType) { case 'created': - badge = Draft; + badge.className = 'label label-warning'; + badge.Title = i18n._t('CampaignItem.DRAFT', 'Draft'); break; case 'modified': - badge = Modified; + badge.className = 'label label-warning'; + badge.Title = i18n._t('CampaignItem.MODIFIED', 'Modified'); break; case 'deleted': - badge = Removed; + badge.className = 'label label-error'; + badge.Title = i18n._t('CampaignItem.REMOVED', 'Removed'); break; case 'none': default: - badge = Already published; + badge.className = 'label label-success item_visible-hovered'; + badge.Title = i18n._t('CampaignItem.NO_CHANGES', 'No changes'); break; } @@ -41,7 +48,7 @@ class CampaignItem extends SilverStripeComponent { {thumbnail}

{item.Title}

{links} - {badge} + {badge.Title} ); } diff --git a/admin/javascript/src/sections/campaign-admin/preview.js b/admin/javascript/src/sections/campaign-admin/preview.js index e5e22c991..df21f5567 100644 --- a/admin/javascript/src/sections/campaign-admin/preview.js +++ b/admin/javascript/src/sections/campaign-admin/preview.js @@ -1,6 +1,9 @@ import React from 'react'; import SilverStripeComponent from 'silverstripe-component'; +/** + * Renders the right-hand collapsable change preview panel + */ class CampaignPreview extends SilverStripeComponent { render() {