Skip to content

Commit

Permalink
Merge branch 'develop' into feature/94738
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwaclawczyk committed Aug 1, 2024
2 parents 3f5c7eb + 0024ff2 commit 606e1cb
Show file tree
Hide file tree
Showing 30 changed files with 233 additions and 98 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- `width` and `height` attributes to menu node images (DEV-102271)
- Option to specify customer groups for each node (DEV-94738)
- Snowdog branding in admin panel (DEV-105762)
- Automatically open collapsed menu node when dragging another node inside (DEV-101986)
- Duplicate node functionality (DEV-104364)
### Fixed
- Impossible to change Cms block, Cms page link after selecting displayed block (DEV-104546)
- Submenu template name issue ([#321](https://github.com/SnowdogApps/magento2-menu/pull/321)) (DEV-105672)
### Updated
- vue-select to 3.20.0 (DEV-104546)

## [2.26.0] - 2024-03-29
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Menu/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function execute(): ResultInterface
$resultPage = $this->resultPageFactory->create();
$title = $menuId ? __('Edit Menu %1', $menu->getTitle()) : __('New Menu');
$this->initPage($resultPage)->addBreadcrumb($title, $title);
$resultPage->getConfig()->getTitle()->prepend(__('Menus'));
$resultPage->getConfig()->getTitle()->prepend(__('Snowdog Menus'));
$resultPage->getConfig()->getTitle()->prepend($menu->getId() ? $menu->getTitle() : __('New Menu'));

return $resultPage;
Expand Down
1 change: 1 addition & 0 deletions Controller/Adminhtml/Menu/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function execute()
$this->messageManager->addNoticeMessage($this->importExportHelper->getMaxUploadSizeMessage());

$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->getConfig()->getTitle()->prepend(__('Snowdog Menus'));
$resultPage->getConfig()->getTitle()->prepend(__('Menu Import'));

return $resultPage;
Expand Down
15 changes: 9 additions & 6 deletions Controller/Adminhtml/Menu/ImportCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Snowdog\Menu\Controller\Adminhtml\Menu;

use Exception;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Snowdog\Menu\Api\MenuManagementInterface;
use Magento\Framework\Exception\NoSuchEntityException;

class ImportCategories extends Action implements HttpPostActionInterface
{
Expand Down Expand Up @@ -47,24 +47,27 @@ public function execute()
{
$categoryId = (int) $this->_request->getParam('category_id');
$depth = $this->_request->getParam('depth');
if (!is_numeric($depth)) {
$depth = null;
}

$result = $this->resultJsonFactory->create();
try {
if ($depth != 'NaN' && !is_numeric($depth)) {
throw new Exception('Please add a valid number for Level of depth field');
}

$categoryTree = $this->menuManagement->getCategoryNodeList($categoryId, $depth);

$output = [
'success' => 1,
'list' => $categoryTree
];
} catch (NoSuchEntityException $exception) {
} catch (Exception $exception) {
$output = [
'success' => 0,
'message' => $exception->getMessage(),
'list' => []
];
}

$result = $this->resultJsonFactory->create();
$result->setData($output);

return $result;
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Menu/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Index extends Action
public function execute()
{
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->getConfig()->getTitle()->prepend(__('Menus'));
$resultPage->getConfig()->getTitle()->prepend(__('Snowdog Menus'));
return $resultPage;
}
}
6 changes: 3 additions & 3 deletions Model/TemplateResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class TemplateResolver
* @var Registry
*/
private $registry;

/**
* @var Validator
*/
private $validator;

/**
* @var AssetRepository
*/
Expand Down Expand Up @@ -164,7 +164,7 @@ private function getTemplateList($nodeType = '', $defaultTemplateLabel = '')
continue;
}

$fileName = str_replace([$themeDir, '.' . $extension], '', $file);
$fileName = $this->ioFile->getPathInfo($file)['filename'];
if (!in_array($fileName, array_column($result, 'id'))) {
$result[] = ['id' => $fileName];
}
Expand Down
13 changes: 9 additions & 4 deletions Service/Menu/SaveRequestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,22 @@ private function processImageParameters(array $nodeData, NodeInterface &$nodeObj
{
$nodeObject->setImageAltText($nodeData[NodeInterface::IMAGE_ALT_TEXT] ?? null);

if ($nodeObject->getImage() && empty($nodeData['image'])) {
$this->nodeImageFile->delete($nodeObject->getImage());
}

if (empty($nodeData[NodeInterface::IMAGE])) {
$nodeObject->setImageWidth(null);
$nodeObject->setImageHeight(null);
$nodeObject->setImage(null);

if ($nodeObject->getImage()) {
$this->nodeImageFile->delete($nodeObject->getImage());
}

return;
}

if (!$nodeObject->getImage()) {
$nodeObject->setImage($nodeData[NodeInterface::IMAGE]);
}

if (empty($nodeData[NodeInterface::IMAGE_WIDTH])
|| empty($nodeData[NodeInterface::IMAGE_HEIGHT])
) {
Expand Down
3 changes: 3 additions & 0 deletions view/adminhtml/layout/snowmenu_menu_create.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<head>
<css src="Snowdog_Menu::css/lib/v-select.css"/>
</head>
<update handle="snowmenu_menu_edit"/>
</page>
3 changes: 3 additions & 0 deletions view/adminhtml/layout/snowmenu_menu_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<head>
<css src="Snowdog_Menu::css/lib/v-select.css"/>
</head>
<body>
<referenceContainer name="content">
<uiComponent name="snowmenu_menu_form"/>
Expand Down
1 change: 1 addition & 0 deletions view/adminhtml/templates/menu/nodes.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ $vueComponents = $block->getVueComponents();
"createSubNode" : "<?= __('to create sub node or drag and drop other nodes here.') ?>",
"append" : "<?= __('Append') ?>",
"edit" : "<?= __('Edit') ?>",
"duplicate" : "<?= __('Duplicate') ?>",
"delete" : "<?= __('Delete') ?>",
"addNode" : "<?= __('New node') ?>",
"nodeType" : "<?= __('Node Type') ?>",
Expand Down
1 change: 1 addition & 0 deletions view/adminhtml/ui_component/snowmenu_menu_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
</field>
<field name="depth" formElement="input">
<settings>
<elementTmpl>Snowdog_Menu/form/element/depth-input</elementTmpl>
<dataType>int</dataType>
<label translate="true">Level of depth</label>
<validation>
Expand Down
1 change: 1 addition & 0 deletions view/adminhtml/web/css/lib/v-select.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion view/adminhtml/web/css/source/_module.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import './lib/_v-select.less';
@import './lib/_vue-treeselect.less';

@import './blocks/_image-upload';
Expand All @@ -9,3 +8,5 @@
@import './blocks/_vue-treeselect.less';
@import './blocks/_var.less';
@import './blocks/_vddl-base.less';

@import 'module/menu/_menu';
8 changes: 7 additions & 1 deletion view/adminhtml/web/css/source/blocks/_panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
padding-left: 5px;
}

&__buttom {
&__button {
border-color: transparent;
color: @primary__color;
background-color: transparent;
Expand Down Expand Up @@ -107,6 +107,12 @@
content: @icon-delete__content;
}
}

&--duplicate {
height: @snow-menu__item-height;
padding-top: 4px;
vertical-align: middle;
}
}

&__collapse {
Expand Down
1 change: 0 additions & 1 deletion view/adminhtml/web/css/source/lib/_v-select.less

This file was deleted.

9 changes: 9 additions & 0 deletions view/adminhtml/web/css/source/module/menu/_menu.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.admin__menu [data-ui-id^='menu-snowdog-menu-menus'] span:before {
background: url('@{baseDir}Snowdog_Menu/images/logo-menu.svg') no-repeat center;
content: '';
display: inline-block;
margin-right: 10px;
vertical-align: top;
width: 19px;
height: 19px;
}
Loading

0 comments on commit 606e1cb

Please sign in to comment.