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

refactor: #11 - create child stuff

Übergeordneter 32ae0174
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -19,6 +19,10 @@ function ($id, $title, $workingTitle, $data) {
$Menu->setWorkingTitle($workingTitle);
$Menu->setData($data);
$Menu->save();
QUI::getMessagesHandler()->addSuccess(
QUI::getLocale()->get('quiqqer/menu', 'menu.saved.successfully')
);
},
['id', 'title', 'workingTitle', 'data'],
'Permission::checkAdminUser'
......
<form>
<table class="data-table data-table-flexbox">
<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="{{textTitle}}">
{{textTitle}}
</span>
<input type="text"
class="field-container-field"
name="itemTitle"
data-qui="controls/lang/InputMultiLang"
/>
</label>
</td>
</tr>
<tr>
<td>
<label class="field-container">
......
......@@ -295,6 +295,7 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}
new QUIConfirm({
icon : 'fa fa-plus',
title : QUILocale.get(lg, 'quiqqer.menu.independent.addItem.title'),
maxHeight: 400,
maxWidth : 500,
......@@ -304,7 +305,9 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
const Content = Win.getContent();
Win.Loader.show();
Content.set('html', Mustache.render(templateCreate, {
text : QUILocale.get(lg, 'create.window.text'),
textTitle: QUILocale.get('quiqqer/quiqqer', 'title'),
textName : QUILocale.get('quiqqer/quiqqer', 'name'),
textType : QUILocale.get('quiqqer/quiqqer', 'type')
......@@ -325,18 +328,6 @@ 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();
});
},
......@@ -345,27 +336,16 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
const Content = Win.getContent();
const Form = Content.getElement('form');
let current = QUILocale.getCurrent();
let title = Form.elements.itemTitle.value;
let type = Form.elements.itemType.value;
const Option = Form.elements.itemType.getElement(
'option[value="' + CSS.escape(type) + '"]'
);
try {
title = JSON.decode(title);
if (typeof title[current] !== 'undefined') {
title = title[current];
}
} catch (e) {
}
let itemAttributes = {
text : title,
text : '',
icon : Option.get('data-icon'),
itemTitle: Form.elements.itemTitle.value,
itemTitle: '',
itemType : Form.elements.itemType.value,
itemIcon : '',
events : {
......@@ -374,17 +354,28 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
}
};
let Child;
if (where === 'bottom') {
Parent.appendChild(new QUIMapItem(itemAttributes));
Child = new QUIMapItem(itemAttributes);
Parent.appendChild(Child);
if (typeof Parent === 'function') {
Parent.open();
}
} else {
Parent.appendChild(new QUIMapItem(itemAttributes), where);
Child = new QUIMapItem(itemAttributes);
Parent.appendChild(Child, where);
}
Win.close();
Child.click();
this.$ActiveMapItem = Child;
this.save().then(() => {
return this.$refreshItemName();
});
}
}
}).open();
......@@ -676,6 +667,7 @@ define('package/quiqqer/menu/bin/Controls/Independent/MenuPanel', [
events : {
submit: function () {
Item.destroy();
this.save();
}
}
}).open();
......
......@@ -251,7 +251,10 @@
<de><![CDATA[Menu Eintrag: Zur einer anderen URL]]></de>
<en><![CDATA[Menu entry: To another URL]]></en>
</locale>
<locale name="menu.saved.successfully">
<de><![CDATA[Das Menü wurde erfolgreich gespeichert.]]></de>
<en><![CDATA[The menu has been saved successfully.]]></en>
</locale>
</groups>
<groups name="quiqqer/menu" datatype="js">
......@@ -509,5 +512,15 @@
<en><![CDATA[Parent window (_parent)]]></en>
</locale>
<locale name="create.window.text">
<de><![CDATA[
Bitte gebe den Typ (Art des Eintrages) an, welcher der neuen Eintrag erhalten soll.
Der Typ kann jederzeit geändert werden.
]]></de>
<en><![CDATA[
Please specify the type (type of entry), which the new entry should get.
The type can be changed at any time.
]]></en>
</locale>
</groups>
</locales>
\ No newline at end of file
</locales>
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