From f27cc9e772788fe25fdd6367378f8c0da4b0a8d2 Mon Sep 17 00:00:00 2001 From: Michael <michael.danielczok@gmail.com> Date: Tue, 15 Nov 2016 13:05:42 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Bricks=20haben=20neues=20Attribut=20-->?= =?UTF-8?q?=20frontendTitle=20(Hen)=20fix:=20Simple=20Google=20Maps=20-->?= =?UTF-8?q?=20Inhalt=20=C3=BCber=20dem=20Map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ajax/brick/templates/extras.html | 10 + ajax/brick/templates/information.html | 2 +- bin/BrickEdit.js | 202 +++++++++--------- database.xml | 1 + locale.xml | 10 + src/QUI/Bricks/Brick.php | 19 +- src/QUI/Bricks/Controls/SimpleGoogleMaps.html | 6 + src/QUI/Bricks/Controls/SimpleGoogleMaps.php | 3 +- src/QUI/Bricks/Manager.php | 21 +- 9 files changed, 155 insertions(+), 119 deletions(-) diff --git a/ajax/brick/templates/extras.html b/ajax/brick/templates/extras.html index a1fdca5..2455538 100644 --- a/ajax/brick/templates/extras.html +++ b/ajax/brick/templates/extras.html @@ -11,6 +11,16 @@ <tbody> + <tr class="{cycle values="odd,even"}"> + <td> + <label for="frontendTitle"> + {locale group="quiqqer/bricks" var="brick.edit.frontendTitle"} + </label> + </td> + <td> + <input type="text" name="frontendTitle" id="frontendTitle" /> + </td> + </tr> </tbody> </table> </form> diff --git a/ajax/brick/templates/information.html b/ajax/brick/templates/information.html index cf9d826..66929b6 100644 --- a/ajax/brick/templates/information.html +++ b/ajax/brick/templates/information.html @@ -12,7 +12,7 @@ <tr class="{cycle values="odd,even"}"> <td> <label for="title"> - {locale group="quiqqer/system" var="title"} + {locale group="quiqqer/bricks" var="brick.edit.backendTitle"} </label> </td> <td> diff --git a/bin/BrickEdit.js b/bin/BrickEdit.js index 6abfc67..c860135 100644 --- a/bin/BrickEdit.js +++ b/bin/BrickEdit.js @@ -62,27 +62,27 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ initialize: function (options) { this.parent(options); - this.$availableBricks = []; + this.$availableBricks = []; this.$availableSettings = []; - this.$customfields = []; + this.$customfields = []; this.$Editor = false; - this.$Areas = false; + this.$Areas = false; this.$Active = false; this.addEvents({ - onInject : this.$onInject, - onCreate : this.$onCreate, - onDestroy: this.$onDestroy, - onResize : function () { - var controls = QUI.Controls.getControlsInElement(this.getContent()); - controls.each(function (Control) { - if ("resize" in Control) { - Control.resize(); - } - }); - }.bind(this) - }); + onInject : this.$onInject, + onCreate : this.$onCreate, + onDestroy: this.$onDestroy, + onResize : function () { + var controls = QUI.Controls.getControlsInElement(this.getContent()); + controls.each(function (Control) { + if ("resize" in Control) { + Control.resize(); + } + }); + }.bind(this) + }); }, /** @@ -90,66 +90,66 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ */ $onCreate: function () { this.setAttributes({ - icon : 'fa fa-spinner fa-spin', - title: '...' - }); + icon : 'fa fa-spinner fa-spin', + title: '...' + }); this.addButton({ - name : 'save', - textimage: 'fa fa-save', - text : QUILocale.get('quiqqer/system', 'save'), - events : { - click: this.save - } - }); + name : 'save', + textimage: 'fa fa-save', + text : QUILocale.get('quiqqer/system', 'save'), + events : { + click: this.save + } + }); this.addButton({ - name : 'delete', - icon : 'fa fa-trash-o', - title : QUILocale.get('quiqqer/system', 'delete'), - events: { - click: this.del - }, - styles: { - 'float': 'right' - } - }); + name : 'delete', + icon : 'fa fa-trash-o', + title : QUILocale.get('quiqqer/system', 'delete'), + events: { + click: this.del + }, + styles: { + 'float': 'right' + } + }); this.addCategory({ - name : 'information', - icon : 'fa fa-file-o', - text : QUILocale.get('quiqqer/system', 'information'), - events: { - onActive: this.$load - } - }); + name : 'information', + icon : 'fa fa-file-o', + text : QUILocale.get('quiqqer/system', 'information'), + events: { + onActive: this.$load + } + }); this.addCategory({ - name : 'settings', - icon : 'fa fa-magic', - text : QUILocale.get('quiqqer/system', 'properties'), - events: { - onActive: this.$load - } - }); + name : 'settings', + icon : 'fa fa-magic', + text : QUILocale.get('quiqqer/system', 'properties'), + events: { + onActive: this.$load + } + }); this.addCategory({ - name : 'extra', - icon : 'fa fa-gears', - text : QUILocale.get('quiqqer/system', 'settings'), - events: { - onActive: this.$load - } - }); + name : 'extra', + icon : 'fa fa-gears', + text : QUILocale.get('quiqqer/system', 'settings'), + events: { + onActive: this.$load + } + }); this.addCategory({ - name : 'content', - icon : 'fa fa-file-text-o', - text : QUILocale.get('quiqqer/system', 'content'), - events: { - onActive: this.$load - } - }); + name : 'content', + icon : 'fa fa-file-text-o', + text : QUILocale.get('quiqqer/system', 'content'), + events: { + onActive: this.$load + } + }); }, /** @@ -159,9 +159,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ this.Loader.show(); QUIAjax.get([ - 'package_quiqqer_bricks_ajax_getBrick', - 'package_quiqqer_bricks_ajax_getAvailableBricks' - ], function (brick, bricks) { + 'package_quiqqer_bricks_ajax_getBrick', + 'package_quiqqer_bricks_ajax_getAvailableBricks' + ], function (brick, bricks) { /** * @param {{availableSettings:object}} data * @param {{attributes:object}} data @@ -169,17 +169,17 @@ 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); this.setAttributes({ - icon : 'fa fa-th', - title: QUILocale.get('quiqqer/bricks', 'panel.title', { - brickId : this.getAttribute('id'), - brickTitle: brick.attributes.title - }) - }); + icon : 'fa fa-th', + title: QUILocale.get('quiqqer/bricks', 'panel.title', { + brickId : this.getAttribute('id'), + brickTitle: brick.attributes.title + }) + }); this.refresh(); @@ -187,9 +187,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ this.getCategory('information').click(); }.bind(this), { - 'package': 'quiqqer/brick', - brickId : this.getAttribute('id') - }); + 'package': 'quiqqer/brick', + brickId : this.getAttribute('id') + }); }, /** @@ -240,11 +240,11 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ this.Loader.hide(); }.bind(this), { - 'package': 'quiqqer/brick', - brickId : this.getAttribute('id'), - data : JSON.encode(data), - onError : reject - }); + 'package': 'quiqqer/brick', + brickId : this.getAttribute('id'), + data : JSON.encode(data), + onError : reject + }); }.bind(this)); @@ -274,9 +274,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ self.fireEvent('delete'); self.destroy(); }, { - 'package': 'quiqqer/bricks', - brickIds : JSON.encode([self.getAttribute('id')]) - }); + 'package': 'quiqqer/bricks', + brickIds : JSON.encode([self.getAttribute('id')]) + }); } } }).open(); @@ -370,6 +370,10 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ ); } + if (Form.getElement('[name="frontendTitle"]')) { + data.attributes.frontendTitle = Form.getElement('[name="frontendTitle"]').value; + } + if (unload == 'settings') { data.attributes.areas = this.$Areas.getAreas().join(','); //data.attributes.width = Form.elements.width.value; @@ -438,9 +442,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ resolve(); }.bind(this), { - 'package': 'quiqqer/bricks', - onError : reject - }); + 'package': 'quiqqer/bricks', + onError : reject + }); }.bind(this)); }, @@ -534,9 +538,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ resolve(); }.bind(this), { - 'package': 'quiqqer/bricks', - onError : reject - }); + 'package': 'quiqqer/bricks', + onError : reject + }); }.bind(this)); }, @@ -557,9 +561,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ }); }.bind(this), { - 'package': 'quiqqer/bricks', - onError : reject - }); + 'package': 'quiqqer/bricks', + onError : reject + }); }.bind(this)); }, @@ -580,9 +584,9 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ }); }.bind(this), { - 'package': 'quiqqer/bricks', - onError : reject - }); + 'package': 'quiqqer/bricks', + onError : reject + }); }.bind(this)); }, @@ -660,6 +664,8 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ var TableExtra = this.$Elm.getElement('table.brick-edit-extra-header'), TableBody = TableExtra.getElement('tbody'); + TableBody.getElement('[name="frontendTitle"]').value = this.getAttribute('data').attributes.frontendTitle; + if (!this.$availableSettings || !this.$availableSettings.length) { TableExtra.setStyle('display', 'none'); @@ -682,7 +688,7 @@ 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; text = setting.text; @@ -693,7 +699,7 @@ define('package/quiqqer/bricks/bin/BrickEdit', [ Row = new Element('tr', { - 'class': i % 2 ? 'even' : 'odd', + 'class': i % 2 ? 'odd' : 'even', html : '<td>' + ' <label class="quiqqer-bricks-areas" for="' + extraFieldId + '">' + text + diff --git a/database.xml b/database.xml index 6cdbfa2..770c22c 100644 --- a/database.xml +++ b/database.xml @@ -7,6 +7,7 @@ <field type="VARCHAR(255)">project</field> <field type="VARCHAR(2)">lang</field> <field type="VARCHAR(255) NOT NULL">title</field> + <field type="VARCHAR(255) NOT NULL">frontendTitle</field> <field type="TEXT NOT NULL">description</field> <field type="TEXT">settings</field> <field type="TEXT">customfields</field> diff --git a/locale.xml b/locale.xml index 1f7e36a..96f5197 100644 --- a/locale.xml +++ b/locale.xml @@ -184,6 +184,16 @@ <de><![CDATA[Baustein bearbeiten]]></de> <en><![CDATA[Edit Brick]]></en> </locale> + <locale name="brick.edit.backendTitle"> + <de><![CDATA[Bausteinname]]></de> + <en><![CDATA[Brick name]]></en> + <pl><![CDATA[Nazwa]]></pl> + </locale> + <locale name="brick.edit.frontendTitle"> + <de><![CDATA[Titel (frontend)]]></de> + <en><![CDATA[Title (frontend)]]></en> + <pl><![CDATA[Tytuł (frontend)]]></pl> + </locale> <locale name="brick.edit.description"> <de><![CDATA[Bausteinbeschreibung]]></de> <en><![CDATA[Brick description]]></en> diff --git a/src/QUI/Bricks/Brick.php b/src/QUI/Bricks/Brick.php index e4c19a3..fddbddb 100644 --- a/src/QUI/Bricks/Brick.php +++ b/src/QUI/Bricks/Brick.php @@ -69,15 +69,16 @@ public function __construct($params = array()) { // default $default = array( - 'type' => 'content', - 'content' => '', - 'title' => '', - 'description' => '', - 'project' => '', - 'areas' => '', - 'height' => '', - 'width' => '', - 'classes' => '' + 'type' => 'content', + 'content' => '', + 'title' => '', + 'description' => '', + 'project' => '', + 'areas' => '', + 'height' => '', + 'width' => '', + 'classes' => '', + 'frontendTitle' => '' ); $this->setAttributes($default); diff --git a/src/QUI/Bricks/Controls/SimpleGoogleMaps.html b/src/QUI/Bricks/Controls/SimpleGoogleMaps.html index 50c13b5..4282190 100644 --- a/src/QUI/Bricks/Controls/SimpleGoogleMaps.html +++ b/src/QUI/Bricks/Controls/SimpleGoogleMaps.html @@ -1 +1,7 @@ +{if !$this->getAttribute('content') == ""} +<div class="content-body"> + {$this->getAttribute('content')} +</div> +{/if} + <iframe id="SimpleGoogleMaps" src="{$url}"></iframe> \ No newline at end of file diff --git a/src/QUI/Bricks/Controls/SimpleGoogleMaps.php b/src/QUI/Bricks/Controls/SimpleGoogleMaps.php index ca7c0b0..7ba69fd 100644 --- a/src/QUI/Bricks/Controls/SimpleGoogleMaps.php +++ b/src/QUI/Bricks/Controls/SimpleGoogleMaps.php @@ -56,7 +56,8 @@ public function getBody() $url = 'https://www.google.com/maps/embed/v1/place?' . $query . "&zoom=" . $zoom . "&"; $Engine->assign(array( - 'url' => $url + 'this' => $this, + 'url' => $url )); return $Engine->fetch(dirname(__FILE__) . '/SimpleGoogleMaps.html'); diff --git a/src/QUI/Bricks/Manager.php b/src/QUI/Bricks/Manager.php index 13ca0af..cc91ac8 100644 --- a/src/QUI/Bricks/Manager.php +++ b/src/QUI/Bricks/Manager.php @@ -614,16 +614,17 @@ public function saveBrick($brickId, array $brickData) // update QUI::getDataBase()->update($this->getTable(), array( - 'title' => $Brick->getAttribute('title'), - 'description' => $Brick->getAttribute('description'), - 'content' => $Brick->getAttribute('content'), - 'type' => $Brick->getAttribute('type'), - 'settings' => json_encode($Brick->getSettings()), - 'customfields' => json_encode($customfields), - 'areas' => $areaString, - 'height' => $Brick->getAttribute('height'), - 'width' => $Brick->getAttribute('width'), - 'classes' => json_encode($Brick->getCSSClasses()) + 'title' => $Brick->getAttribute('title'), + 'frontendTitle' => $Brick->getAttribute('frontendTitle'), + 'description' => $Brick->getAttribute('description'), + 'content' => $Brick->getAttribute('content'), + 'type' => $Brick->getAttribute('type'), + 'settings' => json_encode($Brick->getSettings()), + 'customfields' => json_encode($customfields), + 'areas' => $areaString, + 'height' => $Brick->getAttribute('height'), + 'width' => $Brick->getAttribute('width'), + 'classes' => json_encode($Brick->getCSSClasses()) ), array( 'id' => (int)$brickId )); -- GitLab