Commit 067df79e authored by Michael Danielczok's avatar Michael Danielczok

Merge branch 'dev'

parents 7ac5f234 4451785c
......@@ -26,7 +26,8 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
'css!package/quiqqer/bricks/bin/BrickEdit.css'
], function (QUI, QUIPanel, QUIConfirm, BrickAreas, QUIAjax, QUILocale,
Projects, QUIFormUtils, ControlUtils, Template, Bricks) {
Projects, QUIFormUtils, ControlUtils, Template, Bricks
) {
"use strict";
var lg = 'quiqqer/bricks';
......@@ -64,14 +65,14 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
initialize: function (options) {
this.parent(options);
this.$availableBricks = [];
this.$availableBricks = [];
this.$availableSettings = [];
this.$customfields = [];
this.$loaded = false;
this.$customfields = [];
this.$loaded = false;
this.$Container = null;
this.$Editor = false;
this.$Areas = false;
this.$Editor = false;
this.$Areas = false;
this.addEvents({
onInject : this.$onInject,
......@@ -185,7 +186,7 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
*/
this.$availableBricks = bricks;
this.$availableSettings = brick.availableSettings;
this.$customfields = brick.customfields;
this.$customfields = brick.customfields;
this.setAttribute('data', brick);
......@@ -436,9 +437,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
if (attributes.areas) {
areas = attributes.areas
.replace(/^,*/, '')
.replace(/,*$/, '')
.split(',');
.replace(/^,*/, '')
.replace(/,*$/, '')
.split(',');
}
// areas
......@@ -463,11 +464,11 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
new Element('tr', {
'class': i % 2 ? 'odd' : 'even',
html : '<td>' +
'<label>' +
'<input type="checkbox" name="flexible-' + data.name + '" />' +
'<span>' + QUILocale.get(data.text[0], data.text[1]) + '</span>' +
'</label>' +
'</td>'
'<label>' +
'<input type="checkbox" name="flexible-' + data.name + '" />' +
'<span>' + QUILocale.get(data.text[0], data.text[1]) + '</span>' +
'</label>' +
'</td>'
}).inject(TBody);
}
......@@ -682,7 +683,8 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
TableExtra.setStyle('display', null);
var i, len, Row, text, Value, setting, extraFieldId;
var i, c, len, cLen, attr, Row, text, Value, setting,
extraFieldId, dataAttributes;
var self = this,
id = this.getId(),
......@@ -690,8 +692,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
// extra settings
for (i = 0, len = this.$availableSettings.length; i < len; i++) {
setting = this.$availableSettings[i];
setting = this.$availableSettings[i];
extraFieldId = 'extraField_' + id + '_' + i;
dataAttributes = setting['data-attributes'];
text = setting.text;
......@@ -703,11 +706,11 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
Row = new Element('tr', {
'class': i % 2 ? 'odd' : 'even',
html : '<td>' +
' <label class="quiqqer-bricks-areas" for="' + extraFieldId + '">' +
text +
' </label>' +
'</td>' +
'<td></td>'
' <label class="quiqqer-bricks-areas" for="' + extraFieldId + '">' +
text +
' </label>' +
'</td>' +
'<td></td>'
}).inject(TableBody);
if (setting.type !== 'select') {
......@@ -722,6 +725,14 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
Value.set('data-qui', setting['data-qui']);
}
if (typeof dataAttributes === 'object') {
for (attr in dataAttributes) {
if (dataAttributes.hasOwnProperty(attr)) {
Value.set(attr, dataAttributes[attr]);
}
}
}
continue;
}
......@@ -732,7 +743,7 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
}).inject(Row.getElement('td:last-child'));
for (var c = 0, clen = setting.options.length; c < clen; c++) {
for (c = 0, cLen = setting.options.length; c < cLen; c++) {
text = setting.options[c].text;
if (typeOf(setting.options[c].text) === 'array') {
......@@ -747,6 +758,14 @@ define('package/quiqqer/bricks/bin/BrickEdit', [
value: setting.options[c].value
}).inject(Value);
}
if (typeof dataAttributes === 'object') {
for (attr in dataAttributes) {
if (dataAttributes.hasOwnProperty(attr)) {
Value.set(attr, dataAttributes[attr]);
}
}
}
}
TableExtra.setStyle('display', null);
......
This diff is collapsed.
......@@ -592,6 +592,44 @@
</option>
</setting>
<setting name="random" type="select">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random"/>
<option value="off">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.off"/>
</option>
<option value="1">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.1"/>
</option>
<option value="2">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.2"/>
</option>
<option value="3">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.3"/>
</option>
<option value="4">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.4"/>
</option>
<option value="5">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.5"/>
</option>
<option value="6">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.6"/>
</option>
<option value="7">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.7"/>
</option>
<option value="8">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.8"/>
</option>
<option value="9">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.9"/>
</option>
<option value="10">
<locale group="quiqqer/bricks" var="bricks.customerReviews.random.10"/>
</option>
</setting>
<setting name="showAvatar" type="checkbox">
<locale group="quiqqer/bricks" var="bricks.customerReviews.showAvatar"/>
</setting>
......
......@@ -1062,9 +1062,14 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<![CDATA[Jetzt können wir unser Kontaktformular in die festgelegten Zonen einer Website einfügen. <br/>Dazu begeben wir uns in die Startseite ihres Standart-Projektes (<b>Main-Project</b>)]]></de>
<en><![CDATA[Now we can insert our contact form into the defined zones of a website. <br/>We go to the start page of your standard project (<b>Main-Project</b>).]]></en>
</locale>
<locale name="tour.general.bricks.Step17_2.Text">
<de>
<![CDATA[Sie können diesen Bausteine übrigens in jede ihrer Projektseiten einbauen]]></de>
<en><![CDATA[By the way, you can add these blocks to any of your project pages]]></en>
</locale>
<locale name="tour.general.bricks.Step18.Text">
<de><![CDATA[Hier wählen wir den Menü-Punkt <b>Bausteine</b>.]]></de>
<en><![CDATA[Here we select the menu item <b>Bricks</b>.]]></en>
<en><![CDATA[.. und Bestätigen die Änderung mit Übernehmen select the menu item <b>Bricks</b>.]]></en>
</locale>
<locale name="tour.general.bricks.Step18_2.Text">
<de><![CDATA[Dieses Menü ermöglicht es Ihnen unterschiedliche Bausteine, an den rechts grafisch Dargestellten Positionen einzubinden.]]></de>
......@@ -1072,7 +1077,7 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
</locale>
<locale name="tour.general.bricks.Step19.Text">
<de>
<![CDATA[Um das erstellte Kontaktformular nun in die Fußzeile (Footer) der Startseite einzufügen, klicken Sie bitte hier. ]]></de>
<![CDATA[Um das erstellte Kontaktformular nun in die Fußzeile (Footer) der Startseite einzufügen, klicken Sie bitte auf "Baustein hinzufügen". ]]></de>
<en><![CDATA[To add the created contact form to the footer of the start page, please click here. ]]></en>
</locale>
<locale name="tour.general.bricks.Step20.Text">
......@@ -1111,6 +1116,10 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<de><![CDATA[<b>Gratulation</b>. <br/>Sie haben erfolgreich die Bausteine-Tour absolviert ]]></de>
<en><![CDATA[<b>Congratulations</b>. <br/>You have successfully completed the Brick Tour ]]></en>
</locale>
<locale name="tour.general.bricks.img.altText">
<de><![CDATA[Darstellung der verschiedenen Zonen in die Bausteine eingesetzt werden können.]]></de>
<en><![CDATA[representation of the different zones into which bricks can be inserted.]]></en>
</locale>
<!-- Bricks Buttons -->
<locale name="tour.general.bricks.Button.Ende">
......@@ -1236,6 +1245,55 @@ M&ouml;chten Sie die Bausteine aus der Bausteinzone entfernen?</p>]]></de>
<de><![CDATA[Kleine Boxen]]></de>
<en><![CDATA[Small boxes]]></en>
</locale>
<locale name="bricks.customerReviews.random">
<de><![CDATA[Random]]></de>
<en><![CDATA[Random]]></en>
</locale>
<locale name="bricks.customerReviews.random.off">
<de><![CDATA[Aus (alle anzeigen)]]></de>
<en><![CDATA[Off (show all entries)]]></en>
</locale>
<locale name="bricks.customerReviews.random.1">
<de><![CDATA[Zeige maximal 1 Eintrag]]></de>
<en><![CDATA[Show max. 1 entry]]></en>
</locale>
<locale name="bricks.customerReviews.random.2">
<de><![CDATA[Zeige maximal 2 Einträge]]></de>
<en><![CDATA[Show max. 2 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.3">
<de><![CDATA[Zeige maximal 3 Einträge]]></de>
<en><![CDATA[Show max. 3 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.4">
<de><![CDATA[Zeige maximal 4 Einträge]]></de>
<en><![CDATA[Show max. 4 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.5">
<de><![CDATA[Zeige maximal 5 Einträge]]></de>
<en><![CDATA[Show max. 5 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.6">
<de><![CDATA[Zeige maximal 6 Einträge]]></de>
<en><![CDATA[Show max. 6 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.7">
<de><![CDATA[Zeige maximal 7 Einträge]]></de>
<en><![CDATA[Show max. 7 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.8">
<de><![CDATA[Zeige maximal 8 Einträge]]></de>
<en><![CDATA[Show max. 8 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.9">
<de><![CDATA[Zeige maximal 9 Einträge]]></de>
<en><![CDATA[Show max. 9 entries]]></en>
</locale>
<locale name="bricks.customerReviews.random.10">
<de><![CDATA[Zeige maximal 10 Einträge]]></de>
<en><![CDATA[Show max. 10 entries]]></en>
</locale>
<locale name="bricks.customerReviews.entries">
<de><![CDATA[Meinungen / Rezensionen]]></de>
<en><![CDATA[Reviews]]></en>
......
......@@ -4,6 +4,8 @@
}
.customer-review {
display: flex;
flex-direction: column;
margin-bottom: 3em;
margin-right: 2em;
width: calc(33% - 1.5rem);
......@@ -16,6 +18,7 @@
.customer-review-content {
background: rgba(0, 0, 0, 0.02);
border: 1px solid #ddd;
flex-grow: 1;
margin-bottom: 1em;
padding: 2em;
}
......
......@@ -24,9 +24,10 @@ class CustomerReviews extends QUI\Control
{
// default options
$this->setAttributes([
'template' => 'wideBoxes',
'template' => 'wideBoxes',
'showAvatar' => true,
'entries' => []
'entries' => [],
'random' => 'off'
]);
parent::__construct($attributes);
......@@ -46,6 +47,26 @@ class CustomerReviews extends QUI\Control
$entries = json_decode($entries, true);
}
if ($this->getAttribute('random') !== 'off') {
$random = $this->getAttribute('random');
if ($random > count($entries)) {
$random = count($entries);
}
$keys = array_rand($entries, $random);
if (!is_array($keys)) {
$keys = [$keys];
}
foreach ($keys as $key) {
$randomEntries[] = $entries[$key];
}
$entries = $randomEntries;
}
switch ($this->getAttribute('template')) {
case 'smallBoxes':
$template = dirname(__FILE__) . '/CustomerReviews.SmallBoxes.html';
......@@ -60,8 +81,8 @@ class CustomerReviews extends QUI\Control
}
$Engine->assign([
'this' => $this,
'entries' => $entries,
'this' => $this,
'entries' => $entries,
'showAvatar' => $this->getAttribute('showAvatar')
]);
......
......@@ -623,13 +623,26 @@ class Manager
}
}
$dataAttributes = [];
foreach ($Setting->attributes as $attribute) {
if ($attribute->nodeName === 'data-qui') {
continue;
}
if (strpos($attribute->nodeName, 'data-') !== false) {
$dataAttributes[$attribute->nodeName] = trim($attribute->nodeValue);
}
}
return [
'name' => $Setting->getAttribute('name'),
'text' => QUI\Utils\DOM::getTextFromNode($Setting, false),
'type' => $Setting->getAttribute('type'),
'class' => $Setting->getAttribute('class'),
'data-qui' => $Setting->getAttribute('data-qui'),
'options' => $options
'name' => $Setting->getAttribute('name'),
'text' => QUI\Utils\DOM::getTextFromNode($Setting, false),
'type' => $Setting->getAttribute('type'),
'class' => $Setting->getAttribute('class'),
'data-qui' => $Setting->getAttribute('data-qui'),
'options' => $options,
'data-attributes' => $dataAttributes
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment