Skip to content
Code-Schnipsel Gruppen Projekte
Commit 8a38ba65 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next' into 'master'

Next

See merge request !20
Übergeordnete 24714519 4bdd62f0
No related branches found
No related tags found
2 Merge Requests!34Update 'next-4.x' with latest changes from 'main',!20Next
Pipeline #6977 bestanden mit Phase
in 45 Sekunden
werden angezeigt mit 254 Ergänzungen und 72 Löschungen
...@@ -18,6 +18,7 @@ function () { ...@@ -18,6 +18,7 @@ function () {
foreach ($list as $class) { foreach ($list as $class) {
$result[] = [ $result[] = [
'title' => call_user_func([$class, 'itemTitle']), 'title' => call_user_func([$class, 'itemTitle']),
'desc' => call_user_func([$class, 'itemShort']),
'icon' => call_user_func([$class, 'itemIcon']), 'icon' => call_user_func([$class, 'itemIcon']),
'jsControl' => call_user_func([$class, 'itemJsControl']), 'jsControl' => call_user_func([$class, 'itemJsControl']),
'class' => $class 'class' => $class
......
...@@ -110,10 +110,16 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuManagement', [ ...@@ -110,10 +110,16 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuManagement', [
width : 50 width : 50
}, },
{ {
header : QUILocale.get(lg, 'grid.menuTitle'), header : QUILocale.get(lg, 'menu.title'),
dataIndex: 'title', dataIndex: 'title',
dataType : 'string', dataType : 'string',
width : 150 width : 250
},
{
header : QUILocale.get(lg, 'menu.workingTitle'),
dataIndex: 'workingTitle',
dataType : 'string',
width : 350
} }
] ]
}); });
......
<form>
<p>{{text}}</p>
<table class="data-table data-table-flexbox" style="margin-top: 20px">
<tbody>
<tr>
<td>
<label class="field-container">
<span class="field-container-item" title="{{textType}}">
{{textType}}
</span>
<select type="text"
class="field-container-field"
name="itemType"
></select>
</label>
</td>
</tr>
</tbody>
</table>
</form>
\ No newline at end of file
<div class="qui-menuPanel-optionList__option-image">
<span class="{{icon}}"></span>
</div>
<div class="qui-menuPanel-optionList__option-content">
<div class="qui-menuPanel-optionList__option-title">
<input type="radio" name="itemType" data-icon="{{icon}}" value="{{value}}" style="display: none;">
<span>{{title}}</span>
</div>
<div class="qui-menuPanel-optionList__option-desc">{{desc}}</div>
</div>
\ No newline at end of file
...@@ -20,3 +20,51 @@ ...@@ -20,3 +20,51 @@
.quiqqer-menu-menuPanel-innerContainer > div { .quiqqer-menu-menuPanel-innerContainer > div {
width: 100%; width: 100%;
} }
/****************************************/
/* Options list: create and edit window */
/****************************************/
.qui-menuPanel-optionList {
display: grid;
gap: 1rem;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
margin-top: 3rem;
}
.qui-menuPanel-optionList__option {
background: #f5f5f5;
padding: 1rem 1.5rem;
border-radius: 1rem;
cursor: pointer;
display: flex;
gap: 0.5rem 1.5rem;
}
.qui-menuPanel-optionList__option-image {
font-size: 3rem;
width: 4rem;
flex-shrink: 0;
text-align: center;
align-self: flex-start;
opacity: 0.5;
}
.qui-menuPanel-optionList__option-title {
margin-bottom: 0.25rem;
font-weight: bold;
}
.qui-menuPanel-optionList__option-desc {
opacity: 0.75;
}
/* checked */
.qui-menuPanel-optionList__option.checked {
outline: 2px solid;
outline-offset: -2px;
}
.qui-menuPanel-optionList__option.checked .qui-menuPanel-optionList__option-image {
opacity: 1;
}
\ No newline at end of file
...@@ -18,13 +18,13 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -18,13 +18,13 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
'package/quiqqer/menu/bin/classes/IndependentHandler', 'package/quiqqer/menu/bin/classes/IndependentHandler',
'Mustache', 'Mustache',
'text!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.Create.html', 'text!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.ItemCard.html',
'text!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.Settings.html', 'text!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.Settings.html',
'css!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.css' 'css!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.css'
], function (QUI, QUIPanel, QUIMap, QUIMapItem, QUIConfirm, ], function (QUI, QUIPanel, QUIMap, QUIMapItem, QUIConfirm,
QUIContextMenu, QUIContextMenuItem, QUIContextSeparator, InputMultiLang, QUIContextMenu, QUIContextMenuItem, QUIContextSeparator, InputMultiLang,
QUIAjax, QUILocale, IndependentHandler, Mustache, templateCreate, templateSettings) { QUIAjax, QUILocale, IndependentHandler, Mustache, templateItemCard, templateSettings) {
"use strict"; "use strict";
const lg = 'quiqqer/menu'; const lg = 'quiqqer/menu';
...@@ -232,7 +232,7 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -232,7 +232,7 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
if (text === '' || text === '###') { if (text === '' || text === '###') {
text = '?'; text = '?';
} }
Item = new QUIMapItem({ Item = new QUIMapItem({
text : text, text : text,
icon : data.typeIcon, icon : data.typeIcon,
...@@ -303,6 +303,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -303,6 +303,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}; };
}; };
this.setMenuTitle();
let result = toArray(this.$Map.firstChild()); let result = toArray(this.$Map.firstChild());
return this.$refreshItemDisplay().then(() => { return this.$refreshItemDisplay().then(() => {
...@@ -317,6 +319,42 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -317,6 +319,42 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}); });
}, },
/**
* Set the title of this.$Map, so the title changes in the left panel.
* Also set menu title and working title to the variables:
* this.$title
* this.$workingTitle
*
* This function is a small workaround for this user flow:
* "User change the menu title (and working title) and save directly the menu by clicking save-button".
*/
setMenuTitle: function() {
const selected = this.$Map.getSelectedChildren();
if (selected.length === 1 && selected[0].getAttribute('value') !== 'start') {
return;
}
const Title = this.$InnerContainer.getElement('[name="title"]');
const WorkingTitle = this.$InnerContainer.getElement('[name="workingTitle"]');
if (!Title) {
return;
}
selected[0].setAttribute('itemTitle', Title.value);
this.$title = JSON.decode(Title.value);
this.$workingTitle = JSON.decode(WorkingTitle.value);
let current = QUILocale.getCurrent();
if (current in this.$title) {
selected[0].setAttribute('text', this.$title[current]);
selected[0].setAttribute('title', this.$title[current]);
}
},
addItem: function (Parent, where) { addItem: function (Parent, where) {
if (typeof where === 'undefined') { if (typeof where === 'undefined') {
where = 'bottom'; where = 'bottom';
...@@ -335,8 +373,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -335,8 +373,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
new QUIConfirm({ new QUIConfirm({
icon : 'fa fa-plus', icon : 'fa fa-plus',
title : QUILocale.get(lg, 'quiqqer.menu.independent.addItem.title'), title : QUILocale.get(lg, 'quiqqer.menu.independent.addItem.title'),
maxHeight: 400, maxHeight: 550,
maxWidth : 500, maxWidth : 700,
autoclose: false, autoclose: false,
events : { events : {
onOpen: (Win) => { onOpen: (Win) => {
...@@ -344,25 +382,18 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -344,25 +382,18 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
Win.Loader.show(); Win.Loader.show();
Content.set('html', Mustache.render(templateCreate, { Content.set(
text : QUILocale.get(lg, 'create.window.text'), 'html',
textTitle: QUILocale.get('quiqqer/quiqqer', 'title'),
textName : QUILocale.get('quiqqer/quiqqer', 'name'),
textType : QUILocale.get('quiqqer/quiqqer', 'type')
}));
IndependentHandler.getItemTypes().then((list) => { `<p>`+ QUILocale.get(lg, 'create.window.text') +
const Types = Content.getElement('[name="itemType"]'); '</p>' +
'<form style="width: 100%;">' +
for (let i = 0, len = list.length; i < len; i++) { ' <div class="qui-menuPanel-optionList"></div>' +
new Element('option', { '</form>'
html : list[i].title, );
value : list[i].class,
'data-icon': list[i].icon
}).inject(Types);
}
Types.value = 'QUI\\Menu\\Independent\\Items\\Site'; IndependentHandler.getItemTypes().then((list) => {
this.$createOptionList(list, Content);
return QUI.parse(Win.getContent()); return QUI.parse(Win.getContent());
}).then(function () { }).then(function () {
...@@ -376,8 +407,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -376,8 +407,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
let type = Form.elements.itemType.value; let type = Form.elements.itemType.value;
const Option = Form.elements.itemType.getElement( const Option = Form.getElement(
'option[value="' + CSS.escape(type) + '"]' '[value="' + CSS.escape(type) + '"]'
); );
let itemAttributes = { let itemAttributes = {
...@@ -429,11 +460,13 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -429,11 +460,13 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
return; return;
} }
const itemType = Item.getAttribute('itemType');
new QUIConfirm({ new QUIConfirm({
icon : 'fa fa-edit', icon : 'fa fa-edit',
title : QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.title'), title : QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.title'),
maxHeight: 400, maxHeight: 550,
maxWidth : 500, maxWidth : 700,
autoclose: false, autoclose: false,
events : { events : {
onOpen: (Win) => { onOpen: (Win) => {
...@@ -442,27 +475,17 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -442,27 +475,17 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
Content.set( Content.set(
'html', 'html',
QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.message') + `<p>`+ QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.message') +
'' + '</p>' +
'<form style="width: 100%; text-align: center; margin-top: 20px">' + '<form style="width: 100%;">' +
' <select name="itemType"></select>' + ' <div class="qui-menuPanel-optionList"></div>' +
'</form>' '</form>'
); );
Win.Loader.show(); Win.Loader.show();
IndependentHandler.getItemTypes().then((list) => { IndependentHandler.getItemTypes().then((list) => {
const Types = Content.getElement('[name="itemType"]'); this.$createOptionList(list, Content, itemType);
for (let i = 0, len = list.length; i < len; i++) {
new Element('option', {
html : list[i].title,
value : list[i].class,
'data-icon': list[i].icon
}).inject(Types);
}
Types.value = Item.getAttribute('itemType');
return QUI.parse(Win.getContent()); return QUI.parse(Win.getContent());
}).then(function () { }).then(function () {
...@@ -477,8 +500,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -477,8 +500,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
const Form = Content.getElement('form'); const Form = Content.getElement('form');
const type = Form.elements.itemType.value; const type = Form.elements.itemType.value;
const Option = Form.elements.itemType.getElement( const Option = Form.getElement(
'option[value="' + CSS.escape(type) + '"]' '[value="' + CSS.escape(type) + '"]'
); );
Item.setAttribute('itemType', type); Item.setAttribute('itemType', type);
...@@ -496,6 +519,47 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -496,6 +519,47 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}).open(); }).open();
}, },
/**
* Create custom option list based on passed list of menu types
*
* @param list
* @param Content
* @param selected
*/
$createOptionList: function(list, Content, selected = false) {
const OptionsList = Content.getElement('.qui-menuPanel-optionList'),
selectedItem = selected ? selected : 'QUI\\Menu\\Independent\\Items\\Site';
const toggleSelected = function(event) {
OptionsList.getElements('label').forEach(function(Label) {
Label.classList.remove('checked');
});
event.target.getParent('label').classList.add('checked');
};
for (let i = 0, len = list.length; i < len; i++) {
const Item = list[i];
const Label = new Element('label', {
'class': 'qui-menuPanel-optionList__option',
html: Mustache.render(templateItemCard, {
title: Item.title,
desc: Item.desc,
icon: Item.icon,
value: Item.class
})
});
if (Item.class === selectedItem) {
Label.querySelector('input').checked = true;
Label.classList.add('checked');
}
Label.inject(OptionsList);
Label.getElement('input').addEventListener('change', toggleSelected);
}
},
/** /**
* @param Item * @param Item
*/ */
...@@ -580,12 +644,15 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [ ...@@ -580,12 +644,15 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
this.$ActiveItem = null; this.$ActiveItem = null;
this.$ActiveMapItem = null; this.$ActiveMapItem = null;
this.$InnerContainer.set('html', Mustache.render(templateSettings, { this.$InnerContainer.set('html', Mustache.render(templateSettings, {
settingsTitle: QUILocale.get('quiqqer/quiqqer', 'settings'), title : QUILocale.get('quiqqer/menu', 'menu.title'),
title : QUILocale.get('quiqqer/quiqqer', 'title') workingTitle: QUILocale.get('quiqqer/menu', 'menu.workingTitle')
})); }));
this.$InnerContainer.getElement('[name="title"]').set('value', JSON.stringify(this.$title)); const TitleNode = this.$InnerContainer.getElement('[name="title"]'),
this.$InnerContainer.getElement('[name="workingTitle"]').set('value', JSON.stringify(this.$workingTitle)); WorkingTitleNode = this.$InnerContainer.getElement('[name="workingTitle"]');
TitleNode.set('value', JSON.stringify(this.$title));
WorkingTitleNode.set('value', JSON.stringify(this.$workingTitle));
}).then(() => { }).then(() => {
return QUI.parse(this.$InnerContainer); return QUI.parse(this.$InnerContainer);
}).then(() => { }).then(() => {
......
...@@ -527,18 +527,34 @@ ...@@ -527,18 +527,34 @@
<de><![CDATA[Menu Eintrag: Zu einem Anker]]></de> <de><![CDATA[Menu Eintrag: Zu einem Anker]]></de>
<en><![CDATA[Menu entry: To an anchor]]></en> <en><![CDATA[Menu entry: To an anchor]]></en>
</locale> </locale>
<locale name="item.anchor.short">
<de><![CDATA[Mit diesem Menütyp ist es möglich, eine interne QUIQQER-Seite auszuwählen und einen Anker festzulegen.]]></de>
<en><![CDATA[With this menu type it is possible to select an internal QUIQQER page and define an anchor.]]></en>
</locale>
<locale name="item.custom.title"> <locale name="item.custom.title">
<de><![CDATA[Menu Eintrag: Custom Event]]></de> <de><![CDATA[Menu Eintrag: Custom Event]]></de>
<en><![CDATA[Menu entry: Custom Event]]></en> <en><![CDATA[Menu entry: Custom Event]]></en>
</locale> </locale>
<locale name="item.custom.short">
<de><![CDATA[Individuelle Anpassung des Menüpunktes. Man kann eine Seite auswählen, eine benutzerdefinierte JavaScript-Funktion aufrufen und vieles mehr.]]></de>
<en><![CDATA[Customisation of the menu item. You can select a page, call up a customised JavaScript function and much more.]]></en>
</locale>
<locale name="item.site.title"> <locale name="item.site.title">
<de><![CDATA[Menu Eintrag: Zu einer internen Seite von einem Projekt]]></de> <de><![CDATA[Menu Eintrag: Zu einer internen Seite von einem Projekt]]></de>
<en><![CDATA[Menu entry: To an internal page from a project]]></en> <en><![CDATA[Menu entry: To an internal page from a project]]></en>
</locale> </locale>
<locale name="item.site.short">
<de><![CDATA[Erlaubt die Auswahl eines interner QUIQQER Seite.]]></de>
<en><![CDATA[Allows selection of an internal QUIQQER page.Klicken, um Alternative zu verwenden]]></en>
</locale>
<locale name="item.url.title"> <locale name="item.url.title">
<de><![CDATA[Menu Eintrag: Zu einer anderen URL]]></de> <de><![CDATA[Menu Eintrag: Zu einer anderen URL]]></de>
<en><![CDATA[Menu entry: To another URL]]></en> <en><![CDATA[Menu entry: To another URL]]></en>
</locale> </locale>
<locale name="item.url.short">
<de><![CDATA[Es ist möglich, sowohl eine interne QUIQQER Seite auszuwählen als auch den Link zu einer externen Seiten zu setzen.]]></de>
<en><![CDATA[It is possible to select both an internal QUIQQER page and a link to an external page.]]></en>
</locale>
<locale name="menu.saved.successfully"> <locale name="menu.saved.successfully">
<de><![CDATA[Das Menü wurde erfolgreich gespeichert.]]></de> <de><![CDATA[Das Menü wurde erfolgreich gespeichert.]]></de>
<en><![CDATA[The menu has been saved successfully.]]></en> <en><![CDATA[The menu has been saved successfully.]]></en>
...@@ -554,10 +570,14 @@ ...@@ -554,10 +570,14 @@
<de><![CDATA[ID]]></de> <de><![CDATA[ID]]></de>
<en><![CDATA[ID]]></en> <en><![CDATA[ID]]></en>
</locale> </locale>
<locale name="grid.menuTitle"> <locale name="menu.title">
<de><![CDATA[Titel]]></de> <de><![CDATA[Titel]]></de>
<en><![CDATA[Title]]></en> <en><![CDATA[Title]]></en>
</locale> </locale>
<locale name="menu.workingTitle">
<de><![CDATA[Arbeitstitel]]></de>
<en><![CDATA[Working title]]></en>
</locale>
<locale name="creation.window.title"> <locale name="creation.window.title">
<de><![CDATA[Neues Menü anlegen]]></de> <de><![CDATA[Neues Menü anlegen]]></de>
......
...@@ -115,10 +115,10 @@ public static function getList(): array ...@@ -115,10 +115,10 @@ public static function getList(): array
public static function getItemList(): array public static function getItemList(): array
{ {
return [ return [
QUI\Menu\Independent\Items\Anchor::class,
QUI\Menu\Independent\Items\Custom::class,
QUI\Menu\Independent\Items\Site::class, QUI\Menu\Independent\Items\Site::class,
QUI\Menu\Independent\Items\Anchor::class,
QUI\Menu\Independent\Items\Url::class, QUI\Menu\Independent\Items\Url::class,
QUI\Menu\Independent\Items\Custom::class,
]; ];
} }
} }
...@@ -270,6 +270,16 @@ public function getStatus(): bool ...@@ -270,6 +270,16 @@ public function getStatus(): bool
abstract public static function itemTitle(); abstract public static function itemTitle();
/**
* Short description of the menu types
*
* @return string
*/
public static function itemShort(): string
{
return '';
}
/** /**
* @return string * @return string
*/ */
......
...@@ -103,6 +103,16 @@ public static function itemTitle(): string ...@@ -103,6 +103,16 @@ public static function itemTitle(): string
return QUI::getLocale()->get('quiqqer/menu', 'item.anchor.title'); return QUI::getLocale()->get('quiqqer/menu', 'item.anchor.title');
} }
/**
* Short description of the menu types
*
* @return string
*/
public static function itemShort(): string
{
return QUI::getLocale()->get('quiqqer/menu', 'item.anchor.short');
}
/** /**
* @return string * @return string
*/ */
......
...@@ -42,6 +42,16 @@ public static function itemTitle(): string ...@@ -42,6 +42,16 @@ public static function itemTitle(): string
return QUI::getLocale()->get('quiqqer/menu', 'item.custom.title'); return QUI::getLocale()->get('quiqqer/menu', 'item.custom.title');
} }
/**
* Short description of the menu types
*
* @return string
*/
public static function itemShort(): string
{
return QUI::getLocale()->get('quiqqer/menu', 'item.custom.short');
}
/** /**
* return the item type icon * return the item type icon
* *
......
...@@ -22,6 +22,16 @@ public static function itemTitle(): string ...@@ -22,6 +22,16 @@ public static function itemTitle(): string
return QUI::getLocale()->get('quiqqer/menu', 'item.site.title'); return QUI::getLocale()->get('quiqqer/menu', 'item.site.title');
} }
/**
* Short description of the menu types
*
* @return string
*/
public static function itemShort(): string
{
return QUI::getLocale()->get('quiqqer/menu', 'item.site.short');
}
/** /**
* @return string * @return string
*/ */
......
...@@ -35,6 +35,16 @@ public static function itemTitle(): string ...@@ -35,6 +35,16 @@ public static function itemTitle(): string
return QUI::getLocale()->get('quiqqer/menu', 'item.url.title'); return QUI::getLocale()->get('quiqqer/menu', 'item.url.title');
} }
/**
* Short description of the menu types
*
* @return string
*/
public static function itemShort(): string
{
return QUI::getLocale()->get('quiqqer/menu', 'item.url.short');
}
/** /**
* @return string * @return string
*/ */
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren