Skip to content

Commit

Permalink
Merge branch 'master' into magento2.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Dec 26, 2020
2 parents 16f0be9 + 6b30d85 commit 6bbc61b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Service/Export/Renderer/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Magento\Framework\View\FileSystem as ViewFileSystem;
use Magento\Framework\View\Page\Config;
use Magento\Framework\View\Page\Config\RendererInterface;
use Opengento\Gdpr\Model\View\Page\Config\RendererFactory;
use Opengento\Gdpr\Service\Export\Renderer\HtmlRenderer\View\RendererFactory;
use Opengento\Gdpr\Service\Export\Renderer\HtmlRenderer\LayoutInitiatorInterface;
use function extract;
use function ob_end_clean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,53 @@
*/
declare(strict_types=1);

namespace Opengento\Gdpr\Model\View\Page\Config;
namespace Opengento\Gdpr\Service\Export\Renderer\HtmlRenderer\View;

use Magento\Framework\View\Asset\AssetInterface;
use Magento\Framework\View\Asset\File;
use Magento\Framework\View\Asset\GroupedCollection;
use Magento\Framework\View\Asset\PropertyGroup;
use Magento\Framework\View\Page\Config\Renderer as ViewRenderer;
use function file_get_contents;
use function sprintf;
use const PHP_EOL;

class Renderer extends ViewRenderer
{
protected function renderAssetHtml(PropertyGroup $group): string
{
$contentType = $group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE);
$assets = $this->processMerge($group->getAll(), $group);
$attributes = $this->getGroupAttributes($group);
$result = '';

/** @var $asset AssetInterface */
foreach ($assets as $asset) {
$result .= $this->inlineHtml(
$group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE),
$asset->getUrl(),
$this->addDefaultAttributes($this->getAssetContentType($asset), $attributes)
);
if ($asset instanceof File) {
$result .= $this->inlineHtml(
$contentType,
$asset,
$this->addDefaultAttributes($this->getAssetContentType($asset), $attributes)
);
} else {
$result .= sprintf($this->getAssetTemplate($contentType, $attributes), $asset->getUrl()) . PHP_EOL;
}
}

return $result;
}

private function inlineHtml(string $contentType, string $src, ?string $attributes): string
private function inlineHtml(string $contentType, File $asset, ?string $attributes): string
{
switch ($contentType) {
case 'js':
$result = '<script ' . $attributes . '>' . file_get_contents($src) . '</script>';
$result = '<script' . $attributes . '>' . PHP_EOL . $asset->getContent() . '</script>';
break;

case 'css':
$result = '<style ' . $attributes . '>' . file_get_contents($src) . '</style>';
$result = '<style' . $attributes . '>' . PHP_EOL . $asset->getContent() . '</style>';
break;
default:
$result = sprintf($this->getAssetTemplate($contentType, $attributes), $src);
$result = sprintf($this->getAssetTemplate($contentType, $attributes), $asset->getUrl());
break;
}

Expand Down
3 changes: 2 additions & 1 deletion i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@
"Performed By","Durchgeführt von"
"Performed At","Durchgeführt bei"
"State","Staat"
"Message","Nachricht"
"Message","Nachricht"
"Privacy Settings","Datenschutz-Einstellungen"
1 change: 1 addition & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,4 @@ ID,ID
"Performed At","Performed At"
State,State
Message,Message
"Privacy Settings","Privacy Settings"
3 changes: 2 additions & 1 deletion i18n/fr_FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@
"Performed By","Effectué par"
"Performed At","Effectué à"
"State","Etat"
"Message","Message"
"Message","Message"
"Privacy Settings","Paramètres de confidentialité"
3 changes: 2 additions & 1 deletion i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@
"Performed By","Uitgevoerd Door"
"Performed At","Uitgevoerd Op"
"State","Staat"
"Message","Bericht"
"Message","Bericht"
"Privacy Settings","Privacy-instellingen"
31 changes: 18 additions & 13 deletions view/base/web/css/export.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
* See LICENSE bundled with this library for license details.
*/

//
// Common
// _____________________________________________

.customer-privacy-export-personal-data {
.fieldset {
.legend {
font-weight: 600;
text-transform: capitalize;
}
.fieldset {
.legend {
font-weight: 600;
text-transform: capitalize;
}
.items {
.item {
.label {
font-weight: 600;
text-decoration: underline;
text-transform: capitalize;
}
}
}

.items {
.item {
.label {
font-weight: 600;
text-decoration: underline;
text-transform: capitalize;
}
}
}
}
2 changes: 1 addition & 1 deletion view/frontend/web/css/source/_module.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
.enhanced-privacy-popup {
.popup {
&.content{
&.content {
margin: 0;
padding: 10px;
width: auto;
Expand Down

0 comments on commit 6bbc61b

Please sign in to comment.