silverstripe-userforms/client/dist/js/userforms-cms.js
Dylan Wagstaff 7f208ee927 FIX javascript errors enacting default functionality
Mostly to do with translations, however the errors meant the front end
forms largely didn't work at all. Some of this was to do with the scoping
of `this` in es6 arrow functions, compared to the legacy code with entwine
that uses the fuller `function` definition. Reinstate missing dependency
for translations to function too.
2017-11-20 15:16:03 +13:00

1 line
2.9 KiB
JavaScript

!function(e){function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}var t={};i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},i.p="",i(i.s=3)}([function(e,i){e.exports=jQuery},function(e,i,t){"use strict";var n=t(0);t.n(n).a.entwine("ss",function(e){var i=null;e(".uf-field-editor .ss-gridfield-items").entwine({onmatch:function(){var t=0,n=0,o=e(".uf-field-editor .ss-gridfield-buttonrow").addClass("sticky-buttons"),r=e(".cms-content-header.north").first().height()+parseInt(e(".sticky-buttons").css("padding-top"),10),s=e(".uf-field-editor");this._super(),this.find(".ss-gridfield-item").each(function(i,o){switch(e(o).data("class")){case"SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep":return void(n=0);case"SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFieldGroup":t=++n;break;case"SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFieldGroupEnd":t=n--;break;default:t=n}e(o).toggleClass("infieldgroup",t>0);for(var r=1;r<=5;r++)e(o).toggleClass("infieldgroup-level-"+r,t>=r)}),i=setInterval(function(){var e=s.offset().top;o.width("100%"),e>r||0===e?o.removeClass("sticky-buttons"):o.addClass("sticky-buttons")},300)},onunmatch:function(){this._super(),clearInterval(i)}}),e(".uf-field-editor .ss-gridfield-buttonrow .action").entwine({onclick:function(e){this._super(e),this.trigger("addnewinline")}}),e(".uf-field-editor").entwine({onmatch:function(){var i=this;this._super(),this.on("addnewinline",function(){i.one("reload",function(){var t=i.find(".ss-gridfield-item").last(),n=null;"SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFieldGroupEnd"===t.attr("data-class")?(n=t,n.prev().find(".col-Title input").focus(),t=n.add(n.prev()),n.css("visibility","hidden")):t.find(".col-Title input").focus(),t.addClass("flashBackground"),e(".cms-content-fields").scrollTop(e(".cms-content-fields")[0].scrollHeight),n&&n.css("visibility","visible")})})},onummatch:function(){this._super()}})})},function(e,i,t){"use strict";var n=t(0),o=this;t.n(n).a.entwine("ss",function(e){var i={updateFormatSpecificFields:function(){var i=e('input[name="SendPlain"]').is(":checked");e(".field.toggle-html-only")[i?"hide":"show"](),e(".field.toggle-plain-only")[i?"show":"hide"]()}};e("#Form_ItemEditForm .EmailRecipientForm").entwine({onmatch:function(){i.updateFormatSpecificFields()},onunmatch:function(){o._super()}}),e('#Form_ItemEditForm .EmailRecipientForm input[name="SendPlain"]').entwine({onchange:function(){i.updateFormatSpecificFields()}})})},function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),t(1),t(2)}]);