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

fix: #27 - Referenzenpopup über url (anker aufrufbar machen)

Übergeordneter 5bc2b5ff
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -26,7 +26,8 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
options: {
nopopups : false,
popuptype: 'short'
popuptype: 'short',
useanchor: false
},
initialize: function (options) {
......@@ -48,7 +49,6 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
* events : on import
*/
$onImport: function () {
var i, len;
var self = this;
......@@ -111,14 +111,14 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
// found entries
var inResult = self.$entries.filter(function (Child) {
return Child.get('data-categories')
.toString()
.contains(',' + catId + ',');
.toString()
.contains(',' + catId + ',');
});
var notInResult = self.$entries.filter(function (Child) {
return !Child.get('data-categories')
.toString()
.contains(',' + catId + ',');
.toString()
.contains(',' + catId + ',');
});
if (notInResult.length) {
......@@ -164,7 +164,9 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
}
var openEntry = function (event) {
event.stop();
if (typeOf(event) === 'domevent') {
event.stop();
}
var control;
var Entry = event.target;
......@@ -193,10 +195,33 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
}
require([control], function (Popup) {
if (self.getAttribute('useanchor')) {
window.location = '#' + Entry.get('data-id');
}
new Popup({
project: QUIQQER_PROJECT.name,
lang : QUIQQER_PROJECT.lang,
siteId : Entry.get('data-id')
siteId : Entry.get('data-id'),
events : {
onClose: function () {
if (self.getAttribute('useanchor') === false) {
return;
}
if (typeof window.history !== 'undefined') {
history.pushState(
"",
document.title,
window.location.pathname + window.location.search
);
return;
}
window.location = window.location.href.split('#')[0];
}
}
}).open();
});
}.bind(this);
......@@ -204,6 +229,18 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
for (i = 0, len = self.$entries.length; i < len; i++) {
self.$entries[i].addEvent('click', openEntry);
}
if (self.getAttribute('useanchor')) {
var anchor = window.location.href.split('#');
if (typeof anchor[1] !== 'undefined') {
var Child = this.getElm().getElement('[data-id="' + anchor[1] + '"]');
if (Child) {
Child.click();
}
}
}
},
/**
......
......@@ -28,7 +28,8 @@ public function __construct($attributes = array())
'entry-width' => false,
'qui-class' => 'package/quiqqer/portfolio/bin/controls/Portfolio',
'data-qui-options-nopopups' => false,
'data-qui-options-popuptype' => 'short'
'data-qui-options-popuptype' => 'short',
'data-qui-options-useanchor' => false
));
$this->addCSSFile(
......
......@@ -7,6 +7,7 @@
'img-position' => $Site->getAttribute('quiqqer.portfolio.settings.imgPosition'),
'data-qui-options-nopopups' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioNoPopup'),
'data-qui-options-popuptype' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioPopup.type'),
'data-qui-options-useanchor' => true,
'Site' => $Site
));
......
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