Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/2.28.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarek Krupiński committed Mar 31, 2023
2 parents b0c874e + f3ca08e commit dbac9eb
Show file tree
Hide file tree
Showing 20 changed files with 575 additions and 32 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ USE GITHUB ISSUE/PULL REQUEST NUMBERS, NOT INTERNAL ONE
### Updated

## [Released]

## [2.28.3] - 2023-03-31
### Added
- Added styles and templates for MageMe_WebForms (old VladimirPopov_WebForms) module (#575)
### Fixed
- Fix call to not existing method, backwards compatible up to 2.2.0 (#580)
## [2.28.2] - 2022-09-05
### Fixed
- Magento_PageBuilder styles imports (#571)
Expand Down
10 changes: 10 additions & 0 deletions MageMe_WebForms/layout/default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<head>
<remove src="MageMe_WebForms::css/styles.css"/>
<remove src="MageMe_Core::css/styles.css"/>
</head>
</page>
49 changes: 49 additions & 0 deletions MageMe_WebForms/styles/modules/_webforms.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
$webforms_please-wait-padding : $spacer $spacer--medium !default;
$webforms_please-wait-align-items : center !default;
$webforms_please-wait-justify-content: center !default;
$webforms_please-wait-height : 100% !default;

.webforms {
.form {
.actions-toolbar {
@extend .dashboard-actions-toolbar;
}

.actions-toolbar,
.fieldset,
.field {
padding: 0;
float: none;
}

.validation-advice__number {
margin: -$spacer 0 $spacer--medium;
}

.please-wait {
display: flex;
padding: $webforms_please-wait-padding;
align-items: $webforms_please-wait-align-items;
justify-content: $webforms_please-wait-justify-content;
height: $webforms_please-wait-height;
}
}

.webforms-field {
float: none;
}

&__modal-container {
overflow: auto;
}

&__modal-content {
padding-top: $spacer--semi-medium;
}

// critical input extends in Magento_Theme/styles/modules/_input-extends.scss
.type-select,
.type-country {
@extend .select--native;
}
}
78 changes: 78 additions & 0 deletions MageMe_WebForms/templates/button/default.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

use MageMe\WebForms\Block\Widget\Button;

/** @var Button $block */
?>

<button
class="
button
primary
<?= $block->escapeHtmlAttr($this->getButtonCssClass()) ?>
"
data-modal-trigger="<?= $block->escapeHtmlAttr($this->getContainerId()) ?>"
data-mage-init='{
"modal": {
"useAjax": true,
"ajaxUrl": "<?= $block->escapeUrl($block->getAjaxUrl()) ?>",
"ajaxTarget": "#target_<?= $block->escapeHtmlAttr($this->getContainerId()) ?>",
"ajaxErrorMessage": "<?= $block->escapeHtmlAttr(__('Failed to load modal content.')) ?>"
}
}'
type="button"
title="<?= $block->escapeHtmlAttr($this->getButtonText()) ?>"
>
<?= $block->escapeHtml(__($this->getButtonText())) ?>
</button>
<div
role="dialog"
aria-hidden="true"
id="<?= $block->escapeHtmlAttr($this->getContainerId()) ?>"
data-modal="<?= $block->escapeHtmlAttr($this->getContainerId()) ?>"
class="
modal
modal--button
<?= str_replace('"', '\"', $block->escapeHtmlAttr($this->getPopupCssClass())) ?>
"
>
<div
class="modal__container webforms__modal-container"
role="document"
tabindex="0"
>
<div class="modal__content webforms__modal-content">
<div
id="target_<?= $block->escapeHtmlAttr($this->getContainerId()) ?>"
class="
webforms-popup
mfp-hide
"
>
<!-- webform modal content -->
</div>
</div>
<button
class="
button
button--icon
button--rotate-icon
modal__close-button
"
type="button"
aria-label="<?= $block->escapeHtmlAttr(__('Close modal')) ?>"
>
<svg
class="
icon
button__icon
modal__close-button-icon
"
role="presentation"
focusable="false"
>
<use href="<?= $block->escapeUrl($block->getViewFileUrl('images/icons-sprite.svg#close')); ?>"></use>
</svg>
</button>
</div>
</div>
82 changes: 82 additions & 0 deletions MageMe_WebForms/templates/form/element/field/type/select.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/**
* @var Select $block
*/

use MageMe\WebForms\Block\Form\Element\Field\Type\Select;

$validationRules = $block->getValidationRules();
$validationDescriptions = $block->getValidationDescriptions();
?>
<div class="select select--native">
<select
id='<?= $block->escapeHtmlAttr($block->getFieldId()) ?>'
name='<?= $block->escapeHtmlAttr($block->getFieldName()) ?>'
class='
select__field
<?= $block->escapeHtmlAttr($block->getFieldClass()) ?>
'
data-mage-init='{
"select": {
"options": {
"shouldSort": false
}
}
}'
style='<?= $block->escapeHtmlAttr($block->getFieldStyle()) ?>'
<?php if ($validationRules): ?>
data-validate="{<?= implode(", ", $validationRules); ?>}"
<?php endif; ?>
<?php foreach ($validationDescriptions as $key => $data): ?>
<?= /* @noEscape */ $key . '=' . '"' . htmlspecialchars((string)$data) . '"'; ?>
<?php endforeach; ?>
<?php if ($block->getIsLabelHidden()): ?>
aria-label="<?= $block->escapeHtmlAttr($block->getFieldLabel()) ?>"
<?php else: ?>
aria-labelledby="label_<?= $block->escapeHtmlAttr($block->getFieldId()) ?>"
<?php endif; ?>
<?php if ($block->getIsRequired()): ?>
aria-required="true"
<?php endif; ?>
<?php if ($block->getAutocomplete()): ?>
autocomplete="<?= $block->escapeHtmlAttr($block->getAutocomplete()) ?>"
<?php endif; ?>
<?php if ($block->getIsMultiselect()): ?>
multiple
<?php endif; ?>
<?= /* @noEscape */ htmlspecialchars((string)$block->getCustomAttributes()) ?>
>
<?php
foreach ($block->getFieldOptions() as $option): ?>
<?php
$checked = false;
$disabled = false;
if ($option["checked"]) {
$checked = 'selected';
}
if ($option["disabled"]) {
$disabled = 'disabled';
}
if (isset($option["value"])): ?>
<?php
$value = htmlspecialchars((string)$option["value"]);
if ($option['null']) {
$value = '';
}
if (!empty($option['optgroup']) && !empty($option['label'])): ?>
<optgroup label="<?= $block->escapeHtmlAttr($block->applyTranslation($option['label'])); ?>">
<?php elseif (!empty($option['optgroup_close'])): ?>
</optgroup>
<?php else: ?>
<option
value="<?= $block->escapeHtmlAttr($value) ?>"
<?= /* @noEscape */ $checked ?>
<?= /* @noEscape */ $disabled ?>
>
<?= $block->escapeHtml($block->applyTranslation($option['label'])); ?>
</option>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php
/**
* @var SelectCheckbox $block
*/

use MageMe\WebForms\Block\Form\Element\Field\Type\SelectCheckbox;

$validationRules = $block->getValidationRules();
$validationDescriptions = $block->getValidationDescriptions();
$escapedFieldId = $block->escapeHtmlAttr($block->getFieldId());
?>

<div>
<?php
$options = $block->getFieldOptions();
foreach ($block->getFieldOptions() as $i => $option): ?>
<?php
$checked = false;
if ($option["checked"]) {
$checked = 'checked';
}
if (isset($option["value"]) && empty($option['optgroup']) && empty($option['optgroup_close'])): ?>
<?php
$label = $block->applyTranslation($option["label"]);
if ($option["image_src"]) {
$label = "<figure><img src='{$option['image_src']}'/><figcaption>{$label}</figcaption></figure>";
}
?>

<div
class="
field
choice
option-<?= $block->escapeHtmlAttr($i) ?>
checkbox
"
style='<?= $block->escapeHtmlAttr($block->getFieldStyle()) ?>'
>
<input
id='<?= $escapedFieldId . $block->escapeHtmlAttr($i) ?>'
name='<?= $block->escapeHtmlAttr($block->getFieldName()) ?>'
type='checkbox'
value="<?= /* @noEscape */ htmlspecialchars((string)$option["value"]) ?>"
class='checkbox__field'
<?php if ($validationRules): ?>
data-validate="{<?= implode(", ", $validationRules); ?>}"
<?php endif; ?>
<?php foreach ($validationDescriptions as $key => $data): ?>
<?= $key . '=' . '"' . $block->escapeHtmlAttr(htmlspecialchars((string)$data)) . '"'; ?>
<?php endforeach; ?>
data-uid="<?= $block->escapeHtmlAttr($block->getFieldUid()) ?>"
aria-labelledby="
<?= $escapedFieldId . $block->escapeHtmlAttr($i) ?>_label
<?php if(!$block->getField()->getIsLabelHidden()): ?>
label_<?= $escapedFieldId ?>
<?php endif; ?>
"
<?= /* @noEscape */ $checked ?>
<?= /* @noEscape */ htmlspecialchars((string)$block->getCustomAttributes()) ?>
/>

<svg
class="checkbox__icon checkbox__icon--checked"
role="presentation"
focusable="false"
>
<use href="<?= $block->escapeUrl($block->getViewFileUrl('images/icons-sprite.svg#checked')) ?>"/>
</svg>
<svg
class="checkbox__icon checkbox__icon--unchecked"
role="presentation"
focusable="false"
>
<use href="<?= $block->escapeUrl($block->getViewFileUrl('images/icons-sprite.svg#unchecked')) ?>"/>
</svg>
<label
class="checkbox__label"
id="<?= $escapedFieldId . $block->escapeHtmlAttr($i) ?>_label"
for='<?= $escapedFieldId . $block->escapeHtmlAttr($i) ?>'
>
<?= $block->escapeHtml($label) ?>
</label>
<?php
$tooltip = $block->getField()->getTooltip($option["value"]);
if ($tooltip): ?>
<?= $block->getTooltipBlock()->setTooltip($tooltip)->toHtml(); ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
Loading

2 comments on commit dbac9eb

@vercel
Copy link

@vercel vercel bot commented on dbac9eb Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

alpaca-docs – ./docs

magento2-alpaca-docs.vercel.app
alpaca-docs-git-master-snowdog1.vercel.app
alpaca-docs-snowdog1.vercel.app

@vercel
Copy link

@vercel vercel bot commented on dbac9eb Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.