mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
7f208ee927
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.
1 line
11 KiB
Plaintext
1 line
11 KiB
Plaintext
{"version":3,"sources":["webpack:///webpack/bootstrap 68068778ece7b00e18f0","webpack:///external \"jQuery\"","webpack:///./client/src/bundles/FieldEditor.js","webpack:///./client/src/bundles/Recipient.js","webpack:///./client/src/bundles/bundle-cms.js"],"names":["jQuery","entwine","$","stickyHeaderInterval","onmatch","thisLevel","depth","$buttonrow","addClass","navHeight","first","height","parseInt","css","fieldEditor","_super","find","each","index","el","data","toggleClass","i","setInterval","offsetTop","offset","top","width","removeClass","onunmatch","clearInterval","onclick","e","trigger","on","one","$newField","last","$groupEnd","fqcn","attr","prev","focus","add","scrollTop","scrollHeight","onummatch","recipient","updateFormatSpecificFields","sendPlainChecked","is","onchange"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AChEA,wB;;;;;;;;;;;ACIA;;AAEA,8CAAAA,CAAOC,OAAP,CAAe,IAAf,EAAqB,UAACC,CAAD,EAAO;AAC1B,MAAIC,uBAAuB,IAA3B;;AAEAD,IAAE,sCAAF,EAA0CD,OAA1C,CAAkD;AAChDG,WADgD,qBACtC;AACR,UAAIC,YAAY,CAAhB;AACA,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CD,CApGD,E;;;;;;;;;;;ACFA;;AAEA,8CAAAf,CAAOC,OAAP,CAAe,IAAf,EAAqB,UAACC,CAAD,EAAO;AAC1B,MAAM6C,YAAY;AAEhBC,gCAA4B,sCAAM;AAChC,UAAMC,mBAAmB/C,EAAE,yBAAF,EAA6BgD,EAA7B,CAAgC,UAAhC,CAAzB;;AAEAhD,QAAE,yBAAF,EAA6B+C,mBAAmB,MAAnB,GAA4B,MAAzD;AACA/C,QAAE,0BAAF,EAA8B+C,mBAAmB,MAAnB,GAA4B,MAA1D;AACD;AAPe,GAAlB;;AAUA/C,IAAE,wCAAF,EAA4CD,OAA5C,CAAoD;AAClDG,aAAS,mBAAM;AACb2C,gBAAUC,0BAAV;AACD,KAHiD;;AAKlDnB,eAAW,qBAAM;AACf,YAAKd,MAAL;AACD;AAPiD,GAApD;;AAUAb,IAAE,gEAAF,EAAoED,OAApE,CAA4E;AAC1EkD,cAAU,oBAAM;AACdJ,gBAAUC,0BAAV;AACD;AAHyE,GAA5E;AAKD,CA1BD,E;;;;;;;;;;;ACLA","file":"js/userforms-cms.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 68068778ece7b00e18f0","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0","/**\n * form builder behaviour.\n */\n\nimport jQuery from 'jquery';\n\njQuery.entwine('ss', ($) => {\n let stickyHeaderInterval = null;\n\n $('.uf-field-editor .ss-gridfield-items').entwine({\n onmatch() {\n let thisLevel = 0;\n let depth = 0;\n const $buttonrow = $('.uf-field-editor .ss-gridfield-buttonrow').addClass('sticky-buttons');\n const navHeight = $('.cms-content-header.north').first().height()\n + parseInt($('.sticky-buttons').css('padding-top'), 10);\n const fieldEditor = $('.uf-field-editor');\n\n this._super();\n\n // Loop through all rows and set necessary styles\n this.find('.ss-gridfield-item').each((index, el) => {\n switch ($(el).data('class')) {\n case 'SilverStripe\\\\UserForms\\\\Model\\\\EditableFormField\\\\EditableFormStep': {\n depth = 0;\n return;\n }\n case 'SilverStripe\\\\UserForms\\\\Model\\\\EditableFormField\\\\EditableFieldGroup': {\n thisLevel = ++depth;\n break;\n }\n case 'SilverStripe\\\\UserForms\\\\Model\\\\EditableFormField\\\\EditableFieldGroupEnd': {\n thisLevel = depth--;\n break;\n }\n default: {\n thisLevel = depth;\n }\n }\n\n $(el).toggleClass('infieldgroup', thisLevel > 0);\n for (let i = 1; i <= 5; i++) {\n $(el).toggleClass(`infieldgroup-level-${i}`, thisLevel >= i);\n }\n });\n\n // Make sure gridfield buttons stick to top of page when user scrolls down\n stickyHeaderInterval = setInterval(() => {\n const offsetTop = fieldEditor.offset().top;\n $buttonrow.width('100%');\n if (offsetTop > navHeight || offsetTop === 0) {\n $buttonrow.removeClass('sticky-buttons');\n } else {\n $buttonrow.addClass('sticky-buttons');\n }\n }, 300);\n },\n onunmatch() {\n this._super();\n\n clearInterval(stickyHeaderInterval);\n },\n });\n\n // When new fields are added.\n $('.uf-field-editor .ss-gridfield-buttonrow .action').entwine({\n onclick(e) {\n this._super(e);\n\n this.trigger('addnewinline');\n },\n });\n\n $('.uf-field-editor').entwine({\n onmatch() {\n this._super();\n\n // When the 'Add field' button is clicked set a one time listener.\n // When the GridField is reloaded focus on the newly added field.\n this.on('addnewinline', () => {\n this.one('reload', () => {\n // If fieldgroup, focus on the start marker\n let $newField = this.find('.ss-gridfield-item').last();\n let $groupEnd = null;\n const fqcn = 'SilverStripe\\\\UserForms\\\\Model\\\\EditableFormField\\\\EditableFieldGroupEnd';\n if ($newField.attr('data-class') === fqcn) {\n $groupEnd = $newField;\n $groupEnd.prev().find('.col-Title input').focus();\n $newField = $groupEnd.add($groupEnd.prev());\n $groupEnd.css('visibility', 'hidden');\n } else {\n $newField.find('.col-Title input').focus();\n }\n\n $newField.addClass('flashBackground');\n $('.cms-content-fields').scrollTop($('.cms-content-fields')[0].scrollHeight);\n if ($groupEnd) {\n $groupEnd.css('visibility', 'visible');\n }\n });\n });\n },\n onummatch() {\n this._super();\n },\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/FieldEditor.js","/**\n * Email recipient behaviour.\n */\n\nimport jQuery from 'jquery';\n\njQuery.entwine('ss', ($) => {\n const recipient = {\n // Some fields are only visible when HTML email are being sent.\n updateFormatSpecificFields: () => {\n const sendPlainChecked = $('input[name=\"SendPlain\"]').is(':checked');\n\n $('.field.toggle-html-only')[sendPlainChecked ? 'hide' : 'show']();\n $('.field.toggle-plain-only')[sendPlainChecked ? 'show' : 'hide']();\n },\n };\n\n $('#Form_ItemEditForm .EmailRecipientForm').entwine({\n onmatch: () => {\n recipient.updateFormatSpecificFields();\n },\n\n onunmatch: () => {\n this._super();\n },\n });\n\n $('#Form_ItemEditForm .EmailRecipientForm input[name=\"SendPlain\"]').entwine({\n onchange: () => {\n recipient.updateFormatSpecificFields();\n },\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/Recipient.js","// Used for CMS form fields\nimport 'bundles/FieldEditor.js';\nimport 'bundles/Recipient.js';\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/bundle-cms.js"],"sourceRoot":""} |