You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
399 KiB
13 lines
399 KiB
3 years ago
|
!function(e,t){var n=!0;e&&"undefined"!=typeof e.umd&&(n=e.umd),n&&"object"==typeof exports?module.exports=t(require("jquery"),require("handlebars"),require("bootstrap")):n&&"function"==typeof define&&define.amd?define("alpaca",["jquery","handlebars","bootstrap"],t):e.Alpaca=t(e.jQuery,e.Handlebars,e.Bootstrap)}(this,function($,Handlebars,Bootstrap){return this.HandlebarsPrecompiled=this.HandlebarsPrecompiled||{},this.HandlebarsPrecompiled["web-display"]=this.HandlebarsPrecompiled["web-display"]||{},this.HandlebarsPrecompiled["web-display"]["container-array-item"]=Handlebars.template({1:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s='<script type="text/x-handlebars-template">\n\n <div>\n ';return o=null!=(o=n.itemField||(null!=t?t.itemField:t))?o:n.helperMissing,l={name:"itemField",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.itemField||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n </div>\n\n</script>\n"},useData:!0}),this.HandlebarsPrecompiled["web-display"]["container-array"]=Handlebars.template({1:function(e,t,n,i,a){var r,o,l,s="\n ";return o=null!=(o=n.item||(null!=t?t.item:t))?o:n.helperMissing,l={name:"item",hash:{},fn:e.program(2,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.item||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n\n"},2:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r;return'<script type="text/x-handlebars-template">\n\n <div>\n\n'+(null!=(r=n.each.call(null!=t?t:{},null!=t?t.items:t,{name:"each",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["web-display"]["container-object-item"]=Handlebars.template({1:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s='<script type="text/x-handlebars-template">\n\n <div>\n ';return o=null!=(o=n.itemField||(null!=t?t.itemField:t))?o:n.helperMissing,l={name:"itemField",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.itemField||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n </div>\n\n</script>\n"},useData:!0}),this.HandlebarsPrecompiled["web-display"]["container-object"]=Handlebars.template({1:function(e,t,n,i,a){var r,o,l,s="\n ";return o=null!=(o=n.item||(null!=t?t.item:t))?o:n.helperMissing,l={name:"item",hash:{},fn:e.program(2,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.item||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n\n"},2:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r;return'<script type="text/x-handlebars-template">\n\n <div>\n\n'+(null!=(r=n.each.call(null!=t?t:{},null!=t?t.items:t,{name:"each",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["web-display"]["container-table-item"]=Handlebars.template({1:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r;return'<script type="text/x-handlebars-template">\n\n <tr>\n '+(null!=(r=(n.itemField||t&&t.itemField||n.helperMissing).call(null!=t?t:{},"td",{name:"itemField",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n </tr>\n\n\n</script>\n"},useData:!0}),this.HandlebarsPrecompiled["web-display"]["container-table"]=Handlebars.template({1:function(e,t,n,i,a){return""},3:function(e,t,n,i,a){var r;return" <th>"+e.escapeExpression(e.lambda(null!=(r=null!=t?t.value:t)?r.title:r,t))+"</th>\n"},5:function(e,t,n,i,a){var r;return"\n "+(null!=(r=(n.item||t&&t.item||n.helperMissing).call(null!=t?t:{},"tr",{name:"item",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s=null!=t?t:{},u=n.helperMissing,c='<script type="text/x-handlebars-template">\n\n <div>\n\n ';
|
||
|
name:"each",hash:{},fn:e.program(10,a,0),inverse:e.noop,data:a}))?r:"")+" </tbody>\n\n </table>\n\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["web-edit"]["container-tablerow-item"]=Handlebars.template({1:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s='<script type="text/x-handlebars-template">\n\n <td>\n ';return o=null!=(o=n.itemField||(null!=t?t.itemField:t))?o:n.helperMissing,l={name:"itemField",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.itemField||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n </td>\n\n</script>\n"},useData:!0}),this.HandlebarsPrecompiled["web-edit"]["container-tablerow"]=Handlebars.template({1:function(e,t,n,i,a){return'\n <!-- hidden sort order column -->\n <div class="alpaca-table-reorder-index-cell"></div>\n\n <!-- reorder draggable -->\n <div class="alpaca-table-reorder-draggable-cell">\n <i class="glyphicon glyphicon-menu-hamburger"></i>\n </div>\n'},3:function(e,t,n,i,a){var r;return null!=(r=n["if"].call(null!=t?t:{},null!=t?t.hidden:t,{name:"if",hash:{},fn:e.program(4,a,0),inverse:e.program(6,a,0),data:a}))?r:""},4:function(e,t,n,i,a){return""},6:function(e,t,n,i,a){var r,o,l,s=" ";return o=null!=(o=n.item||(null!=t?t.item:t))?o:n.helperMissing,l={name:"item",hash:{},fn:e.program(4,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.item||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n"},8:function(e,t,n,i,a){var r,o,l,s=' <div class="alpaca-merge-up">\n ';return o=null!=(o=n.arrayActionbar||(null!=t?t.arrayActionbar:t))?o:n.helperMissing,l={name:"arrayActionbar",hash:{},fn:e.program(4,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(null!=t?t:{},l):o,n.arrayActionbar||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(s+=r),s+"\n </div>\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o=null!=t?t:{};return'<script type="text/x-handlebars-template">\n\n <div class="alpaca-merge-up">\n\n <!-- drag cell -->\n'+(null!=(r=n["if"].call(o,null!=(r=null!=t?t.options:t)?r.dragRows:r,{name:"if",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n"+(null!=(r=n.each.call(o,null!=t?t.items:t,{name:"each",hash:{},fn:e.program(3,a,0),inverse:e.noop,data:a}))?r:"")+"\n <!-- actions cell -->\n"+(null!=(r=n["if"].call(o,null!=(r=null!=t?t.options:t)?r.showActionsColumn:r,{name:"if",hash:{},fn:e.program(8,a,0),inverse:e.noop,data:a}))?r:"")+"\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["web-edit"].container=Handlebars.template({1:function(e,t,n,i,a){var r;return' <legend class="'+(null!=(r=n["if"].call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.labelClass:r,{name:"if",hash:{},fn:e.program(2,a,0),inverse:e.noop,data:a}))?r:"")+' alpaca-container-label">'+(null!=(r=e.lambda(null!=(r=null!=t?t.options:t)?r.label:r,t))?r:"")+"</legend>\n"},2:function(e,t,n,i,a){var r;return e.escapeExpression(e.lambda(null!=(r=null!=t?t.options:t)?r.labelClass:r,t))},4:function(e,t,n,i,a){var r;return null!=(r=n.each.call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.helpers:r,{name:"each",hash:{},fn:e.program(5,a,0),inverse:e.noop,data:a}))?r:""},5:function(e,t,n,i,a){var r;return' <p class="alpaca-helper '+(null!=(r=n["if"].call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.helperClass:r,{name:"if",hash:{},fn:e.program(6,a,0),inverse:e.noop,data:a}))?r:"")+'">\n <i class="alpaca-icon-helper"></i>\n '+(null!=(r=e.lambda(t,t))?r:"")+"\n </p>\n"},6:function(e,t,n,i,a){var r;return e.escapeExpression(e.lambda(null!=(r=null!=t?t.options:t)?r.helperClass:r,t))},8:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s=null!=t?t:{},u='<script type="text/x-handlebars-template">\n\n <div>\n\n'+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.label:r,{name:"if",has
|
||
|
var r;return' <div class="alpaca-control-buttons-container">\n'+(null!=(r=n.each.call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.buttons:r,{name:"each",hash:{},fn:e.program(12,a,0),inverse:e.noop,data:a}))?r:"")+" </div>\n"},12:function(e,t,n,i,a){var r,o,l=null!=t?t:{},s=n.helperMissing,u="function",c=e.escapeExpression;return' <button data-key="'+c((o=null!=(o=n.key||a&&a.key)?o:s,typeof o===u?o.call(l,{name:"key",hash:{},data:a}):o))+'" type="'+c((o=null!=(o=n.type||(null!=t?t.type:t))?o:s,typeof o===u?o.call(l,{name:"type",hash:{},data:a}):o))+'" class="alpaca-control-button alpaca-control-button-'+c((o=null!=(o=n.key||a&&a.key)?o:s,typeof o===u?o.call(l,{name:"key",hash:{},data:a}):o))+" "+c((o=null!=(o=n.styles||(null!=t?t.styles:t))?o:s,typeof o===u?o.call(l,{name:"styles",hash:{},data:a}):o))+'" '+(null!=(r=n.each.call(l,null!=t?t.value:t,{name:"each",hash:{},fn:e.program(13,a,0),inverse:e.noop,data:a}))?r:"")+">"+(null!=(o=null!=(o=n.value||(null!=t?t.value:t))?o:s,r=typeof o===u?o.call(l,{name:"value",hash:{},data:a}):o)?r:"")+"</button>\n"},13:function(e,t,n,i,a){var r,o=null!=t?t:{},l=n.helperMissing,s="function",u=e.escapeExpression;return u((r=null!=(r=n.key||a&&a.key)?r:l,typeof r===s?r.call(o,{name:"key",hash:{},data:a}):r))+'="'+u((r=null!=(r=n.value||(null!=t?t.value:t))?r:l,typeof r===s?r.call(o,{name:"value",hash:{},data:a}):r))+'" '},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s=null!=t?t:{},u='<script type="text/x-handlebars-template">\n\n <div>\n\n'+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.label:r,{name:"if",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n ";return o=null!=(o=n.control||(null!=t?t.control:t))?o:n.helperMissing,l={name:"control",hash:{},fn:e.program(4,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(s,l):o,n.control||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(u+=r),u+"\n\n"+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.helpers:r,{name:"if",hash:{},fn:e.program(6,a,0),inverse:e.noop,data:a}))?r:"")+"\n"+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.renderButtons:r,{name:"if",hash:{},fn:e.program(10,a,0),inverse:e.noop,data:a}))?r:"")+"\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["web-edit"].form=Handlebars.template({1:function(e,t,n,i,a){return""},3:function(e,t,n,i,a){var r;return null!=(r=n.each.call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.buttons:r,{name:"each",hash:{},fn:e.program(4,a,0),inverse:e.noop,data:a}))?r:""},4:function(e,t,n,i,a){var r,o,l=null!=t?t:{},s=n.helperMissing,u="function",c=e.escapeExpression;return' <button data-key="'+c((o=null!=(o=n.key||a&&a.key)?o:s,typeof o===u?o.call(l,{name:"key",hash:{},data:a}):o))+'" type="'+c((o=null!=(o=n.type||(null!=t?t.type:t))?o:s,typeof o===u?o.call(l,{name:"type",hash:{},data:a}):o))+'" '+(null!=(r=n["if"].call(l,null!=t?t.id:t,{name:"if",hash:{},fn:e.program(5,a,0),inverse:e.noop,data:a}))?r:"")+' class="alpaca-form-button alpaca-form-button-'+c((o=null!=(o=n.key||a&&a.key)?o:s,typeof o===u?o.call(l,{name:"key",hash:{},data:a}):o))+" "+c((o=null!=(o=n.styles||(null!=t?t.styles:t))?o:s,typeof o===u?o.call(l,{name:"styles",hash:{},data:a}):o))+'" '+(null!=(r=n.each.call(l,null!=t?t.value:t,{name:"each",hash:{},fn:e.program(7,a,0),inverse:e.noop,data:a}))?r:"")+" "+(null!=(r=n.each.call(l,null!=t?t.attributes:t,{name:"each",hash:{},fn:e.program(9,a,0),inverse:e.noop,data:a}))?r:"")+">"+(null!=(o=null!=(o=n.value||(null!=t?t.value:t))?o:s,r=typeof o===u?o.call(l,{name:"value",hash:{},data:a}):o)?r:"")+"</button>\n"},5:function(e,t,n,i,a){var r;return'id="'+e.escapeExpression((r=null!=(r=n.id||(null!=t?t.id:t))?r:n.helperMissing,"function"==typeof r?r.call(null!=t?t:{},{name:"id",hash:{},data:a}):r))+'"'},7:function(e,t,n,i,a){var r,o=e.escapeExpression;return o((r=null!=(r=n.key||a&&a.key)?r:n.helperMissing,"function"==typeof r?r.call(null!=t?t:{},{name:"key",hash:{},data:a}):r))+'="'+o(e.lambda(t,t))+'"'},9:function(e,t,n,i,a){var r,o=e.escapeExpressio
|
||
|
},10:function(e,t,n,i,a){var r;return"\n "+(null!=(r=(n.item||t&&t.item||n.helperMissing).call(null!=t?t:{},"tr",{name:"item",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s=null!=t?t:{},u='<script type="text/x-handlebars-template">\n\n <div class="table-responsive">\n\n ';return o=null!=(o=n.arrayToolbar||(null!=t?t.arrayToolbar:t))?o:n.helperMissing,l={name:"arrayToolbar",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(s,l):o,n.arrayToolbar||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(u+=r),u+"\n\n <table>\n\n <!-- table headers -->\n <thead>\n <tr>\n\n"+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.dragRows:r,{name:"if",hash:{},fn:e.program(3,a,0),inverse:e.noop,data:a}))?r:"")+"\n"+(null!=(r=n.each.call(s,null!=t?t.headers:t,{name:"each",hash:{},fn:e.program(5,a,0),inverse:e.noop,data:a}))?r:"")+"\n"+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.showActionsColumn:r,{name:"if",hash:{},fn:e.program(8,a,0),inverse:e.noop,data:a}))?r:"")+" </tr>\n </thead>\n\n <!-- table body -->\n <tbody>\n"+(null!=(r=n.each.call(s,null!=t?t.items:t,{name:"each",hash:{},fn:e.program(10,a,0),inverse:e.noop,data:a}))?r:"")+" </tbody>\n\n </table>\n\n </div>\n\n</script>"},useData:!0}),this.HandlebarsPrecompiled["bootstrap-edit"].container=Handlebars.template({1:function(e,t,n,i,a){var r,o=null!=t?t:{};return' <legend class="'+(null!=(r=n["if"].call(o,null!=(r=null!=t?t.options:t)?r.labelClass:r,{name:"if",hash:{},fn:e.program(2,a,0),inverse:e.noop,data:a}))?r:"")+'alpaca-container-label">\n\n'+(null!=(r=n["if"].call(o,null!=(r=null!=t?t.options:t)?r.collapsible:r,{name:"if",hash:{},fn:e.program(4,a,0),inverse:e.noop,data:a}))?r:"")+"\n "+(null!=(r=e.lambda(null!=(r=null!=t?t.options:t)?r.label:r,t))?r:"")+"\n\n"+(null!=(r=n["if"].call(o,null!=(r=null!=t?t.options:t)?r.collapsible:r,{name:"if",hash:{},fn:e.program(6,a,0),inverse:e.noop,data:a}))?r:"")+"\n </legend>\n"},2:function(e,t,n,i,a){var r;return e.escapeExpression(e.lambda(null!=(r=null!=t?t.options:t)?r.labelClass:r,t))+" "},4:function(e,t,n,i,a){return' <span data-toggle="collapse">\n'},6:function(e,t,n,i,a){return" </span>\n"},8:function(e,t,n,i,a){var r;return null!=(r=n.each.call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.helpers:r,{name:"each",hash:{},fn:e.program(9,a,0),inverse:e.noop,data:a}))?r:""},9:function(e,t,n,i,a){var r;return' <p class="alpaca-helper help-block '+(null!=(r=n["if"].call(null!=t?t:{},null!=(r=null!=t?t.options:t)?r.helperClass:r,{name:"if",hash:{},fn:e.program(10,a,0),inverse:e.noop,data:a}))?r:"")+'">\n <i class="alpaca-icon-16 glyphicon glyphicon-info-sign"></i>\n '+(null!=(r=e.lambda(t,t))?r:"")+"\n </p>\n"},10:function(e,t,n,i,a){var r;return e.escapeExpression(e.lambda(null!=(r=null!=t?t.options:t)?r.helperClass:r,t))},12:function(e,t,n,i,a){return""},compiler:[7,">= 4.0.0"],main:function(e,t,n,i,a){var r,o,l,s=null!=t?t:{},u='<script type="text/x-handlebars-template">\n\n <div>\n\n'+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.label:r,{name:"if",hash:{},fn:e.program(1,a,0),inverse:e.noop,data:a}))?r:"")+"\n"+(null!=(r=n["if"].call(s,null!=(r=null!=t?t.options:t)?r.helpers:r,{name:"if",hash:{},fn:e.program(8,a,0),inverse:e.noop,data:a}))?r:"")+"\n ";return o=null!=(o=n.container||(null!=t?t.container:t))?o:n.helperMissing,l={name:"container",hash:{},fn:e.program(12,a,0),inverse:e.noop,data:a},r="function"==typeof o?o.call(s,l):o,n.container||(r=n.blockHelperMissing.call(t,r,l)),null!=r&&(u+=r),u+"\n\n </div>\n\n</script>\n"},useData:!0}),this.HandlebarsPrecompiled["bootstrap-edit"]["control-upload-partial-download"]=Handlebars.template({1:function(e,t,n,i,a){var r,o=e.lambda,l=e.escapeExpression;return' <td></td>\n <td class="name">\n <span>'
|
||
|
}return i},testRegex:function(e,t){var n=new RegExp(e);return n.test(t)},isValEmpty:function(n,i){var a=!1;return t.isEmpty(n,i)?a=!0:(t.isString(n)&&""===n&&(a=!0),t.isObject(n)&&e.isEmptyObject(n)&&(a=!0),t.isArray(n)&&0===n.length&&(a=!0)),a},init:function(e,n,i,a,r,o,l,s,u,c){var d=this;if(t.isObject(r)){var p=r.id;p||(r.id=this.generateViewId());var h=r.parent;h||(r.parent="bootstrap-edit"),this.registerView(r),r=r.id}this.compile(function(p){if(p.errors&&p.errors.length>0){for(var h=[],f=0;f<p.errors.length;f++){var m=p.errors[f].view,g=p.errors[f].cacheKey,v=p.errors[f].err,b="The template with cache key: "+g+" for view: "+m+" failed to compile";v&&v.message&&(b+=", message: "+v.message,h.push(v.message)),v&&(b+=", err: "+JSON.stringify(v)),t.logError(b),delete d.normalizedViews[m],delete d.views[m]}return t.throwErrorWithCallback("View compilation failed, cannot initialize Alpaca. "+h.join(", "),c)}d._init(e,n,i,a,r,o,l,s,u,c)},c)},_init:function(n,i,a,r,o,l,s,u,c,d){var p=this,h=t.defaultView||null,f=null;e.mobile&&!h&&(h="jquerymobile");var m="function"==typeof e.fn.modal;m&&!h&&(h="bootstrap");var g="undefined"!=typeof e.ui;if(g&&!h&&(h="jqueryui"),h&&(f=i?"edit":"create"),!o){var v=l.ui,b=l.type;v||(h||(h=t.defaultUI),h&&(v=h)),v&&(b||(b=f?f:"edit"),t.logDebug("No view provided but found request for UI: "+v+" and type: "+b),o=this.lookupNormalizedView(v,b),o?t.logDebug("Found view: "+o):t.logDebug("No view found for UI: "+v+" and type: "+b))}if(!o)return t.throwErrorWithCallback("A view was not specified and could not be automatically determined.",d);if(t.isString(o)&&!this.normalizedViews[o])return t.throwErrorWithCallback("The desired view: "+o+" could not be loaded. Please make sure it is loaded and not misspelled.",d);var y=t.createFieldInstance(n,i,a,r,o,c,d);if(y){e(n).addClass("alpaca-field-rendering"),e(n).addClass("alpaca-hidden"),t.fieldInstances[y.getId()]=y,y.allFieldInstances=function(){return t.fieldInstances},t.isEmpty(s)&&(s=y.view.render),t.isEmpty(u)&&(u=y.view.postRender);var w=function(){y.parent||y.getFieldEl().addClass("alpaca-"+p.getNormalizedView(o).type),y.parent||y.getFieldEl().addClass("alpaca-top"),e(n).removeClass("alpaca-field-rendering"),e(n).removeClass("alpaca-hidden"),y._oldFieldEl&&e(y._oldFieldEl).remove(),u(y)};t.isEmpty(s)?y.render(function(){w()}):s(y,function(){w()}),y.callback=s,y.renderedCallback=u}},createFieldInstance:function(e,n,i,a,r,o,l){if(t.isValEmpty(i,!0)&&(i={}),t.isValEmpty(a,!0)&&(a={}),i&&t.isString(i)){var s=i;i={},i.type=s}i.type||(a.type||(a.type=t.getSchemaType(n)),a.type||(n&&t.isArray(n)?a.type="array":a.type="object"),i.type=t.guessOptionsType(a));var u=t.getFieldClass(i.type);return u?new u(e,n,i,a,r,o,l):(l({message:"Unable to find field class for type: "+i.type,reason:"FIELD_INSTANTIATION_ERROR"}),null)},parseJSON:function(t){return t?e.parseJSON(t):null},compile:function(n,i){var a=this,r={errors:[],count:0,successCount:0},o=function(e){if(0===r.errors.length)for(var t in e)a.normalizedViews[t]=e[t];n(r)},l=function(e,t,n,i,a){var l=n.id;r.count++,t?r.errors.push({view:l,cacheKey:i,err:t}):r.successCount++,r.count==a&&o(e)},s=function(n,i,a,r,o,s,u){var c=t.makeCacheKey(i.id,a,r,o),d="text/x-handlebars-template";if(s&&t.isObject(s)&&(d=s.type,s.cacheKey&&(c=s.cacheKey),s=s.template),s&&"string"==typeof s){var p=s.toLowerCase();if(t.isUri(p));else if(!s||0!==s.indexOf("#")&&0!==s.indexOf(".")){if(s){var h=i.templates[s];h&&(s=h)}}else{var f=e(s);d=e(f).attr("type"),s=e(f).html()}}if(!d){t.logError("Engine type was empty");var m=new Error("Engine type was empty");return void l(n,m,i,c,u)}var g=t.TemplateEngineRegistry.find(d);if(!g){t.logError("Cannot find template engine for type: "+type);var m=new Error("Cannot find template engine for type: "+type);return void l(n,m,i,c,u)}if(s===!0){if(g.isCached(c))return void l(n,null,i,c,u);var v="View configuration for view: "+i.id+" claims to have precompiled template for cacheKey: "+c+" but it could not be found";return t.logError(v),void l(n,new Error(v),i,c,u)}return g.isCached(c)?void l(n,null,i,c
|
||
|
t.ScopedObservables.get=function(e){return t.ScopedObservables.map[e]||(t.ScopedObservables.map[e]=new t.Observables(e)),t.ScopedObservables.map[e]}}(jQuery),function(){Alpaca.TemplateEngineRegistry=function(){var e={};return{register:function(t,n){e[t]=n,n.init()},find:function(t){var n=null;if(e[t])n=e[t];else for(var i in e)for(var a=e[i].supportedMimetypes(),r=0;r<a.length;r++)if(t.toLowerCase()===a[r].toLowerCase()){n=e[i];break}return n},ids:function(){var t=[];for(var n in e)t.push(n);return t}}}()}(),function(e){Alpaca.AbstractTemplateEngine=Base.extend({constructor:function(t){this.base(),this.id=t,this.cleanup=function(t){return t&&1===e(t).length&&"script"===e(t)[0].nodeName.toLowerCase()?e(t).html():t}},compile:function(t,n,i){var a=this,r="html";if(Alpaca.isString(n)){var o=n.toLowerCase();Alpaca.isUri(o)?r="uri":0!==n.indexOf("#")&&0!==n.indexOf(".")&&0!==n.indexOf("[")||(r="selector")}if("selector"===r)a._compile(t,n,function(e){i(e)});else if("uri"===r){var l=a.fileExtension(),s=n;-1===s.indexOf("."+l)&&(s+="."+l),e.ajax({url:s,dataType:"html",success:function(e,n,r){e=a.cleanup(e),a._compile(t,e,function(e){i(e)})},error:function(e,t){i({message:e.responseText,xhr:e,code:t},null)}})}else if("html"===r){var u=n;u instanceof jQuery&&(u=e(u).outerHTML()),a._compile(t,u,function(e){i(e)})}else i(new Error("Template engine cannot determine how to handle type: "+r))},_compile:function(e,t,n){Alpaca.isEmpty(t)&&(t=""),t=Alpaca.trim(t),0===t.toLowerCase().indexOf("<script")||(t="<script type='"+this.supportedMimetypes()[0]+"'>"+t+"</script>"),Alpaca.logDebug("Compiling template: "+this.id+", cacheKey: "+e+", template: "+t),this.doCompile(e,t,n)},doCompile:function(e,t,n){},execute:function(e,t,n){Alpaca.logDebug("Executing template for cache key: "+e);var i=this.doExecute(e,t,n);return i=this.cleanup(i)},doExecute:function(e,t,n){return null},fileExtension:function(){return"html"},supportedMimetypes:function(){return[]},isCached:function(e){return!1},findCacheKeys:function(e){return[]}})}(jQuery),function($,Handlebars,HandlebarsPrecompiled){var COMPILED_TEMPLATES={},helpers={};helpers.compare=function(e,t,n){if(arguments.length<3)throw new Error("Handlerbars Helper 'compare' needs 2 parameters");var i=n.hash.operator||"==",a={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},"<":function(e,t){return t>e},">":function(e,t){return e>t},"<=":function(e,t){return t>=e},">=":function(e,t){return e>=t},"typeof":function(e,t){return typeof e==t}};if(!a[i])throw new Error("Handlerbars Helper 'compare' doesn't know the operator "+i);var r=a[i](e,t);return r?n.fn(this):n.inverse(this)},helpers.ifnot=function(e,t){return e?t.inverse(this):t.fn(this)},helpers.times=function(e,t){for(var n="",i=0;e>i;++i)n+=t.fn(i);return n},helpers.control=function(e){return"<div class='"+Alpaca.MARKER_CLASS_CONTROL_FIELD+"'></div>"},helpers.container=function(e){return"<div class='"+Alpaca.MARKER_CLASS_CONTAINER_FIELD+"'></div>"},helpers.item=function(e,t){return Alpaca.isObject(e)&&(t=e,e="div"),"<"+e+" class='"+Alpaca.MARKER_CLASS_CONTAINER_FIELD_ITEM+"' "+Alpaca.MARKER_DATA_CONTAINER_FIELD_ITEM_KEY+"='"+this.name+"'></"+e+">"},helpers.itemField=function(e,t){return Alpaca.isObject(e)&&(t=e,e="div"),"<"+e+" class='"+Alpaca.MARKER_CLASS_CONTAINER_FIELD_ITEM_FIELD+"'></"+e+">"},helpers.formItems=function(e){return"<div class='"+Alpaca.MARKER_CLASS_FORM_ITEMS_FIELD+"'></div>"},helpers.insert=function(e){return"<div class='"+Alpaca.MARKER_CLASS_INSERT+"' "+Alpaca.MARKER_DATA_INSERT_KEY+"='"+e+"'></div>"},helpers.str=function(e){return e===!1?"false":e===!0?"true":0===e?"0":"undefined"==typeof e?"":null===e?"":Alpaca.isString(e)?e:Alpaca.isNumber(e)?e:Alpaca.isObject(e)?JSON.stringify(e,null," "):Alpaca.isArray(e)?JSON.stringify(e,null," "):e},helpers.arrayToolbar=function(e){return"<div class='"+Alpaca.MARKER_CLASS_ARRAY_TOOLBAR+"' "+Alpaca.MARKER_DATA_ARRAY_TOOLBAR_FIELD_ID+"='"+this.id+"'></div>"},helpers.arrayActionbar=function(e){return"<div class='"+Alp
|
||
|
"default":!0},showMessages:{title:"Show Messages",description:"Display validation messages if true.",type:"boolean","default":!0},disabled:{title:"Disabled",description:"Field will be disabled if true.",type:"boolean","default":!1},readonly:{title:"Readonly",description:"Field will be readonly if true.",type:"boolean","default":!1},hidden:{title:"Hidden",description:"Field will be hidden if true.",type:"boolean","default":!1},label:{title:"Label",description:"Field label.",type:"string"},helper:{title:"Helper",description:"Field help message.",type:"string"},helpers:{title:"Helpers",description:"An array of field help messages. Each message will be displayed on it's own line.",type:"array",items:{type:"string"}},fieldClass:{title:"CSS class",description:"Specifies one or more CSS classes that should be applied to the dom element for this field once it is rendered. Supports a single value, comma-delimited values, space-delimited values or values passed in as an array.",type:"string"},hideInitValidationError:{title:"Hide Initial Validation Errors",description:"Hide initial validation errors if true.",type:"boolean","default":!1},focus:{title:"Focus",description:"If true, the initial focus for the form will be set to the first child element (usually the first field in the form). If a field name or path is provided, then the specified child field will receive focus. For example, you might set focus to 'name' (selecting the 'name' field) or you might set it to 'client/name' which picks the 'name' field on the 'client' object.",type:"checkbox","default":!0},optionLabels:{title:"Enumerated Value Labels",description:"An array of string labels for items in the enum array",type:"array"},view:{title:"Override of the view for this field",description:"Allows for this field to be rendered with a different view (such as 'display' or 'create')",type:"string"}}};return this.isTopLevel()?e.properties.form={title:"Form",description:"Options for rendering the FORM tag.",type:"object",properties:{attributes:{title:"Form Attributes",description:"List of attributes for the FORM tag.",type:"object",properties:{id:{title:"Id",description:"Unique form id. Auto-generated if not provided.",type:"string"},action:{title:"Action",description:"Form submission endpoint",type:"string"},method:{title:"Method",description:"Form submission method","enum":["post","get"],type:"string"},rubyrails:{title:"Ruby On Rails",description:"Ruby on Rails Name Standard","enum":["true","false"],type:"string"},name:{title:"Name",description:"Form name",type:"string"},focus:{title:"Focus",description:"Focus Setting",type:"any"}}},buttons:{title:"Form Buttons",description:"Configuration for form-bound buttons",type:"object",properties:{submit:{type:"object",title:"Submit Button",required:!1},reset:{type:"object",title:"Reset button",required:!1}}},toggleSubmitValidState:{title:"Toggle Submit Valid State",description:"Toggle the validity state of the Submit button",type:"boolean","default":!0}}}:delete e.properties.form,e},getOptionsForOptions:function(){var e={type:"object",fields:{id:{type:"text",readonly:!0},type:{type:"text"},validate:{rightLabel:"Enforce validation",type:"checkbox"},showMessages:{rightLabel:"Show validation messages",type:"checkbox"},disabled:{rightLabel:"Disable this field",type:"checkbox"},hidden:{type:"checkbox",rightLabel:"Hide this field"},label:{type:"text"},helper:{type:"textarea"},helpers:{type:"array",items:{type:"textarea"}},fieldClass:{type:"text"},hideInitValidationError:{rightLabel:"Hide initial validation errors",type:"checkbox"},focus:{type:"checkbox",rightLabel:"Auto-focus first child field"},optionLabels:{type:"array",items:{type:"text"}},view:{type:"text"}}};return this.isTopLevel()&&(e.fields.form={type:"object",fields:{attributes:{type:"object",fields:{id:{type:"text",readonly:!0},action:{type:"text"},method:{type:"select"},name:{type:"text"}}}}}),e}}),t.registerMessages({disallowValue:"{0} are disallowed values.",notOptional:"This field is not optional."})}(jQuery),function(e){var t=e.alpaca;t.ControlField=t.Field.extend({onCon
|
||
|
case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(s)){for(r=s.length,n=0;r>n;n+=1)o[n]=this.str(n,s)||"null";return a=0===o.length?"[]":gap?"[\n"+gap+o.join(",\n"+gap)+"\n"+l+"]":"["+o.join(",")+"]",gap=l,a}if(rep&&"object"==typeof rep)for(r=rep.length,n=0;r>n;n+=1)i=rep[n],"string"==typeof i&&(a=this.str(i,s),a&&o.push(this.quote(i)+(gap?": ":":")+a));else for(i in s)Object.hasOwnProperty.call(s,i)&&(a=this.str(i,s),a&&o.push(this.quote(i)+(gap?": ":":")+a));return a=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+l+"}":"{"+o.join(",")+"}",gap=l,a}}}(jQuery),function(e){var t=e.alpaca;t.CloudCmsConnector=t.Connector.extend({connect:function(e,n){var i=this,a=function(t,a){return t?void n(t):(a&&(i.branch=Chain(a),i.bindHelperFunctions(i.branch)),void e())};t.globalContext&&t.globalContext.branch?a(null,t.globalContext.branch):(i.branch=null,i.doConnect(function(e,t){a(e,t)}))},doConnect:function(e){this.config.key||(this.config.key="default"),Gitana.connect(this.config,function(t){return t?void e(t):void(this.getDriver().getOriginalConfiguration().loadAppHelper?this.datastore("content").readBranch("master").then(function(){e(null,this)}):e())})},bindHelperFunctions:function(e){e.loadAlpacaSchema||(e.loadAlpacaSchema=function(t,n,i){var a=function(){return e.getUri()+"/alpaca/schema"},r={};return r.id=t,this.chainGetResponse(this,a,r).then(function(e){i.call(this,null,e)})}),e.loadAlpacaOptions||(e.loadAlpacaOptions=function(t,n,i){var a=function(){return e.getUri()+"/alpaca/options"},r={};return r.schemaId=n.schemaSource,r.id=t,this.chainGetResponse(this,a,r).then(function(e){i.call(this,null,e)})}),e.loadAlpacaData||(e.loadAlpacaData=function(t,n,i){var a=function(){return e.getUri()+"/alpaca/data"},r={};return r.id=t,this.chainGetResponse(this,a,r).then(function(e){i.call(this,null,e)})}),e.loadAlpacaDataSource||(e.loadAlpacaDataSource=function(n,i,a){var r={};i&&t.copyInto(r,i);var o=function(){return e.getUri()+"/alpaca/datasource"};return this.chainPostResponse(this,o,r,n).then(function(e){a.call(this,null,e.datasource)})})},loadData:function(e,t,n,i){var a=this;return a.branch?void a.branch.loadAlpacaData(e,t,function(e,t){if(e)return void i(e);var a=null;t&&(a=JSON.parse(JSON.stringify(t))),n(a)}):this.base(e,t,n,i)},loadSchema:function(e,t,n,i){var a=this;return a.branch?void a.branch.loadAlpacaSchema(e,t,function(e,t){return e?void i(e):void n(t)}):this.base(e,t,n,i)},loadOptions:function(e,n,i,a){var r=this;return r.branch?void r.branch.loadAlpacaOptions(e,n,function(e,n){return e?void a(e):(n||(n={}),n.form.buttons={submit:{title:"Submit",click:function(e){var t=this,n=this.getValue();n||(n={});var i=this.ajaxSubmit({xhrFields:{withCredentials:!0},crossDomain:!0,processData:!1,data:JSON.stringify(n),contentType:"application/json; charset=utf-8"});i.done(function(){t.topControl.trigger("formSubmitSuccess")}),i.fail(function(){t.topControl.trigger("formSubmitFail")})}}},"undefined"==typeof n.focus&&(n.focus=t.defaultFocus),n.form.attributes.action=r.config.baseURL+n.form.attributes.action,void i(n))}):this.base(e,n,i,a)},loadReferenceSchema:function(e,t,n){var i=this;return i.loadSchema(e,t,n)},loadReferenceOptions:function(e,t,n){var i=this;return i.loadOptions(e,t,n)},loadDataSource:function(e,t,n){var i=this;if(!i.branch)return this.base(e,t,n);var a=e.pagination;return delete e.pagination,i.branch.loadAlpacaDataSource(e,a,function(e,i){return e?void n(e):void t(i)})}}),t.registerConnectorClass("cloudcms",t.CloudCmsConnector)}(jQuery),function(e){var t=e.alpaca;t.Fields.TextField=t.ControlField.extend({getFieldType:function(){return"text"},setup:function(){this.base(),this.inputType||(this.inputType="text"),this.options.inputType&&(this.inputType=this.options.inputType),this.options.data||(this.options.data={}),this.options.attributes||(this.options.attributes={}),"undefined"==typeof this.options.allowOptionalEmpty&&(this.options.allowOptionalEmpty=!0),this.options.autocomplete&&"string"==typeof this.option
|
||
|
e.stopImmediatePropagation()),i}),e()})},getControlValue:function(){var e=this._getControlVal(!0);return"undefined"==typeof e||""==e?e:parseFloat(e)},handleValidate:function(){var e=this.base(),n=this.validation,i=this._validateNumber();return n.stringNotANumber={message:i?"":this.getMessage("stringNotANumber"),status:i},i=this._validateDivisibleBy(),n.stringDivisibleBy={message:i?"":t.substituteTokens(this.getMessage("stringDivisibleBy"),[this.schema.divisibleBy]),status:i},i=this._validateMaximum(),n.stringValueTooLarge={message:"",status:i},i||(this.schema.exclusiveMaximum?n.stringValueTooLarge.message=t.substituteTokens(this.getMessage("stringValueTooLargeExclusive"),[this.schema.maximum]):n.stringValueTooLarge.message=t.substituteTokens(this.getMessage("stringValueTooLarge"),[this.schema.maximum])),i=this._validateMinimum(),n.stringValueTooSmall={message:"",status:i},i||(this.schema.exclusiveMinimum?n.stringValueTooSmall.message=t.substituteTokens(this.getMessage("stringValueTooSmallExclusive"),[this.schema.minimum]):n.stringValueTooSmall.message=t.substituteTokens(this.getMessage("stringValueTooSmall"),[this.schema.minimum])),i=this._validateMultipleOf(),n.stringValueNotMultipleOf={message:"",status:i},i||(n.stringValueNotMultipleOf.message=t.substituteTokens(this.getMessage("stringValueNotMultipleOf"),[this.schema.multipleOf])),e&&n.stringNotANumber.status&&n.stringDivisibleBy.status&&n.stringValueTooLarge.status&&n.stringValueTooSmall.status&&n.stringValueNotMultipleOf.status&&n.invalidPattern.status&&n.stringTooLong.status&&n.stringTooShort.status},_validateOptional:function(){return!this.isRequired()||!t.isValEmpty(e(this.control).val())},_validateNumber:function(){var e=this._getControlVal();if("number"==typeof e&&(e=""+e),t.isValEmpty(e))return!0;var n=t.testRegex(t.regexps.number,e);if(!n)return!1;var i=this.getValue();return!isNaN(i)},_validateDivisibleBy:function(){var e=this.getValue();return!(!t.isEmpty(this.schema.divisibleBy)&&e%this.schema.divisibleBy!==0)},_validateMaximum:function(){var e=this.getValue();if(!t.isEmpty(this.schema.maximum)){if(e>this.schema.maximum)return!1;if(!t.isEmpty(this.schema.exclusiveMaximum)&&e==this.schema.maximum&&this.schema.exclusiveMaximum)return!1}return!0},_validateMinimum:function(){var e=this.getValue();if(!t.isEmpty(this.schema.minimum)){if(e<this.schema.minimum)return!1;if(!t.isEmpty(this.schema.exclusiveMinimum)&&e==this.schema.minimum&&this.schema.exclusiveMinimum)return!1}return!0},_validateMultipleOf:function(){var e=this.getValue();return t.isEmpty(this.schema.multipleOf)||!e||0===this.schema.multipleOf},getType:function(){return"number"},onKeyPress:function(e){var n=this;if(9!==e.keyCode&&37!==e.keyCode&&38!==e.keyCode&&39!==e.keyCode&&40!==e.keyCode){if(8===e.keyCode){if(!t.isEmpty(n.schema.minLength)&&(n.options.constrainLengths||n.options.constrainMinLength)){var i=n.getValue()||"";t.isNumber(i)&&(i=i.toString()),i.length<=n.schema.minLength&&(e.preventDefault(),e.stopImmediatePropagation())}}else if(!t.isEmpty(n.schema.maxLength)&&(n.options.constrainLengths||n.options.constrainMaxLength)){var i=n.getValue()||"";t.isNumber(i)&&(i=i.toString()),i.length>=n.schema.maxLength&&(e.preventDefault(),e.stopImmediatePropagation())}32===e.keyCode&&n.options.disallowEmptySpaces&&(e.preventDefault(),e.stopImmediatePropagation())}},onKeyUp:function(t){var n=this;n.updateMaxLengthIndicator(),e(this.field).trigger("fieldkeyup")},getSchemaOfSchema:function(){return t.merge(this.base(),{properties:{multipleOf:{title:"Multiple Of",description:"Property value must be a multiple of the multipleOf schema property such that division by this value yields an interger (mod zero).",type:"number"},minimum:{title:"Minimum",description:"Minimum value of the property.",type:"number"},maximum:{title:"Maximum",description:"Maximum value of the property.",type:"number"},exclusiveMinimum:{title:"Exclusive Minimum",description:"Property value can not equal the number defined by the minimum schema property.",type:"boolean","default":!1},exclusiveMaximum:{title:"Exclusive Maximum",descript
|
||
|
var a=this.determineAllDependenciesValid(e);a?(i.show(),i.onDependentReveal()):(i.hide(),i.onDependentConceal()),i.getFieldEl().trigger("fieldupdate")},getChildDependencies:function(e){var t=null;if(this.schema.dependencies&&(t=this.schema.dependencies[e]),!t){var n=this.childrenByPropertyId[e];n&&(t=n.schema.dependencies)}return t},getChildConditionalDependencies:function(e){var t=null,n=this.childrenByPropertyId[e];return n&&(t=n.options.dependencies),t},determineAllDependenciesValid:function(n){var i=this,a=this.childrenByPropertyId[n];if(!a)return t.throwErrorWithCallback("Missing property: "+n,i.errorCallback);var r=i.getChildDependencies(n);if(!r)return!0;var o=!0;return t.isString(r)?o=i.determineSingleDependencyValid(n,r):t.isArray(r)&&e.each(r,function(e,t){o=o&&i.determineSingleDependencyValid(n,t)}),o},bindDependencyFieldUpdateEvent:function(n){var i=this,a=this.childrenByPropertyId[n];if(!a)return t.throwErrorWithCallback("Missing property: "+n,i.errorCallback);var r=i.getChildDependencies(n);if(!r)return!0;var o=function(e,n){var r=t.resolveField(i,n);r&&(r.getFieldEl().bind("fieldupdate",function(e,t,n,a){return function(t){i.showOrHidePropertyBasedOnDependencies(n),e.getFieldEl().trigger("fieldupdate")}}(a,r,e,n)),r.getFieldEl().trigger("fieldupdate"))};t.isString(r)?o(n,r):t.isArray(r)&&e.each(r,function(e,t){o(n,t)})},refreshDependentFieldStates:function(n){var i=this,a=this.childrenByPropertyId[n];if(!a)return t.throwErrorWithCallback("Missing property: "+n,i.errorCallback);var r=i.getChildDependencies(n);if(!r)return!0;var o=function(e){var n=t.resolveField(i,e);n&&n.getFieldEl().trigger("fieldupdate")};t.isString(r)?o(r):t.isArray(r)&&e.each(r,function(e,t){o(t)})},determineSingleDependencyValid:function(e,n){var i=this,a=t.resolveField(i,n);if(!a)return!1;var r=a.data,o=!1,l=this.getChildConditionalDependencies(e);if(l&&0!==l.length){"boolean"!==a.getType()||r||(r=!1);var s=l[n];!t.isEmpty(s)&&t.isFunction(s)?o=s.call(this,r):(o=!0,t.isArray(s)?t.anyEquality(r,s)||(o=!1):t.isEmpty(s)||t.anyEquality(s,r)||(o=!1))}else o="boolean"!==a.getType()||this.childrenByPropertyId[e].options.dependencies||r?!t.isValEmpty(a.data):!1;return a&&a.isHidden()&&(o=!1),o},getIndex:function(e){if(t.isEmpty(e))return-1;for(var n=0;n<this.children.length;n++){var i=this.children[n].propertyId;if(i==e)return n}return-1},addItem:function(e,t,n,i,a,r){var o=this;this.createItem(e,t,n,i,a,function(e){var t=null;if(a&&o.childrenById[a])for(var n=0;n<o.children.length;n++)if(o.children[n].getId()==a){t=n;break}o.registerChild(e,null!=t?t+1:0),o.doAddItem(t,e),o.handleRepositionDOMRefresh(),o.refreshValidationState(!0,function(){o.trigger("add",e),o.triggerUpdate(),e.triggerWithPropagation.call(e,"ready","down"),r&&r()})})},doAddItem:function(n,i){var a=this;if(n){var r=a.getContainerEl().children("[data-alpaca-container-item-index='"+n+"']");r&&r.length>0&&r.after(i.containerItemEl)}else e(a.container).prepend(i.containerItemEl);a.doAfterAddItem(i,function(){t.fireReady(i)})},doAfterAddItem:function(e,t){t()},doResolveItemContainer:function(){var t=this;return e(t.container)},removeItem:function(t,n){var i=this,a=this.childrenByPropertyId[t];a?(this.children=e.grep(this.children,function(e,n){return e.propertyId!==t}),delete this.childrenByPropertyId[t],delete this.childrenById[a.getId()],i.doRemoveItem(a),this.refreshValidationState(!0,function(){i.handleRepositionDOMRefresh(),i.trigger("remove",a),i.triggerUpdate(),n&&n()})):n()},doRemoveItem:function(e){var t=this,n=t.doResolveItemContainer();n.children(".alpaca-container-item[data-alpaca-container-item-name='"+e.name+"']").remove(),e.destroy()},wizard:function(){var n=this,i=this.wizardConfigs.steps;i||(i=[]);var a=this.wizardConfigs.title,r=this.wizardConfigs.description,o=this.wizardConfigs.buttons;o||(o={}),o.previous||(o.previous={}),o.previous.title||(o.previous.title="Previous"),o.previous.align||(o.previous.align="left"),o.previous.type||(o.previous.type="button"),o.next||(o.next={}),o.next.title||(o.next.title="Next"),o.next.align||(o.next.align="right"),o.next.typ
|
||
|
a.editor.setValue(a.data),a.editor.clearSelection(),a.editor.getSession().getUndoManager().reset(),a.options.aceFitContentHeight){var u=function(){var t=!1;0===a.editor.renderer.lineHeight&&(t=!0,a.editor.renderer.lineHeight=16);var n=a.editor.getSession().getScreenLength()*a.editor.renderer.lineHeight+a.editor.renderer.scrollBar.getWidth();e(a.control).height(n.toString()+"px"),a.editor.resize(),t&&window.setTimeout(function(){a.editor.clearSelection()},100)};u(),a.editor.getSession().on("change",u)}a.schema.readonly&&a.editor.setReadOnly(!0),e(o).bind("destroyed",function(){a.editor&&(a.editor.destroy(),a.editor=null)})}else t.logError("Editor Field is missing the 'ace' Cloud 9 Editor");i()})},destroy:function(){this.editor&&(this.editor.destroy(),this.editor=null),this.base()},getEditor:function(){return this.editor},handleValidate:function(){var e=this.base(),n=this.validation,i=this._validateWordCount();n.wordLimitExceeded={message:i?"":t.substituteTokens(this.getMessage("wordLimitExceeded"),[this.options.wordlimit]),status:i};var a=this._validateEditorAnnotations();return n.editorAnnotationsExist={message:a?"":this.getMessage("editorAnnotationsExist"),status:a},e&&n.wordLimitExceeded.status&&n.editorAnnotationsExist.status},_validateEditorAnnotations:function(){if(this.editor){var e=this.editor.getSession().getAnnotations();if(e&&e.length>0)return!1}return!0},_validateWordCount:function(){if(this.options.wordlimit&&this.options.wordlimit>-1){var e=this.editor.getValue();if(e){var t=e.split(" ").length;if(t>this.options.wordlimit)return!1}}return!0},onDependentReveal:function(){this.editor&&this.editor.resize()},setValue:function(e){var n=this;this.editor&&("object"==n.schema.type&&t.isObject(e)&&(e=JSON.stringify(e,null," ")),this.editor.setValue(e),n.editor.clearSelection()),this.base(e)},getControlValue:function(){var e=null;return this.editor&&(e=this.editor.getValue()),"object"==this.schema.type&&(e=e?JSON.parse(e):{}),e},getTitle:function(){return"Editor"},getDescription:function(){return"Editor"},getSchemaOfOptions:function(){return t.merge(this.base(),{properties:{aceTheme:{title:"ACE Editor Theme",description:"Specifies the theme to set onto the editor instance",type:"string","default":"ace/theme/twilight"},aceMode:{title:"ACE Editor Mode",description:"Specifies the mode to set onto the editor instance",type:"string","default":"ace/mode/javascript"},aceWidth:{title:"ACE Editor Height",description:"Specifies the width of the wrapping div around the editor",type:"string","default":"100%"},aceHeight:{title:"ACE Editor Height",description:"Specifies the height of the wrapping div around the editor",type:"string","default":"300px"},aceFitContentHeight:{title:"ACE Fit Content Height",description:"Configures the ACE Editor to auto-fit its height to the contents of the editor",type:"boolean","default":!1},wordlimit:{title:"Word Limit",description:"Limits the number of words allowed in the text area.",type:"number","default":-1}}})},getOptionsForOptions:function(){return t.merge(this.base(),{fields:{aceTheme:{type:"text"},aceMode:{type:"text"},wordlimit:{type:"integer"}}})}}),t.registerMessages({wordLimitExceeded:"The maximum word limit of {0} has been exceeded.",editorAnnotationsExist:"The editor has errors in it that must be corrected"}),t.registerFieldClass("editor",t.Fields.EditorField)}(jQuery),function(e){var t=e.alpaca;t.Fields.EmailField=t.Fields.TextField.extend({getFieldType:function(){return"email"},setup:function(){this.inputType="email",this.base(),this.schema.pattern||(this.schema.pattern=t.regexps.email)},handleValidate:function(){var e=this.base(),t=this.validation;return t.invalidPattern.status||(t.invalidPattern.message=this.getMessage("invalidEmail")),e},getTitle:function(){return"Email Field"},getDescription:function(){return"Email Field."},getSchemaOfSchema:function(){var e=this.schema&&this.schema.pattern?this.schema.pattern:t.regexps.email;return t.merge(this.base(),{properties:{pattern:{title:"Pattern",description:"Field Pattern in Regular Expression",type:"string","default":e,"enum":[e],
|
||
|
i.options.dragRows||a&&0===i.data.length?(i.refresh(function(){n()}),n()):n()},getType:function(){return"array"},getTitle:function(){return"Table Field"},getDescription:function(){return"Renders array items into a table"},getSchemaOfOptions:function(){return t.merge(this.base(),{properties:{datatables:{title:"DataTables Configuration",description:"Optional configuration to be passed to the underlying DataTables Plugin.",type:"object"},showActionsColumn:{title:"Show Actions Column","default":!0,description:"Whether to show or hide the actions column.",type:"boolean"},dragRows:{title:"Drag Rows","default":!1,description:"Whether to enable the dragging of rows via a draggable column. This requires DataTables and the DataTables Row Reorder Plugin.",type:"boolean"}}})},getOptionsForOptions:function(){return t.merge(this.base(),{fields:{datatables:{type:"object"},showActionsColumn:{type:"checkbox"},dragRows:{type:"checkbox"}}})}}),t.registerFieldClass("table",t.Fields.TableField)}(jQuery),function(e){var t=e.alpaca;t.Fields.TableRowField=t.Fields.ObjectField.extend({prepareContainerModel:function(e){var t=this;this.base(function(n){n.options.showActionsColumn=t.parent.options.showActionsColumn,n.options.dragRows=t.parent.options.dragRows;for(var i=0;i<n.items.length;i++)"hidden"===n.items[i].options.type&&(n.items[i].hidden=!0);e(n)})},getFieldType:function(){return"tablerow"},getType:function(){return"object"},getTitle:function(){return"Table Row Field"},getDescription:function(){return"Renders object items into a table row"}}),t.registerFieldClass("tablerow",t.Fields.TableRowField)}(jQuery),function(e){var t=e.alpaca;t.Fields.TagField=t.Fields.LowerCaseField.extend({getFieldType:function(){return"tag"},setup:function(){this.base(),this.options.separator||(this.options.separator=",")},getControlValue:function(){var e=this.base();return""===e?[]:e.split(this.options.separator)},setValue:function(e){return""!==e?e?void this.base(e.join(this.options.separator)):this.base(""):void 0},onBlur:function(t){this.base(t);var n=this.getValue(),i=[];e.each(n,function(e,t){""!==t.trim()&&i.push(t.trim())}),this.setValue(i)},getTitle:function(){return"Tag Field"},getDescription:function(){return"Text field for entering list of tags separated by delimiter."},getSchemaOfOptions:function(){return t.merge(this.base(),{properties:{separator:{title:"Separator",description:"Separator used to split tags.",type:"string","default":","}}})},getOptionsForOptions:function(){return t.merge(this.base(),{fields:{separator:{type:"text"}}})}}),t.registerFieldClass("tag",t.Fields.TagField)}(jQuery),function(e){var t=e.alpaca;t.Fields.TimeField=t.Fields.DateField.extend({getFieldType:function(){return"time"},getDefaultFormat:function(){return"h:mm:ss a"},setup:function(){this.base()},getTitle:function(){return"Time Field"},getDescription:function(){return"Time Field"}}),t.registerMessages({invalidTime:"Invalid time"}),t.registerFieldClass("time",t.Fields.TimeField),t.registerDefaultFormatFieldMapping("time","time")}(jQuery),function(e){var t=e.alpaca;t.Fields.TinyMCEField=t.Fields.TextAreaField.extend({getFieldType:function(){return"tinymce"},setup:function(){var e=this;this.data||(this.data=""),e.options.toolbar||(e.options.toolbar="insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"),this.base()},setValue:function(e){var t=this;this.base(e),t.editor&&t.editor.setContent(e)},getControlValue:function(){var e=this,t=null;return e.editor&&(t=e.editor.getContent()),t},initTinyMCEEvents:function(){var e=this;e.editor&&(e.editor.on("click",function(t){e.onClick.call(e,t),e.trigger("click",t)}),e.editor.on("change",function(t){e.onChange(),e.triggerWithPropagation("change",t)}),e.editor.on("blur",function(t){e.onBlur(),e.trigger("blur",t)}),e.editor.on("focus",function(t){e.onFocus.call(e,t),e.trigger("focus",t)}),e.editor.on("keypress",function(t){e.onKeyPress.call(e,t),e.trigger("keypress",t)}),e.editor.on("keyup",function(t){e.onKeyUp.call(e,t),e.trigger("keyup",t)}),e.
|
||
|
notAnArray:"Keine Liste von Werten",invalidDate:"Falsches Datumsformat: {0}",invalidEmail:"Keine gültige E-Mail Adresse",stringNotAnInteger:"Keine Ganze Zahl",invalidIPv4:"Ungültige IPv4 Adresse",stringValueTooSmall:"Die Mindestanzahl von Zeichen ist {0}",stringValueTooLarge:"Die Maximalanzahl von Zeichen ist {0}",stringValueTooSmallExclusive:"Die Anzahl der Zeichen muss größer sein als {0}",stringValueTooLargeExclusive:"Die Anzahl der Zeichen muss kleiner sein als {0}",stringDivisibleBy:"Der Wert muss durch {0} dividierbar sein",stringNotANumber:"Die Eingabe ist keine Zahl",invalidPassword:"Ungültiges Passwort",invalidPhone:"Ungültige Telefonnummer",invalidPattern:"Diese Feld stimmt nicht mit folgender Vorgabe überein {0}",stringTooShort:"Dieses Feld sollte mindestens {0} Zeichen enthalten",stringTooLong:"Dieses Feld sollte höchstens {0} Zeichen enthalten"}}})}(jQuery),function(e){var t=e.alpaca;t.registerView({id:"base",messages:{es_ES:{required:"Este campo es obligatorio",invalid:"Este campo es inválido",months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],timeUnits:{SECOND:"segundos",MINUTE:"minutos",HOUR:"horas",DAY:"días",MONTH:"meses",YEAR:"años"},notOptional:"Este campo no es opcional.",disallowValue:"{0} son los valores rechazados.",invalidValueOfEnum:"Este campo debe tener uno de los valores adentro {0}. [{1}]",notEnoughItems:"El número mínimo de artículos es {0}",tooManyItems:"El número máximo de artículos es {0}",valueNotUnique:"Los valores no son únicos",notAnArray:"Este valor no es un arsenal",invalidDate:"Fecha inválida para el formato {0}",invalidEmail:"Email address inválido, ex: info@cloudcms.com",stringNotAnInteger:"Este valor no es un número entero.",invalidIPv4:"Dirección inválida IPv4, ex: 192.168.0.1",stringValueTooSmall:"El valor mínimo para este campo es {0}",stringValueTooLarge:"El valor máximo para este campo es {0}",stringValueTooSmallExclusive:"El valor de este campo debe ser mayor que {0}",stringValueTooLargeExclusive:"El valor de este campo debe ser menos que {0}",stringDivisibleBy:"El valor debe ser divisible cerca {0}",stringNotANumber:"Este valor no es un número.",invalidPassword:"Contraseña inválida",invalidPhone:"Número de teléfono inválido, ex: (123) 456-9999",invalidPattern:"Este campo debe tener patrón {0}",stringTooShort:"Este campo debe contener por lo menos {0} números o caracteres",stringTooLong:"Este campo debe contener a lo más {0} números o caracteres",noneLabel:"Ninguno",addItemButtonLabel:"Añadir",addButtonLabel:"Añadir",removeButtonLabel:"Quitar",upButtonLabel:"Arriba",downButtonLabel:"Abajo"}}})}(jQuery),function(e){var t=e.alpaca;t.registerView({id:"base",messages:{fr_FR:{required:"Ce champ est requis",invalid:"Ce champ est invalide",months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],timeUnits:{SECOND:"secondes",MINUTE:"minutes",HOUR:"heures",DAY:"jours",MONTH:"mois",YEAR:"années"},notOptional:"Ce champ n'est pas optionnel.",disallowValue:"{0} sont des valeurs interdites.",invalidValueOfEnum:"Ce champ doit prendre une des valeurs suivantes : {0}. [{1}]",notEnoughItems:"Le nombre minimum d'éléments est {0}",tooManyItems:"Le nombre maximum d'éléments est {0}",valueNotUnique:"Les valeurs sont uniques",notAnArray:"Cette valeur n'est pas une liste",invalidDate:"Cette date ne correspond pas au format {0}",invalidEmail:"Adresse de courriel invalide, ex: info@cloudcms.com",stringNotAnInteger:"Cette valeur n'est pas un nombre entier.",invalidIPv4:"Adresse IPv4 invalide, ex: 192.168.0.1",stringValueTooSmall:"La valeur minimale pour ce champ est {0}",stringValueTooLarge:"La valeur maximale pour ce champ est {0}",stringValueTooSmallExclusive:"La valeur doit-être supérieure à {0}",stringValueTooLargeExclusive:"La valeur doit-être inférieure à {0}",stringDivisibleBy:"La valeur doit-être divisible par {0}",stringNotANumber:"Cette valeur n'est pas un nombre.",invalidPassword:"Mot de passe invalide",in
|