Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 65da875a erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: #11

Übergeordneter 42bfef7e
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -11,6 +11,7 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
'qui/controls/windows/Confirm',
'qui/controls/contextmenu/Menu',
'qui/controls/contextmenu/Item',
'qui/controls/contextmenu/Separator',
'Ajax',
'Locale',
'package/quiqqer/menu/bin/classes/Independent/Handler',
......@@ -19,7 +20,8 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
'text!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.Create.html',
'css!package/quiqqer/menu/bin/Controls/Independent/MenuPanel.css'
], function (QUI, QUIPanel, QUIMap, QUIMapItem, QUIConfirm, QUIContextMenu, QUIContextMenuItem,
], function (QUI, QUIPanel, QUIMap, QUIMapItem, QUIConfirm,
QUIContextMenu, QUIContextMenuItem, QUIContextSeparator,
QUIAjax, QUILocale, MenuHandler, Mustache, templateCreate) {
"use strict";
......@@ -72,10 +74,6 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}
});
this.addButton({
type: 'separator'
});
/*
this.addButton({
name : 'add',
......@@ -260,10 +258,10 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
};
};
let result = toArray(this.$Map);
let result = toArray(this.$Map.firstChild());
let title = null;
let workingTitle = null;
//console.log('save', result);
Handler.saveMenu(
this.getAttribute('menuId'),
title,
......@@ -320,6 +318,18 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
return QUI.parse(Win.getContent());
}).then(function () {
const Title = QUI.Controls.getById(
Content.getElement('[name="itemTitle"]').get('data-quiid')
);
if (Title.isLoaded()) {
Title.open();
} else {
Title.addEvent('load', function () {
Title.open();
});
}
Win.Loader.hide();
});
},
......@@ -373,6 +383,77 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}).open();
},
/**
* opens the item type change confirm window
*
* @param Item
*/
changeItemType: function (Item) {
if (typeof Item === 'undefined') {
return;
}
new QUIConfirm({
icon : 'fa fa-edit',
title : QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.title'),
maxHeight: 400,
maxWidth : 500,
autoclose: false,
events : {
onOpen: (Win) => {
const Content = Win.getContent();
Content.set(
'html',
QUILocale.get(lg, 'quiqqer.menu.independent.changeItemType.message') +
'' +
'<form style="width: 100%; text-align: center; margin-top: 20px">' +
' <select name="itemType"></select>' +
'</form>'
);
Win.Loader.show();
Handler.getItemTypes().then((list) => {
const Types = Content.getElement('[name="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());
}).then(function () {
Win.Loader.hide();
});
},
onSubmit: (Win) => {
Win.Loader.show();
const Content = Win.getContent();
const Form = Content.getElement('form');
const type = Form.elements.itemType.value;
const Option = Form.elements.itemType.getElement(
'option[value="' + CSS.escape(type) + '"]'
);
Item.setAttribute('itemType', type);
Item.setAttribute('icon', Option.get('data-icon'));
Win.close();
}
}
}).open();
},
/**
* opens the item - display the item data
*
......@@ -504,6 +585,20 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}
}));
Menu.appendChild(new QUIContextSeparator({}));
Menu.appendChild(new QUIContextMenuItem({
icon : 'fa fa-edit',
text : QUILocale.get(lg, 'context.menu.changeType'),
events: {
click: () => {
this.changeItemType(Item);
}
}
}));
Menu.appendChild(new QUIContextSeparator({}));
Menu.appendChild(new QUIContextMenuItem({
icon : 'fa fa-trash',
text : QUILocale.get(lg, 'context.menu.deleteChild'),
......
......@@ -432,6 +432,25 @@
<de><![CDATA[Menü Cache leeren]]></de>
<en><![CDATA[Clear menu cache]]></en>
</locale>
<locale name="context.menu.changeType">
<de><![CDATA[Typ ändern]]></de>
<en><![CDATA[Change type]]></en>
</locale>
<locale name="quiqqer.menu.independent.changeItemType.title">
<de><![CDATA[Typ ändern]]></de>
<en><![CDATA[Change type]]></en>
</locale>
<locale name="quiqqer.menu.independent.changeItemType.message">
<de><![CDATA[
Ändere den Typ des Menüeintrages.
Beachte, das einige Daten dadurch nicht mehr genutzt bzw verwendet werden können.
]]></de>
<en><![CDATA[
Change the type of the menu item.
Note that some data can no longer be used as a result.
]]></en>
</locale>
</groups>
</locales>
\ No newline at end of file
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