Skip to content

Commit

Permalink
Merge branch 'master' into datengraben/add-phpstan-action
Browse files Browse the repository at this point in the history
  • Loading branch information
datengraben authored Jan 13, 2025
2 parents 322d6a2 + 54add42 commit 2cc1fa5
Show file tree
Hide file tree
Showing 55 changed files with 3,901 additions and 3,998 deletions.
3 changes: 2 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ phpunit
project.json
README.md
tsconfig.*
webpack.config.js
webpack.config.js
phpstan.neon
5 changes: 4 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ module.exports = function (grunt) {
],
tasks: [
'dart-sass:adminDev', 'dart-sass:publicDev'
]
],
options: {
livereload: true
}
},
js: {
files: [
Expand Down
40 changes: 37 additions & 3 deletions assets/admin/css/admin.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@charset "UTF-8";
/*
* Admin styles
*
Expand Down Expand Up @@ -3176,15 +3177,15 @@
*
*/
/* -------------------- Boxes -------------------- */
.cb-box {
.cb-box, .cb-admin-page .cb-admin-cols div ul li {
background: var(--commonsbooking-color-gray-background);
overflow: hidden;
border-radius: var(--commonsbooking-radius);
margin-bottom: var(--commonsbooking-spacer);
padding: var(--commonsbooking-spacer-small)/2 var(--commonsbooking-spacer-small);
}
@media (min-width: 37.5em) {
.cb-box {
.cb-box, .cb-admin-page .cb-admin-cols div ul li {
padding: var(--commonsbooking-spacer) var(--commonsbooking-spacer-big);
}
}
Expand Down Expand Up @@ -3507,7 +3508,40 @@ a.disabled {
display: none;
}

/* Booking form */
/* Map creation */
/*
* The CPT creation form map
*/
#cmb2-metabox-cb_map-custom-fields .map-organizer .cmb2-metabox-title {
font-size: x-large;
}
#cmb2-metabox-cb_map-custom-fields .map-organizer .cmb2-metabox-title:before {
/* arrow to right */
content: "→ ";
}
#cmb2-metabox-cb_map-custom-fields .cmb-group-name {
font-size: x-large;
font-weight: bold;
}
#cmb2-metabox-cb_map-custom-fields .cmb-group-name:before {
content: "→ ";
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field {
display: flex;
align-items: center;
flex-wrap: nowrap;
gap: 10px;
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field code {
white-space: nowrap;
margin-right: 10px;
}
#cmb2-metabox-cb_map-custom-fields #shortcode-field .button {
padding: 5px 10px;
line-height: 1.5;
}

/* Plugin update page */
/**
* Plugin list update message
*
Expand Down
63 changes: 63 additions & 0 deletions assets/admin/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,69 @@
});
})(jQuery);

(function($) {
"use strict";
$(function() {
const mapSettingsForm = $("#cmb2-metabox-cb_map-custom-fields");
const hideFieldset = function(set) {
$.each(set, function() {
$(this).parents(".cmb-row").hide();
});
};
const showFieldset = function(set) {
$.each(set, function() {
$(this).parents(".cmb-row").show();
});
};
const copyToClipboard = function(element) {
let code = $(element).find("code")[0];
let text = code.innerText;
navigator.clipboard.writeText(text).then(function() {
let button = $(element).find(".button");
let buttonText = button.text();
button.text("✓");
button.disabled = true;
setTimeout(function() {
button.text(buttonText);
button.disabled = false;
}, 2e3);
});
};
const copyToClipboardButton = $("#shortcode-field").find(".button");
copyToClipboardButton.on("click", function() {
copyToClipboard($("#shortcode-field"));
});
function handleCustomFileInput(fileSelectorID, fileInputFields) {
const markerFileSelect = document.querySelector(fileSelectorID);
const handleSelectCustomMarker = function() {
showFieldset(fileInputFields);
if (markerFileSelect.value === "") {
hideFieldset(fileInputFields);
}
};
handleSelectCustomMarker();
const observerConfig = {
attributes: true,
childList: false,
subtree: false
};
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "value") {
handleSelectCustomMarker();
}
});
});
observer.observe(markerFileSelect, observerConfig);
}
if (mapSettingsForm.length) {
handleCustomFileInput("#custom_marker_media", [ $("#marker_icon_width"), $("#marker_icon_height"), $("#marker_icon_anchor_x"), $("#marker_icon_anchor_y") ]);
handleCustomFileInput("#custom_marker_cluster_media", [ $("#marker_cluster_icon_width"), $("#marker_cluster_icon_height") ]);
handleCustomFileInput("#marker_item_draft_media", [ $("#marker_item_draft_icon_width"), $("#marker_item_draft_icon_height"), $("#marker_item_draft_icon_anchor_x"), $("#marker_item_draft_icon_anchor_y") ]);
}
});
})(jQuery);

(function($) {
"use strict";
$(function() {
Expand Down
2 changes: 1 addition & 1 deletion assets/admin/js/admin.min.js

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions assets/admin/js/src/map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
(function ($) {
'use strict';
$(function () {
const mapSettingsForm = $("#cmb2-metabox-cb_map-custom-fields");

const hideFieldset = function (set) {
$.each(set, function () {
$(this).parents('.cmb-row').hide();
});
};

/**
* Show set-elements.
* @param set
*/
const showFieldset = function (set) {
$.each(set, function () {
$(this).parents('.cmb-row').show();
});
};

const copyToClipboard = function (element) {
let code = $(element).find('code')[0];
let text = code.innerText;
navigator.clipboard.writeText(text).then(function () {
let button = $(element).find('.button');
let buttonText = button.text();
button.text('✓');
button.disabled = true;
setTimeout(function () {
button.text(buttonText);
button.disabled = false;
}, 2000);
});
}

const copyToClipboardButton = $('#shortcode-field').find('.button');
copyToClipboardButton.on('click', function () {
copyToClipboard($('#shortcode-field'));
});

function handleCustomFileInput(fileSelectorID, fileInputFields) {
const markerFileSelect = document.querySelector(fileSelectorID);
const handleSelectCustomMarker = function () {
showFieldset(fileInputFields);
if (markerFileSelect.value === '') {
hideFieldset(fileInputFields);
}
};

handleSelectCustomMarker();

const observerConfig = {attributes: true, childList: false, subtree: false};
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === 'value') {
handleSelectCustomMarker();
}
});
});
observer.observe(markerFileSelect, observerConfig);
}

if (mapSettingsForm.length) {
handleCustomFileInput(
'#custom_marker_media',
[
$('#marker_icon_width'),
$('#marker_icon_height'),
$('#marker_icon_anchor_x'),
$('#marker_icon_anchor_y')
]);
handleCustomFileInput(
'#custom_marker_cluster_media',
[
$('#marker_cluster_icon_width'),
$('#marker_cluster_icon_height')
]
);
handleCustomFileInput(
'#marker_item_draft_media',
[
$('#marker_item_draft_icon_width'),
$('#marker_item_draft_icon_height'),
$('#marker_item_draft_icon_anchor_x'),
$('#marker_item_draft_icon_anchor_y')
]
);
}
});
})(jQuery);
5 changes: 4 additions & 1 deletion assets/admin/sass/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
/* Booking form */
@use "./partials/form-booking";

/* Booking form */
/* Map creation */
@use "./partials/form-map";

/* Plugin update page */
@use "./partials/plugin_update";

/* Edit Screens Backend */
Expand Down
4 changes: 3 additions & 1 deletion assets/admin/sass/partials/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
*/

@use "../../../global/sass/partials/extends";

.cb-admin-page {
.cb-admin-cols {
display: flex;
Expand All @@ -18,7 +20,7 @@
ul {
li {
margin-top: 15px;
@extend .cb-box !optional;
@extend .cb-box;
.cb-summmary-item {
font-weight: bold;
}
Expand Down
41 changes: 41 additions & 0 deletions assets/admin/sass/partials/_form-map.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* The CPT creation form map
*/

#cmb2-metabox-cb_map-custom-fields {
.map-organizer {
.cmb2-metabox-title {
font-size: x-large;
}
.cmb2-metabox-title:before {
/* arrow to right */
content: "\2192 ";
}
}

.cmb-group-name {
font-size: x-large;
font-weight: bold;
}

.cmb-group-name:before {
content: "\2192 ";
}

#shortcode-field {
display: flex;
align-items: center;
flex-wrap: nowrap;
gap: 10px;
}

#shortcode-field code {
white-space: nowrap;
margin-right: 10px;
}

#shortcode-field .button {
padding: 5px 10px;
line-height: 1.5;
}
}
Loading

0 comments on commit 2cc1fa5

Please sign in to comment.