system_settings 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/models/system_settings/configurator.rb +14 -5
- data/frontend/build/asset-manifest.json +3 -3
- data/frontend/build/index.html +1 -1
- data/frontend/build/{precache-manifest.0e020e029f3aadbe0b26621b84010585.js → precache-manifest.9a5e0d0daf376c08f5a7b80b49b88371.js} +6 -6
- data/frontend/build/service-worker.js +1 -1
- data/frontend/build/static/js/2.3891b1da.chunk.js +1 -0
- data/frontend/build/static/js/main.127b4c25.chunk.js +1 -0
- data/lib/system_settings/version.rb +1 -1
- data/lib/system_settings.rb +9 -1
- metadata +6 -7
- data/frontend/build/static/js/2.3fd64734.chunk.js +0 -1
- data/frontend/build/static/js/main.3240d6b4.chunk.js +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{115:function(e,t,a){e.exports={container:"NotFoundPage_container__2g6QR"}},117:function(e,t,a){},118:function(e,t,a){e.exports={container:"ButtonBar_container__phfXp"}},119:function(e,t,a){e.exports={wrap:"ClassicSpinner_wrap__3gt1R"}},121:function(e,t,a){e.exports=a(234)},193:function(e,t,a){},22:function(e,t,a){e.exports={table:"ListPage_table__3BJUy","empty-tr":"ListPage_empty-tr__Z37SG",name:"ListPage_name__3WwZr",description:"ListPage_description__31PRS",value:"ListPage_value__1VJLD",actions:"ListPage_actions__1GibV"}},233:function(e,t,a){},234:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),s=a(58),c=a(11),i=a(15),o=a(238),u=a(12),l=a(13),m=a.n(l),p=a(24),f=a(44),h=a(112),d=a.n(h),g=a(113);function E(e){var t=new d.a(window.__SYSTEM_SETTINGS_BASENAME__),a=Object(g.join)(t.pathname,"api",e);return t.set("pathname",a),t.href}function b(e,t){var a=new Promise(function(t){return window.setTimeout(function(){return t(e)},e)});return new Promise(function(e,n){t.then(function(t){return a.then(function(){return e(t)})},function(e){return a.then(function(){return n(e)})})})}var y="LIST_FETCH_IN_PROGRESS",v="LIST_FETCH_SUCCESSFUL",_="LIST_FETCH_FAILED",S=5;var j={fetching:!0,fetchErrorMessage:null,fetchSuccessful:null,page:0,items:[]},w=a(120),O="SETTING_FETCH_IN_PROGRESS",N="SETTING_FETCH_SUCCESSFUL",k="SETTING_FETCH_FAILED",T="SETTING_SAVE_IN_PROGRESS",C="SETTING_SAVE_SUCCESSFUL",x="SETTING_SAVE_FAILED";function M(e){return function(){var t=Object(p.a)(m.a.mark(function t(a){var n,r,s,c,i;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=E("settings/".concat(e)),t.prev=1,a({type:O}),t.next=5,b(50,f.a.get(n));case 5:if((r=t.sent).ok){t.next=8;break}throw new Error(r.statusText);case 8:return s=r.headers.get("Authenticity-Token"),t.next=11,r.json();case 11:c=t.sent,a({type:N,authenticityToken:s,attributes:c}),t.next=20;break;case 15:throw t.prev=15,t.t0=t.catch(1),i="HTTPError"===t.t0.name?"Network request status: ".concat(t.t0.response.status," ").concat(t.t0.message):t.t0.message,a({type:k,errorMessage:i}),t.t0;case 20:case"end":return t.stop()}},t,null,[[1,15]])}));return function(e){return t.apply(this,arguments)}}()}function L(e){return function(t){return t.headers.set("X-CSRF-Token",e)}}var I={attributes:{},authenticityToken:null,fetching:!0,fetchErrorMessage:null,fetchSuccessful:null,saving:!1,lastSaveSuccessful:null,saveErrorMessage:null},A=Object(c.b)({list:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case y:return Object(u.a)({},e,{fetching:!0});case v:return Object(u.a)({},e,{fetching:!1,fetchSuccessful:!0,items:t.data.map(function(e){return{id:e.id,type:e.type,name:e.name,value:e.value,description:e.description}}),page:t.page});case _:return Object(u.a)({},e,{fetching:!1,fetchSuccessful:!1,items:[],fetchErrorMessage:t.errorMessage,page:t.page});default:return e}},setting:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case O:return Object(u.a)({},e,{fetching:!0,fetchSuccessful:null,fetchErrorMessage:null});case N:return Object(u.a)({},e,{fetching:!1,fetchSuccessful:!0,attributes:t.attributes,authenticityToken:t.authenticityToken});case k:return Object(u.a)({},e,{fetching:!1,fetchSuccessful:!1,fetchErrorMessage:t.errorMessage});case T:return Object(u.a)({},e,{saving:!0,lastSaveSuccessful:null,saveErrorMessage:null});case C:return Object(u.a)({},e,{saving:!1,lastSaveSuccessful:!0});case x:return Object(u.a)({},e,{saving:!1,lastSaveSuccessful:!1,saveErrorMessage:t.errorMessage});default:return e}},form:o.a}),P=a(6),R=a(10),F=a(8),G=a(4),q=a(7),D=a(23),V=a(30),B=a(31),H=a.n(B),U=a(115),Y=a.n(U),z=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){return r.a.createElement("div",{className:Y.a.container},"Page not found")}}]),t}(n.Component),J=a(22),W=a.n(J),Z=a(47),Q=a.n(Z),X=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props.description;return r.a.createElement("div",{className:Q.a.wrap},r.a.createElement("div",{className:Q.a.container},r.a.createElement("div",{className:Q.a["error-large"]},"An error occurred while loading the page"),r.a.createElement("div",{className:Q.a["error-small"]},e)))}}]),t}(r.a.Component),K=(a(193),a(63)),$=a.n(K),ee=$.a.start,te=$.a.done,ae=($.a.inc,a(1)),ne=a.n(ae),re=a(64),se=a.n(re),ce=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"formattedValue",value:function(){var e=this.props,t=e.type,a=e.value;switch(t){case"SystemSettings::StringListSetting":case"SystemSettings::IntegerListSetting":return a?a.map(function(e,t){return r.a.createElement("span",{key:t,className:se.a.section},e.toString())}):null;default:return r.a.createElement("span",{className:se.a.section},a.toString())}}},{key:"render",value:function(){return r.a.createElement("span",{className:se.a.wrap},this.formattedValue())}}]),t}(r.a.Component),ie=(ne.a.string.isRequired,ne.a.any.isRequired,function(e){function t(){var e,a;Object(P.a)(this,t);for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return(a=Object(F.a)(this,(e=Object(G.a)(t)).call.apply(e,[this].concat(r)))).columnCount=4,a}return Object(q.a)(t,e),Object(R.a)(t,[{key:"componentDidMount",value:function(){this.props.fetch(1),ee()}},{key:"componentDidUpdate",value:function(e,t,a){!this.props.fetching&&e.fetching&&te()}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.list;return t?null:a?r.a.createElement("table",{className:W.a.table},r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",{className:W.a.name},"Name"),r.a.createElement("th",{className:W.a.description},"Description"),r.a.createElement("th",{className:W.a.value},"Value"),r.a.createElement("th",{className:W.a.actions}))),r.a.createElement("tbody",null,0===s.length&&r.a.createElement("tr",{className:W.a["empty-tr"]},r.a.createElement("td",{colSpan:this.columnCount},"No settings")),s.length>0&&s.map(function(e){return r.a.createElement("tr",{key:e.id},r.a.createElement("td",{className:W.a.name},r.a.createElement(D.b,{className:"sysname",to:"/settings/".concat(e.id)},e.name)),r.a.createElement("td",{className:W.a.description},e.description),r.a.createElement("td",{className:W.a.value},r.a.createElement(ce,{type:e.type,value:e.value})),r.a.createElement("td",{className:W.a.actions},r.a.createElement(D.b,{className:W.a["primary-action"],to:"/settings/".concat(e.id,"/edit")},"Edit")))}))):r.a.createElement(X,{description:n})}}]),t}(n.Component)),oe=Object(i.b)(function(e){return{page:e.list.page,list:e.list.items,fetching:e.list.fetching,fetchSuccessful:e.list.fetchSuccessful,fetchErrorMessage:e.list.fetchErrorMessage}},function(e){return{fetch:function(t){(function(e){return function(){var t=Object(p.a)(m.a.mark(function t(a){var n,r,s;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=E("settings"),t.prev=1,a({type:y}),t.next=5,b(50,f.a.get(n,{searchParams:{page:e,per:S}}).json());case 5:r=t.sent,a({type:v,data:r,page:e}),t.next=14;break;case 9:throw t.prev=9,t.t0=t.catch(1),s="HTTPError"===t.t0.name?"Network request status: ".concat(t.t0.response.status," ").concat(t.t0.message):t.t0.message,a({type:_,errorMessage:s,page:e}),t.t0;case 14:case"end":return t.stop()}},t,null,[[1,9]])}));return function(e){return t.apply(this,arguments)}}()})(t)(e).catch(function(){})}}})(ie),ue=";";function le(e){switch(e){case"SystemSettings::StringSetting":return"String";case"SystemSettings::StringListSetting":return"List of strings";case"SystemSettings::IntegerSetting":return"Integer";case"SystemSettings::IntegerListSetting":return"List of integers";case"SystemSettings::BooleanSetting":return"Boolean";default:return"Unknown"}}function me(e,t){switch(e){case"SystemSettings::StringListSetting":return t.map(function(e){return e&&e.replace?e.replace(ue,"\\".concat(ue)):""}).join(ue);case"SystemSettings::IntegerListSetting":return t?t.join(ue):t;case"SystemSettings::BooleanSetting":default:return t}}var pe=a(65),fe=a.n(pe),he=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props,t=e.name,a=e.children;return r.a.createElement("div",{className:fe.a.wrap},r.a.createElement("div",{className:fe.a.name},t),r.a.createElement("div",{className:fe.a.value},a))}}]),t}(n.PureComponent),de=(ne.a.string.isRequired,ne.a.any,a(117)),ge=a.n(de),Ee=a(118),be=a.n(Ee),ye=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props.children;return r.a.createElement("div",{className:be.a.container},e)}}]),t}(r.a.Component),ve=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"componentDidMount",value:function(){var e=this.props.match.params.id;ee(),this.props.fetch(e)}},{key:"componentDidUpdate",value:function(e,t,a){!this.props.fetching&&e.fetching&&te()}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.attributes,c=s.id,i=s.name,o=s.type,u=s.description,l=s.value;return t?null:a?r.a.createElement("div",{className:ge.a.wrap},r.a.createElement(he,{name:"Name"},r.a.createElement("span",{className:"sysname"},i)),r.a.createElement(he,{name:"Type",children:le(o)}),r.a.createElement(he,{name:"Description",children:u}),r.a.createElement(he,{name:"Value"},r.a.createElement(ce,{type:o,value:l})),r.a.createElement(ye,null,r.a.createElement(D.b,{className:"button primary",to:"/settings/".concat(c,"/edit")},"Edit"),r.a.createElement(D.b,{className:"button",to:"/"},"Back"))):r.a.createElement(X,{description:n})}}]),t}(n.Component),_e=Object(i.b)(function(e){return{attributes:e.setting.attributes,fetching:e.setting.fetching,fetchSuccessful:e.setting.fetchSuccessful,fetchErrorMessage:e.setting.fetchErrorMessage}},function(e,t){return{fetch:function(t){return M(t)(e)}}})(ve),Se=a(237),je=a(235),we=a(34),Oe=a.n(we),Ne=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props,t=e.id,a=e.type,n=e.label,s=e.hint,c=e.placeholder,i=e.input,o=e.meta,u=o.touched,l=o.error,m=Array.isArray(l)?l.join("; "):l;return r.a.createElement("div",{className:Oe.a.wrap},r.a.createElement("label",{className:Oe.a.label,htmlFor:t},n),r.a.createElement("div",{className:Oe.a["input-and-error-wrap"]},r.a.createElement("input",Object.assign({id:t,type:a,placeholder:c},i,{className:Oe.a.input,style:{width:"".concat(i.value.length,"ch")}})),u&&m&&r.a.createElement("span",{className:Oe.a.error},m)),s&&r.a.createElement("div",{className:Oe.a.hint},s))}}]),t}(r.a.Component);Ne.defaultProps={type:"text"};Object(u.a)({},je.a,{id:ne.a.string.isRequired,type:ne.a.string.isRequired,label:ne.a.string.isRequired,hint:ne.a.oneOfType([ne.a.string,ne.a.element]),placeholder:ne.a.string});var ke=a(48),Te=a.n(ke),Ce=a(62),xe=a(119),Me=a.n(xe),Le=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props,t=e.size,a=e.color,n=e.title,s=e.wrapperStyle,c=Object(Ce.a)(e,["size","color","title","wrapperStyle"]);return r.a.createElement("span",{className:Me.a.wrap,style:Object(u.a)({},s,{width:t,height:t})},r.a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg"},c,{width:t,height:t,viewBox:"0 0 64 64",fill:"none",stroke:a,"aria-labelledby":"title"}),r.a.createElement("title",{id:"title"},n),r.a.createElement("g",{strokeWidth:"4",strokeLinecap:"round"},r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(180)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0;1",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(210)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"0;1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(240)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".1;0;1;.85;.7;.65;.55;.45;.35;.25;.15;.1",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(270)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".15;.1;0;1;.85;.7;.65;.55;.45;.35;.25;.15",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(300)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".25;.15;.1;0;1;.85;.7;.65;.55;.45;.35;.25",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(330)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".35;.25;.15;.1;0;1;.85;.7;.65;.55;.45;.35",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(0)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".45;.35;.25;.15;.1;0;1;.85;.7;.65;.55;.45",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(30)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".55;.45;.35;.25;.15;.1;0;1;.85;.7;.65;.55",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(60)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".65;.55;.45;.35;.25;.15;.1;0;1;.85;.7;.65",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(90)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".7;.65;.55;.45;.35;.25;.15;.1;0;1;.85;.7",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(120)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".85;.7;.65;.55;.45;.35;.25;.15;.1;0;1;.85",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(150)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0;1",repeatCount:"indefinite"})))))}}]),t}(r.a.Component);Le.defaultProps={color:"currentColor",size:"1rem",title:"Loading\u2026"};var Ie=Le,Ae=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=this.props,t=e.hint,a=e.handleSubmit,n=e.myHandleSubmit,s=e.error,c=e.pristine,i=e.submitting,o=e.valueInputType;return r.a.createElement("form",{onSubmit:a(n)},r.a.createElement("div",{className:Te.a.fields},r.a.createElement(Se.a,{name:"value",label:"Value",id:"secret_value",type:o,component:Ne,hint:t})),s&&r.a.createElement("div",{className:Te.a["error-wrap"]},r.a.createElement("div",{className:Te.a["error-message"]},r.a.createElement("div",null,"An error occurred while saving the data"),r.a.createElement("div",{className:Te.a["error-small"]},"Network request status: ",s))),r.a.createElement(ye,null,r.a.createElement("button",{className:"primary",type:"submit",disabled:c||i},r.a.createElement("span",{className:"button-wrap"},r.a.createElement("span",{className:"button-text"},"Save"),i&&r.a.createElement(Ie,{wrapperStyle:{marginLeft:"5px"},size:"1.5em"}))),r.a.createElement(D.b,{className:"button",to:"/"},"Cancel")))}}]),t}(r.a.Component);Ae.defaultProps={};ne.a.number.isRequired,ne.a.string.isRequired,ne.a.string,ne.a.oneOfType([ne.a.string,ne.a.element]),ne.a.string.isRequired,ne.a.func.isRequired,ne.a.func.isRequired,ne.a.bool,ne.a.bool,ne.a.string,ne.a.object,ne.a.string;var Pe=a(236),Re=Object(i.b)(function(e){var t=e.setting,a=t.fetchSuccessful,n=t.attributes;return{initialValues:Object(u.a)({},n,{value:a?me(n.type,n.value):n.value})}},function(e,t){return{myHandleSubmit:function(a){return(n=t.id,r=t.authenticityToken,s={value:a.value},function(){var e=Object(p.a)(m.a.mark(function e(t){var a,c,i,o,u;return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=E("settings/".concat(n)),t({type:T}),e.prev=2,e.next=5,b(300,f.a.put(a,{json:s,hooks:{beforeRequest:[L(r)]}}));case 5:return c=e.sent,e.next=8,c.json();case 8:i=e.sent,t({type:C,attributes:i}),e.next=34;break;case 12:if(e.prev=12,e.t0=e.catch(2),t({type:x,errorMessage:e.t0.name}),"HTTPError"!==e.t0.name){e.next=33;break}if(422!==e.t0.response.status){e.next=29;break}return e.prev=17,e.next=20,e.t0.response.json();case 20:o=e.sent,e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(17),new w.a({_error:e.t0.message});case 26:throw new w.a(o.errors);case 29:throw u="".concat(e.t0.response.status," ").concat(e.t0.message),new w.a({_error:u});case 31:e.next=34;break;case 33:throw new w.a({_error:e.t0.message});case 34:case"end":return e.stop()}},e,null,[[2,12],[17,23]])}));return function(t){return e.apply(this,arguments)}}())(e);var n,r,s}}})(Object(Pe.a)({form:"edit-setting"})(Ae)),Fe=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"componentDidMount",value:function(){var e=this.props.match.params.id;ee(),this.props.fetch(e)}},{key:"componentDidUpdate",value:function(e,t,a){!this.props.fetching&&e.fetching&&te()}},{key:"hint",value:function(e){switch(e){case"SystemSettings::StringListSetting":case"SystemSettings::IntegerListSetting":return r.a.createElement(r.a.Fragment,null,"Separate values by ",r.a.createElement("code",null,";")," character.");default:return null}}},{key:"valueInputType",value:function(e){switch(e){case"SystemSettings::BooleanSetting":return"checkbox";default:return"text"}}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.authenticityToken,c=e.attributes,i=c.id,o=c.name,u=c.description,l=c.type;return t?null:a?r.a.createElement("div",null,r.a.createElement(he,{name:"Name"},r.a.createElement("span",{className:"sysname"},o)),r.a.createElement(he,{name:"Type"},le(l)),r.a.createElement(he,{name:"Description"},u),r.a.createElement(Re,{id:i,authenticityToken:s,hint:this.hint(l),valueInputType:this.valueInputType(l)})):r.a.createElement(X,{description:n})}}]),t}(n.Component),Ge=Object(i.b)(function(e){return{attributes:e.setting.attributes,authenticityToken:e.setting.authenticityToken,fetching:e.setting.fetching,fetchSuccessful:e.setting.fetchSuccessful,fetchErrorMessage:e.setting.fetchErrorMessage}},function(e){return{fetch:function(t){M(t)(e).catch(function(){})}}})(Fe),qe=function(e){function t(){return Object(P.a)(this,t),Object(F.a)(this,Object(G.a)(t).apply(this,arguments))}return Object(q.a)(t,e),Object(R.a)(t,[{key:"render",value:function(){var e=window.__SYSTEM_SETTINGS_BASENAME__;return r.a.createElement(D.a,{basename:e},r.a.createElement("div",{className:H.a.container},r.a.createElement("div",{className:H.a["header-wrap"]},r.a.createElement("div",{className:H.a.header},r.a.createElement(D.b,{to:"/",className:H.a["header-name"]},this.props.name))),r.a.createElement("div",{className:H.a["header-spacer"]}),r.a.createElement("div",{className:H.a["content-wrap"]},r.a.createElement("div",{className:H.a.content},r.a.createElement(V.c,null,r.a.createElement(V.a,{exact:!0,path:"/",component:oe}),r.a.createElement(V.a,{path:"/settings/:id/edit",component:Ge}),r.a.createElement(V.a,{path:"/settings/:id",component:_e}),r.a.createElement(V.a,{component:z}))))))}}]),t}(n.Component);qe.defaultProps={name:"System Settings"};var De=qe,Ve=(a(233),Object(c.c)(A)),Be=document.getElementById("root");window.__SYSTEM_SETTINGS_BASENAME__||(window.__SYSTEM_SETTINGS_BASENAME__="/system_settings"),Object(s.render)(r.a.createElement(i.a,{store:Ve},r.a.createElement(De,null)),Be)},31:function(e,t,a){e.exports={container:"App_container__6j1zw","header-wrap":"App_header-wrap__3CTKH",header:"App_header__14Wxn","header-name":"App_header-name__XmVJQ","header-spacer":"App_header-spacer__2nhtg","content-wrap":"App_content-wrap__V8jPR",content:"App_content__1dlDM"}},34:function(e,t,a){e.exports={wrap:"LabeledInput_wrap__29803",label:"LabeledInput_label__3s0me","input-and-error-wrap":"LabeledInput_input-and-error-wrap__1WE7-",error:"LabeledInput_error__3HfEM",hint:"LabeledInput_hint__1uKYN"}},47:function(e,t,a){e.exports={wrap:"PageLoadError_wrap__2WGP9",container:"PageLoadError_container__1vEsn","error-small":"PageLoadError_error-small__243N5"}},48:function(e,t,a){e.exports={"error-wrap":"SettingForm_error-wrap__2mrUQ","error-message":"SettingForm_error-message__2SoFD","error-small":"SettingForm_error-small__2DqG8"}},64:function(e,t,a){e.exports={wrap:"Value_wrap__uZ29f",section:"Value_section__36uaM"}},65:function(e,t,a){e.exports={wrap:"Attribute_wrap__3nYMg",name:"Attribute_name__2w8Tg",value:"Attribute_value__3P12Z"}}},[[121,1,2]]]);
|
data/lib/system_settings.rb
CHANGED
@@ -7,7 +7,15 @@ module SystemSettings
|
|
7
7
|
|
8
8
|
def self.[](name)
|
9
9
|
instrument("system_settings.find", name: name) do |payload|
|
10
|
-
record = Setting.find_by(name: name)
|
10
|
+
record = Setting.find_by(name: name)
|
11
|
+
unless record
|
12
|
+
message = "Couldn't find system setting #{name}\n\n"
|
13
|
+
message << "It might not be loaded from settings file(#{settings_file_path}).\n"
|
14
|
+
message << "To load missing settings with their initial values you "
|
15
|
+
message << "can call SystemSettings.load from your Rails environment or run Rails task:\n\n"
|
16
|
+
message << " bin/rails system_settings:load RAILS_ENV=#{::Rails.env}"
|
17
|
+
raise(Errors::NotFoundError, message)
|
18
|
+
end
|
11
19
|
payload[:value] = record.value
|
12
20
|
end
|
13
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: system_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krists Ozols
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -59,11 +59,11 @@ files:
|
|
59
59
|
- frontend/build/asset-manifest.json
|
60
60
|
- frontend/build/favicon.ico
|
61
61
|
- frontend/build/index.html
|
62
|
-
- frontend/build/precache-manifest.
|
62
|
+
- frontend/build/precache-manifest.9a5e0d0daf376c08f5a7b80b49b88371.js
|
63
63
|
- frontend/build/service-worker.js
|
64
64
|
- frontend/build/static/css/main.92b62519.chunk.css
|
65
|
-
- frontend/build/static/js/2.
|
66
|
-
- frontend/build/static/js/main.
|
65
|
+
- frontend/build/static/js/2.3891b1da.chunk.js
|
66
|
+
- frontend/build/static/js/main.127b4c25.chunk.js
|
67
67
|
- frontend/build/static/js/runtime~main.a09e9b82.js
|
68
68
|
- lib/system_settings.rb
|
69
69
|
- lib/system_settings/engine.rb
|
@@ -88,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
|
92
|
-
rubygems_version: 2.6.14.4
|
91
|
+
rubygems_version: 3.0.3
|
93
92
|
signing_key:
|
94
93
|
specification_version: 4
|
95
94
|
summary: Settings for your Rails application
|