diff --git a/passbook/admin/fields.py b/passbook/admin/fields.py
index b6749172a..7337c90c2 100644
--- a/passbook/admin/fields.py
+++ b/passbook/admin/fields.py
@@ -36,15 +36,15 @@ class CodeMirrorWidget(forms.Textarea):
# CodeMirror mode to enable
mode: str
+ template_name = "fields/codemirror.html"
+
def __init__(self, *args, mode="yaml", **kwargs):
super().__init__(*args, **kwargs)
self.mode = mode
def render(self, *args, **kwargs):
attrs = kwargs.setdefault("attrs", {})
- attrs.setdefault("class", "")
- attrs["class"] += " codemirror"
- attrs["data-cm-mode"] = self.mode
+ attrs["mode"] = self.mode
return super().render(*args, **kwargs)
diff --git a/passbook/admin/templates/administration/shell.html b/passbook/admin/templates/administration/shell.html
index e2e343a9b..3dbc25d3e 100644
--- a/passbook/admin/templates/administration/shell.html
+++ b/passbook/admin/templates/administration/shell.html
@@ -8,13 +8,8 @@
{% block head %}
{{ block.super }}
-
-
-
-
-
{% endblock %}
{% block page_content %}
diff --git a/passbook/admin/templates/fields/codemirror.html b/passbook/admin/templates/fields/codemirror.html
new file mode 100644
index 000000000..9df833a1f
--- /dev/null
+++ b/passbook/admin/templates/fields/codemirror.html
@@ -0,0 +1 @@
+
0;){const t=f[h],n=u.exec(t)[2],r=n.toLowerCase()+"$lit$",i=e.getAttribute(r);e.removeAttribute(r);const a=i.split(o);this.parts.push({type:"attribute",index:d,name:n,strings:a}),h+=a.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(r)>=0){const r=e.parentNode,i=t.split(o),a=i.length-1;for(let t=0;t{const n=e.length-t.length;return n>=0&&e.slice(n)===t},l=e=>-1!==e.index,c=()=>document.createComment(""),u=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function d(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,133,null,!1);let o=f(r),a=r[o],s=-1,l=0;const c=[];let u=null;for(;i.nextNode();){s++;const e=i.currentNode;for(e.previousSibling===u&&(u=null),t.has(e)&&(c.push(e),null===u&&(u=e)),null!==u&&l++;void 0!==a&&a.index===s;)a.index=null!==u?-1:a.index-l,o=f(r,o),a=r[o]}c.forEach((e=>e.parentNode.removeChild(e)))}const h=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},f=(e,t=-1)=>{for(let n=t+1;n 0;){const e=f[h],n=c.exec(e)[2],r=n.toLowerCase()+"$lit$",i=t.getAttribute(r);t.removeAttribute(r);const a=i.split(o);this.parts.push({type:"attribute",index:d,name:n,strings:a}),h+=a.length-1}}"TEMPLATE"===t.tagName&&(i.push(t),a.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(r)>=0){const r=t.parentNode,i=e.split(o),a=i.length-1;for(let e=0;e{const n=t.length-e.length;return n>=0&&t.slice(n)===e},l=t=>-1!==t.index,u=()=>document.createComment(""),c=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function d(t,e){const{element:{content:n},parts:r}=t,i=document.createTreeWalker(n,133,null,!1);let o=f(r),a=r[o],s=-1,l=0;const u=[];let c=null;for(;i.nextNode();){s++;const t=i.currentNode;for(t.previousSibling===c&&(c=null),e.has(t)&&(u.push(t),null===c&&(c=t)),null!==c&&l++;void 0!==a&&a.index===s;)a.index=null!==c?-1:a.index-l,o=f(r,o),a=r[o]}u.forEach((t=>t.parentNode.removeChild(t)))}const h=t=>{let e=11===t.nodeType?0:1;const n=document.createTreeWalker(t,133,null,!1);for(;n.nextNode();)e++;return e},f=(t,e=-1)=>{for(let n=e+1;n \n ${e.message}\n \n ${t.message}\n `}};e([Z()],oe.prototype,"url",void 0),e([Z()],oe.prototype,"messages",void 0),oe=e([$("pb-messages")],oe);const ae=["pf-m-progress","pf-m-in-progress"];let se=class extends ne{constructor(){var e;super(),this.url="",this.isRunning=!1,null===(e=this.querySelector("button"))||void 0===e||e.addEventListener("click",(e=>this.callAction()))}setLoading(){this.isRunning=!0,this.classList.add(...ae)}setDone(e){this.isRunning=!1,this.classList.remove(...ae),this.classList.replace("pf-m-primary",e),ie(),setTimeout((()=>{this.classList.replace(e,"pf-m-primary")}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const e=function(e){let t=null;if(document.cookie&&""!==document.cookie){const n=document.cookie.split(";");for(let r=0;r
`}};t([Z()],ot.prototype,"url",void 0),t([Z()],ot.prototype,"messages",void 0),ot=t([$("pb-messages")],ot);const at=["pf-m-progress","pf-m-in-progress"];let st=class extends nt{constructor(){var t;super(),this.url="",this.isRunning=!1,null===(t=this.querySelector("button"))||void 0===t||t.addEventListener("click",(t=>this.callAction()))}setLoading(){this.isRunning=!0,this.classList.add(...at)}setDone(t){this.isRunning=!1,this.classList.remove(...at),this.classList.replace("pf-m-primary",t),it(),setTimeout((()=>{this.classList.replace(t,"pf-m-primary")}),1e3)}callAction(){if(!0===this.isRunning)return;this.setLoading();const t=function(t){let e=null;if(document.cookie&&""!==document.cookie){const n=document.cookie.split(";");for(let r=0;r
=t[e].length&&t[e].push({}),!t[e][i].type||a.type&&a.type!==t[e][i].type?ae.merge(t[e][i],[wn.getScaleDefaults(o),a]):ae.merge(t[e][i],a)}else ae._merger(e,t,n,r)}})}function zn(){return ae.merge(Object.create(null),[].slice.call(arguments),{merger:function(e,t,n,r){var i=t[e]||Object.create(null),o=n[e];"scales"===e?t[e]=En(i,o):"scale"===e?t[e]=ae.merge(i,[wn.getScaleDefaults(o.type),o]):ae._merger(e,t,n,r)}})}function Hn(e){var t=(e=e||Object.create(null)).data=e.data||{};return t.datasets=t.datasets||[],t.labels=t.labels||[],e.options=zn(J.global,J[e.type],e.options||{}),e}function Bn(e){var t=e.options;ae.each(e.scales,(function(t){Ut.removeBox(e,t)})),t=zn(J.global,J[e.config.type],t),e.options=e.config.options=t,e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),e.tooltip._options=t.tooltips,e.tooltip.initialize()}function Vn(e,t,n){var r,i=function(e){return e.id===r};do{r=t+n++}while(ae.findIndex(e,i)>=0);return r}function Yn(e){return"top"===e||"bottom"===e}function Un(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}J._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var jn=function(e,t){return this.construct(e,t),this};ae.extend(jn.prototype,{construct:function(e,t){var n=this;t=Hn(t);var r=bn.acquireContext(e,t),i=r&&r.canvas,o=i&&i.height,a=i&&i.width;n.id=ae.uid(),n.ctx=r,n.canvas=i,n.config=t,n.width=a,n.height=o,n.aspectRatio=o?a/o:null,n.options=t.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,jn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(e){n.config.data=e}}),r&&i?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var e=this;return xn.notify(e,"beforeInit"),ae.retinaScale(e,e.options.devicePixelRatio),e.bindEvents(),e.options.responsive&&e.resize(!0),e.initToolTip(),xn.notify(e,"afterInit"),e},clear:function(){return ae.canvas.clear(this),this},stop:function(){return ve.cancelAnimation(this),this},resize:function(e){var t=this,n=t.options,r=t.canvas,i=n.maintainAspectRatio&&t.aspectRatio||null,o=Math.max(0,Math.floor(ae.getMaximumWidth(r))),a=Math.max(0,Math.floor(i?o/i:ae.getMaximumHeight(r)));if((t.width!==o||t.height!==a)&&(r.width=t.width=o,r.height=t.height=a,r.style.width=o+"px",r.style.height=a+"px",ae.retinaScale(t,n.devicePixelRatio),!e)){var s={width:o,height:a};xn.notify(t,"resize",[s]),n.onResize&&n.onResize(t,s),t.stop(),t.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var e=this.options,t=e.scales||{},n=e.scale;ae.each(t.xAxes,(function(e,n){e.id||(e.id=Vn(t.xAxes,"x-axis-",n))})),ae.each(t.yAxes,(function(e,n){e.id||(e.id=Vn(t.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var e=this,t=e.options,n=e.scales||{},r=[],i=Object.keys(n).reduce((function(e,t){return e[t]=!1,e}),{});t.scales&&(r=r.concat((t.scales.xAxes||[]).map((function(e){return{options:e,dtype:"category",dposition:"bottom"}})),(t.scales.yAxes||[]).map((function(e){return{options:e,dtype:"linear",dposition:"left"}})))),t.scale&&r.push({options:t.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),ae.each(r,(function(t){var r=t.options,o=r.id,a=Wn(r.type,t.dtype);Yn(r.position)!==Yn(t.dposition)&&(r.position=t.dposition),i[o]=!0;var s=null;if(o in n&&n[o].type===a)(s=n[o]).options=r,s.ctx=e.ctx,s.chart=e;else{var l=wn.getScaleConstructor(a);if(!l)return;s=new l({id:o,type:a,options:r,ctx:e.ctx,chart:e}),n[s.id]=s}s.mergeTicksOptions(),t.isDefault&&(e.scale=s)})),ae.each(i,(function(e,t){e||delete n[t]})),e.scales=n,wn.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e,t,n=this,r=[],i=n.data.datasets;for(e=0,t=i.length;e=0&&(a=e),void 0!==o&&(e=n.indexOf(o))>=0&&(s=e),t.minIndex=a,t.maxIndex=s,t.min=n[a],t.max=n[s]},buildTicks:function(){var e=this,t=e._getLabels(),n=e.minIndex,r=e.maxIndex;e.ticks=0===n&&r===t.length-1?t:t.slice(n,r+1)},getLabelForIndex:function(e,t){var n=this,r=n.chart;return r.getDatasetMeta(t).controller._getValueScaleId()===n.id?n.getRightValue(r.data.datasets[t].data[e]):n._getLabels()[e]},_configure:function(){var e=this,t=e.options.offset,n=e.ticks;vr.prototype._configure.call(e),e.isHorizontal()||(e._reversePixels=!e._reversePixels),n&&(e._startValue=e.minIndex-(t?.5:0),e._valueRange=Math.max(n.length-(t?0:1),1))},getPixelForValue:function(e,t,n){var r,i,o,a=this;return yr(t)||yr(n)||(e=a.chart.data.datasets[n].data[t]),yr(e)||(r=a.isHorizontal()?e.x:e.y),(void 0!==r||void 0!==e&&isNaN(t))&&(i=a._getLabels(),e=ae.valueOrDefault(r,e),t=-1!==(o=i.indexOf(e))?o:t,isNaN(t)&&(t=e)),a.getPixelForDecimal((t-a._startValue)/a._valueRange)},getPixelForTick:function(e){var t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e],e+this.minIndex)},getValueForPixel:function(e){var t=this,n=Math.round(t._startValue+t.getDecimalForPixel(e)*t._valueRange);return Math.min(Math.max(n,0),t.ticks.length-1)},getBasePixel:function(){return this.bottom}}),wr=br;xr._defaults=wr;var _r=ae.noop,kr=ae.isNullOrUndef;function Sr(e,t){var n,r,i,o,a=[],s=1e-14,l=e.stepSize,c=l||1,u=e.maxTicks-1,d=e.min,h=e.max,f=e.precision,p=t.min,g=t.max,m=ae.niceNum((g-p)/u/c)*c;if(mu&&(m=ae.niceNum(o*m/u/c)*c),l||kr(f)?n=Math.pow(10,ae._decimalPlaces(m)):(n=Math.pow(10,f),m=Math.ceil(m*n)/n),r=Math.floor(p/m)*m,i=Math.ceil(g/m)*m,l&&(!kr(d)&&ae.almostWhole(d/m,m/1e3)&&(r=d),!kr(h)&&ae.almostWhole(h/m,m/1e3)&&(i=h)),o=(i-r)/m,o=ae.almostEquals(o,Math.round(o),m/1e3)?Math.round(o):Math.ceil(o),r=Math.round(r*n)/n,i=Math.round(i*n)/n,a.push(kr(d)?r:d);for(var v=1;vo.r&&(o.r=u.end,a.r=l),d.start0&&r>0?n:0)},_drawGrid:function(){var e,t,n,r=this,i=r.ctx,o=r.options,a=o.gridLines,s=o.angleLines,l=Br(s.lineWidth,a.lineWidth),c=Br(s.color,a.color);if(o.pointLabels.display&&Jr(r),a.display&&ae.each(r.ticks,(function(e,n){0!==n&&(t=r.getDistanceFromCenterForValue(r.ticksAsNumbers[n]),Qr(r,a,t,n))})),s.display&&l&&c){for(i.save(),i.lineWidth=l,i.strokeStyle=c,i.setLineDash&&(i.setLineDash(Yr([s.borderDash,a.borderDash,[]])),i.lineDashOffset=Yr([s.borderDashOffset,a.borderDashOffset,0])),e=r.chart.data.labels.length-1;e>=0;e--)t=r.getDistanceFromCenterForValue(o.ticks.reverse?r.min:r.max),n=r.getPointPosition(e,t),i.beginPath(),i.moveTo(r.xCenter,r.yCenter),i.lineTo(n.x,n.y),i.stroke();i.restore()}},_drawLabels:function(){var e=this,t=e.ctx,n=e.options.ticks;if(n.display){var r,i,o=e.getIndexAngle(0),a=ae.options._parseFont(n),s=Br(n.fontColor,J.global.defaultFontColor);t.save(),t.font=a.string,t.translate(e.xCenter,e.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",ae.each(e.ticks,(function(o,l){(0!==l||n.reverse)&&(r=e.getDistanceFromCenterForValue(e.ticksAsNumbers[l]),n.showLabelBackdrop&&(i=t.measureText(o).width,t.fillStyle=n.backdropColor,t.fillRect(-i/2-n.backdropPaddingX,-r-a.size/2-n.backdropPaddingY,i+2*n.backdropPaddingX,a.size+2*n.backdropPaddingY)),t.fillStyle=s,t.fillText(o,0,-r))})),t.restore()}},_drawTitle:ae.noop}),ni=Ur;ti._defaults=ni;var ri=ae._deprecated,ii=ae.options.resolve,oi=ae.valueOrDefault,ai=Number.MIN_SAFE_INTEGER||-9007199254740991,si=Number.MAX_SAFE_INTEGER||9007199254740991,li={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ci=Object.keys(li);function ui(e,t){return e-t}function di(e){var t,n,r,i={},o=[];for(t=0,n=e.length;t1?di(p).sort(ui):p.sort(ui),h=Math.min(h,p[0]),f=Math.max(f,p[p.length-1])),h=yi(s,hi(u))||h,f=yi(s,fi(u))||f,h=h===si?+c.startOf(Date.now(),d):h,f=f===ai?+c.endOf(Date.now(),d)+1:f,s.min=Math.min(h,f),s.max=Math.max(h+1,f),s._table=[],s._timestamps={data:p,datasets:g,labels:m}},buildTicks:function(){var e,t,n,r=this,i=r.min,o=r.max,a=r.options,s=a.ticks,l=a.time,c=r._timestamps,u=[],d=r.getLabelCapacity(i),h=s.source,f=a.distribution;for(c="data"===h||"auto"===h&&"series"===f?c.data:"labels"===h?c.labels:_i(r,i,o,d),"ticks"===a.bounds&&c.length&&(i=c[0],o=c[c.length-1]),i=yi(r,hi(a))||i,o=yi(r,fi(a))||o,e=0,t=c.length;e=0;--n)(t=l[n].$filler)&&t.visible&&(i=(r=t.el)._view,o=r._children||[],a=t.mapper,s=i.backgroundColor||J.global.defaultColor,a&&s&&o.length&&(ae.canvas.clipArea(c,e.chartArea),Hi(c,o,a,i,s,r._loop),ae.canvas.unclipArea(c)))}},Vi=ae.rtl.getRtlAdapter,Yi=ae.noop,Ui=ae.valueOrDefault;function ji(e,t){return e.usePointStyle&&e.boxWidth>t?t:e.boxWidth}J._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(e,t){var n=t.datasetIndex,r=this.chart,i=r.getDatasetMeta(n);i.hidden=null===i.hidden?!r.data.datasets[n].hidden:null,r.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(e){var t=e.data.datasets,n=e.options.legend||{},r=n.labels&&n.labels.usePointStyle;return e._getSortedDatasetMetas().map((function(n){var i=n.controller.getStyle(r?0:void 0);return{text:t[n.index].label,fillStyle:i.backgroundColor,hidden:!e.isDatasetVisible(n.index),lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:i.borderWidth,strokeStyle:i.borderColor,pointStyle:i.pointStyle,rotation:i.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(e){var t,n,r,i=document.createElement("ul"),o=e.data.datasets;for(i.setAttribute("class",e.id+"-legend"),t=0,n=o.length;t\n Whoops!\n
\n \n Something went wrong! Please try again later.\n
\n ${e}
\n