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
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
...@@ -26,7 +26,8 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -26,7 +26,8 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
options: { options: {
nopopups : false, nopopups : false,
popuptype: 'short' popuptype: 'short',
useanchor: false
}, },
initialize: function (options) { initialize: function (options) {
...@@ -48,7 +49,6 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -48,7 +49,6 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
* events : on import * events : on import
*/ */
$onImport: function () { $onImport: function () {
var i, len; var i, len;
var self = this; var self = this;
...@@ -111,14 +111,14 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -111,14 +111,14 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
// found entries // found entries
var inResult = self.$entries.filter(function (Child) { var inResult = self.$entries.filter(function (Child) {
return Child.get('data-categories') return Child.get('data-categories')
.toString() .toString()
.contains(',' + catId + ','); .contains(',' + catId + ',');
}); });
var notInResult = self.$entries.filter(function (Child) { var notInResult = self.$entries.filter(function (Child) {
return !Child.get('data-categories') return !Child.get('data-categories')
.toString() .toString()
.contains(',' + catId + ','); .contains(',' + catId + ',');
}); });
if (notInResult.length) { if (notInResult.length) {
...@@ -164,7 +164,9 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -164,7 +164,9 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
} }
var openEntry = function (event) { var openEntry = function (event) {
event.stop(); if (typeOf(event) === 'domevent') {
event.stop();
}
var control; var control;
var Entry = event.target; var Entry = event.target;
...@@ -193,10 +195,33 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -193,10 +195,33 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
} }
require([control], function (Popup) { require([control], function (Popup) {
if (self.getAttribute('useanchor')) {
window.location = '#' + Entry.get('data-id');
}
new Popup({ new Popup({
project: QUIQQER_PROJECT.name, project: QUIQQER_PROJECT.name,
lang : QUIQQER_PROJECT.lang, 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(); }).open();
}); });
}.bind(this); }.bind(this);
...@@ -204,6 +229,18 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [ ...@@ -204,6 +229,18 @@ define('package/quiqqer/portfolio/bin/controls/Portfolio', [
for (i = 0, len = self.$entries.length; i < len; i++) { for (i = 0, len = self.$entries.length; i < len; i++) {
self.$entries[i].addEvent('click', openEntry); 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()) ...@@ -28,7 +28,8 @@ public function __construct($attributes = array())
'entry-width' => false, 'entry-width' => false,
'qui-class' => 'package/quiqqer/portfolio/bin/controls/Portfolio', 'qui-class' => 'package/quiqqer/portfolio/bin/controls/Portfolio',
'data-qui-options-nopopups' => false, 'data-qui-options-nopopups' => false,
'data-qui-options-popuptype' => 'short' 'data-qui-options-popuptype' => 'short',
'data-qui-options-useanchor' => false
)); ));
$this->addCSSFile( $this->addCSSFile(
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
'img-position' => $Site->getAttribute('quiqqer.portfolio.settings.imgPosition'), 'img-position' => $Site->getAttribute('quiqqer.portfolio.settings.imgPosition'),
'data-qui-options-nopopups' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioNoPopup'), 'data-qui-options-nopopups' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioNoPopup'),
'data-qui-options-popuptype' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioPopup.type'), 'data-qui-options-popuptype' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioPopup.type'),
'data-qui-options-useanchor' => true,
'Site' => $Site 'Site' => $Site
)); ));
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren