diff --git a/plugins/admin/.editorconfig b/plugins/admin/.editorconfig new file mode 100644 index 0000000..6375a81 --- /dev/null +++ b/plugins/admin/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +# 4 space indentation +[*.php] +indent_size = 4 diff --git a/plugins/admin/.gitignore b/plugins/admin/.gitignore new file mode 100644 index 0000000..77d3944 --- /dev/null +++ b/plugins/admin/.gitignore @@ -0,0 +1,16 @@ +themes/grav/.sass-cache +.DS_Store +crowdin.yaml + +# Node Modules +**/node_modules/** +themes/grav/js/admin.js +themes/grav/js/vendor.js +themes/grav/js/*.map +.idea + +tests/_output/* +tests/_support/_generated/* +tests/cache/* +tests/error.log +/crowdin.yaml diff --git a/plugins/admin/CHANGELOG.md b/plugins/admin/CHANGELOG.md index 69948bf..da183e2 100644 --- a/plugins/admin/CHANGELOG.md +++ b/plugins/admin/CHANGELOG.md @@ -1,3 +1,22 @@ +# v1.10.33.1 +## 04/25/2022 + +1. [](#bugfix) + * Reverted [PR#2265](https://github.com/getgrav/grav-plugin-admin/pull/2265) as it broke sections output. + +# v1.10.33 +## 04/25/2022 + +1. [](#new) + * Require **Form 6.0.1** +2. [](#improved) + * Added support for a single `field:` vs `fields:` in element form field to store a single value to the option field + * Allow new media collapser logic to configure different cookie storage name location via `data-storage-location` +1. [](#bugfix) + * Fixed nested element form fields + * Fixed `columns` and `column` fields with `.dotted` variables inside to ignore columns and column names + * Fixed initial elements state not being restored + # v1.10.32 ## 03/28/2022 diff --git a/plugins/admin/blueprints.yaml b/plugins/admin/blueprints.yaml index a236dfd..4c7caa8 100644 --- a/plugins/admin/blueprints.yaml +++ b/plugins/admin/blueprints.yaml @@ -1,7 +1,7 @@ name: Admin Panel slug: admin type: plugin -version: 1.10.32 +version: 1.10.33.1 description: Adds an advanced administration panel to manage your site icon: empire author: @@ -16,7 +16,7 @@ license: MIT dependencies: - { name: grav, version: '>=1.7.32' } - - { name: form, version: '>=6.0.0' } + - { name: form, version: '>=6.0.1' } - { name: login, version: '>=3.7.0' } - { name: email, version: '>=3.1.6' } - { name: flex-objects, version: '>=1.2.0' } diff --git a/plugins/admin/hebe.json b/plugins/admin/hebe.json new file mode 100644 index 0000000..b99bbbb --- /dev/null +++ b/plugins/admin/hebe.json @@ -0,0 +1,15 @@ +{ + "project":"grav-plugin-admin", + "platforms":{ + "grav":{ + "nodes":{ + "plugin":[ + { + "source":"/", + "destination":"/user/plugins/admin" + } + ] + } + } + } +} diff --git a/plugins/admin/languages/en.yaml b/plugins/admin/languages/en.yaml index b80e3ff..3d82bcd 100644 --- a/plugins/admin/languages/en.yaml +++ b/plugins/admin/languages/en.yaml @@ -191,6 +191,8 @@ PLUGIN_ADMIN: FILE_COULD_NOT_BE_DELETED: "File could not be deleted" FILE_NOT_FOUND: "File not found" NO_FILE_FOUND: "No file found" + FIELD_REORDER_SUCCESSFUL: "Media Order updated for field '%s'" + FIELD_REORDER_FAILED: "An error occurred while storing the media order for the field '%s'" GRAV_WAS_SUCCESSFULLY_UPDATED_TO: "Grav was successfully updated to" GRAV_UPDATE_FAILED: "Grav update failed" EVERYTHING_UPDATED: "Everything updated" diff --git a/plugins/admin/themes/grav/app/forms/fields/elements.js b/plugins/admin/themes/grav/app/forms/fields/elements.js index c489e90..58aaa61 100644 --- a/plugins/admin/themes/grav/app/forms/fields/elements.js +++ b/plugins/admin/themes/grav/app/forms/fields/elements.js @@ -8,3 +8,5 @@ $(document).on('change', '[data-grav-elements] select', (event) => { $(`[id^="${id}_"]`).css('display', 'none'); $(`[id="${id}__${value}"]`).css('display', 'inherit'); }); + +$('[data-grav-elements] select').trigger('change'); diff --git a/plugins/admin/themes/grav/app/forms/fields/iconpicker.js b/plugins/admin/themes/grav/app/forms/fields/iconpicker.js old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/app/pages/page/media.js b/plugins/admin/themes/grav/app/pages/page/media.js index 9a0ad73..a38d53f 100644 --- a/plugins/admin/themes/grav/app/pages/page/media.js +++ b/plugins/admin/themes/grav/app/pages/page/media.js @@ -140,7 +140,7 @@ export default class PageMedia extends FilesField { if (status.width) { const input = this.container.closest('.pagemedia-field').find('.media-resizer'); - updateMediaSizes(input, status.width, false); + updateMediaSizes(input[0], status.width, false); } } @@ -231,21 +231,23 @@ export default class PageMedia extends FilesField { } export const updateMediaSizes = (input, width, store = true) => { - const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}'); + const storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia'; + const status = JSON.parse(Cookies.get(storageLocation) || '{}'); const height = 150 * width / 200; - const media = input.closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]'); + const media = $(input).closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]'); media.css({ width, height }); if (store) { const data = Object.assign({}, status, { width }); - Cookies.set('grav-admin-pagemedia', JSON.stringify(data), { expires: Infinity }); + Cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity }); } }; export const updateMediaCollapseStatus = (element, store = true) => { - const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}'); + const storageLocation = element.dataset.storageLocation || 'grav-admin-pagemedia'; + const status = JSON.parse(Cookies.get(storageLocation) || '{}'); element = $(element); const icon = element.find('i.fa'); @@ -262,7 +264,7 @@ export const updateMediaCollapseStatus = (element, store = true) => { if (store) { const data = Object.assign({}, status, { collapsed }); - Cookies.set('grav-admin-pagemedia', JSON.stringify(data), { expires: Infinity }); + Cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity }); } }; @@ -270,7 +272,7 @@ $(document).on('input', '.media-resizer', (event) => { const target = $(event.currentTarget); const width = target.val(); - updateMediaSizes(target, width); + updateMediaSizes(event.currentTarget, width); }); $(document).on('click', '.media-collapser', (event) => { @@ -278,13 +280,14 @@ $(document).on('click', '.media-collapser', (event) => { }); $(document).ready(() => { - const status = JSON.parse(Cookies.get('grav-admin-pagemedia') || '{}'); - if (status.width) { - $('.media-resizer').each((index, input) => { - input = $(input); + $('.media-resizer').each((index, input) => { + const storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia'; + const status = JSON.parse(Cookies.get(storageLocation) || '{}'); + + if (status.width) { updateMediaSizes(input, status.width, false); - }); - } + } + }); }); export let Instance = new PageMedia(); diff --git a/plugins/admin/themes/grav/css/chartist.min.css b/plugins/admin/themes/grav/css/chartist.min.css old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/css/fork-awesome.min.css b/plugins/admin/themes/grav/css/fork-awesome.min.css old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/css/iconpicker.css b/plugins/admin/themes/grav/css/iconpicker.css old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/fonts/forkawesome-webfont.eot b/plugins/admin/themes/grav/fonts/forkawesome-webfont.eot old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/fonts/forkawesome-webfont.svg b/plugins/admin/themes/grav/fonts/forkawesome-webfont.svg old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/fonts/forkawesome-webfont.ttf b/plugins/admin/themes/grav/fonts/forkawesome-webfont.ttf old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/fonts/forkawesome-webfont.woff b/plugins/admin/themes/grav/fonts/forkawesome-webfont.woff old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/fonts/forkawesome-webfont.woff2 b/plugins/admin/themes/grav/fonts/forkawesome-webfont.woff2 old mode 100755 new mode 100644 diff --git a/plugins/admin/themes/grav/js/admin.min.js b/plugins/admin/themes/grav/js/admin.min.js index 990393d..a5583ba 100644 --- a/plugins/admin/themes/grav/js/admin.min.js +++ b/plugins/admin/themes/grav/js/admin.min.js @@ -4404,7 +4404,7 @@ var PageMedia = /*#__PURE__*/function (_FilesField) { if (status.width) { var input = this.container.closest('.pagemedia-field').find('.media-resizer'); - updateMediaSizes(input, status.width, false); + updateMediaSizes(input[0], status.width, false); } } }, { @@ -4510,9 +4510,10 @@ var PageMedia = /*#__PURE__*/function (_FilesField) { var updateMediaSizes = function updateMediaSizes(input, width) { var store = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}'); + var storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia'; + var status = JSON.parse(cookies.get(storageLocation) || '{}'); var height = 150 * width / 200; - var media = input.closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]'); + var media = external_jQuery_default()(input).closest('.pagemedia-field').find('.dz-details, [data-dz-thumbnail]'); media.css({ width: width, height: height @@ -4522,14 +4523,15 @@ var updateMediaSizes = function updateMediaSizes(input, width) { var data = Object.assign({}, status, { width: width }); - cookies.set('grav-admin-pagemedia', JSON.stringify(data), { + cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity }); } }; var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) { var store = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}'); + var storageLocation = element.dataset.storageLocation || 'grav-admin-pagemedia'; + var status = JSON.parse(cookies.get(storageLocation) || '{}'); element = external_jQuery_default()(element); var icon = element.find('i.fa'); var container = element.closest('.pagemedia-field'); @@ -4545,7 +4547,7 @@ var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) { var data = Object.assign({}, status, { collapsed: collapsed }); - cookies.set('grav-admin-pagemedia', JSON.stringify(data), { + cookies.set(storageLocation, JSON.stringify(data), { expires: Infinity }); } @@ -4553,20 +4555,20 @@ var updateMediaCollapseStatus = function updateMediaCollapseStatus(element) { external_jQuery_default()(document).on('input', '.media-resizer', function (event) { var target = external_jQuery_default()(event.currentTarget); var width = target.val(); - updateMediaSizes(target, width); + updateMediaSizes(event.currentTarget, width); }); external_jQuery_default()(document).on('click', '.media-collapser', function (event) { updateMediaCollapseStatus(event.currentTarget); }); external_jQuery_default()(document).ready(function () { - var status = JSON.parse(cookies.get('grav-admin-pagemedia') || '{}'); + external_jQuery_default()('.media-resizer').each(function (index, input) { + var storageLocation = input.dataset.storageLocation || 'grav-admin-pagemedia'; + var status = JSON.parse(cookies.get(storageLocation) || '{}'); - if (status.width) { - external_jQuery_default()('.media-resizer').each(function (index, input) { - input = external_jQuery_default()(input); + if (status.width) { updateMediaSizes(input, status.width, false); - }); - } + } + }); }); var media_Instance = new PageMedia(); ;// CONCATENATED MODULE: ./app/pages/page/multilang.js @@ -9695,6 +9697,7 @@ external_jQuery_default()(document).on('change', '[data-grav-elements] select', external_jQuery_default()("[id^=\"".concat(id, "_\"]")).css('display', 'none'); external_jQuery_default()("[id=\"".concat(id, "__").concat(value, "\"]")).css('display', 'inherit'); }); +external_jQuery_default()('[data-grav-elements] select').trigger('change'); ;// CONCATENATED MODULE: ./app/forms/fields/index.js @@ -15265,4 +15268,4 @@ module.exports = jQuery; /******/ Grav = __webpack_exports__; /******/ /******/ })() -; +; \ No newline at end of file diff --git a/plugins/admin/themes/grav/js/vendor.min.js b/plugins/admin/themes/grav/js/vendor.min.js index cb7a17a..686e532 100644 --- a/plugins/admin/themes/grav/js/vendor.min.js +++ b/plugins/admin/themes/grav/js/vendor.min.js @@ -4599,7 +4599,7 @@ return Chartist; // If we're not in Markdown mode, fall back to normal newlineAndIndent var eolState = cm.getStateAfter(pos.line); var inner = CodeMirror.innerMode(cm.getMode(), eolState); - if (inner.mode.name !== "markdown") { + if (inner.mode.name !== "markdown" && inner.mode.helperType !== "markdown") { cm.execCommand("newlineAndIndent"); return; } else { @@ -15331,7 +15331,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) { addLegacyProps(CodeMirror); - CodeMirror.version = "5.65.1"; + CodeMirror.version = "5.65.2"; return CodeMirror; @@ -15840,6 +15840,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { stream.eatWhile(/[\w\$_]/); return "meta"; + }, + '"': function(stream, state) { + if (!stream.match('""\n')) return false; + state.tokenize = tokenTripleString; + return state.tokenize(stream, state); } }, modeProps: {fold: ["brace", "import"]} @@ -17334,7 +17339,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) { } function getTagRegexp(tagName, anchored) { - return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); + return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i"); } function addTags(from, to) { diff --git a/plugins/admin/themes/grav/templates/forms/fields/column/column.html.twig b/plugins/admin/themes/grav/templates/forms/fields/column/column.html.twig index 6c5d426..1308fde 100644 --- a/plugins/admin/themes/grav/templates/forms/fields/column/column.html.twig +++ b/plugins/admin/themes/grav/templates/forms/fields/column/column.html.twig @@ -1,7 +1,7 @@ {% extends "forms/field.html.twig" %} {% block field %} - {% embed 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %} + {% embed 'forms/default/fields.html.twig' with {name: name, fields: field.fields} %} {% block outer_markup_field_open %}