Skip to content

Commit 2f4f72f

Browse files
Merge branch 'release/12.0.0'
2 parents d324f9a + 7bec418 commit 2f4f72f

11 files changed

Lines changed: 89 additions & 66 deletions

File tree

Classes/Controller/StudyCourseController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function detailAction(StudyCourse $studyCourse = null): ResponseInterface
149149
$this->view->assign('studyCourse', $studyCourse);
150150
} else {
151151
$studyCourseListPage = $this->settings['flexform']['studyCourseListPage'] ?? '';
152-
$this->redirect('filterAction', null, null, null, $studyCourseListPage);
152+
return $this->redirect('filterAction', null, null, null, $studyCourseListPage);
153153
}
154154

155155
return $this->htmlResponse();

Classes/Service/PluginService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function getPluginStoragePids(array $pluginRecord): array
1313
{
1414
$storagePids = [];
1515

16-
if (array_key_exists('pages', $pluginRecord) && $pluginRecord['pages'] !== '') {
16+
if (array_key_exists('pages', $pluginRecord) && !empty($pluginRecord['pages'])) {
1717
$storagePids = GeneralUtility::intExplode(',', $pluginRecord['pages']);
1818

1919
// add recursive pids if recursive is set in the plugin

Classes/Slug/UrlSegmentPostModifier.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ protected function getGraduationTitle(): string
109109

110110
private function isUpgradeWizard(): bool
111111
{
112+
// call via cli
113+
if (http_response_code() === false) {
114+
return true;
115+
}
116+
112117
return !is_null(GeneralUtility::_GP('install')) &&
113118
array_key_exists('action', GeneralUtility::_GP('install')) &&
114119
GeneralUtility::_GP('install')['action'] === 'upgradeWizardsExecute';

Documentation/Migration/11to12.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Migration
2+
3+
### JavaScript event changes
4+
5+
* the name of the `pagination.afterClick` Event has changed to `pagination.onClick`
6+
* the `pagination.afterLoad` Event is replaced with the `instance.onUpdate` Event
7+
* the `pagination.onUpdate` Event was removed. Please use the `instance.onUpdate` Event

Resources/Private/JavaScript/Frontend/components/filter.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Filter {
4545

4646
setEventListener() {
4747
// hide filter button
48-
this.filterElement.querySelector(this.identifier.hideFilterButton).addEventListener('click', function(event) {
48+
this.filterElement.querySelector(this.identifier.hideFilterButton).addEventListener('click', function (event) {
4949
if (this.filter.length === 0) {
5050
this.toggleFilterVisibility();
5151
} else {
@@ -55,19 +55,19 @@ class Filter {
5555
}.bind(this));
5656

5757
// show filter button
58-
this.filterElement.querySelector(this.identifier.showFilterButton).addEventListener('click', function(event) {
58+
this.filterElement.querySelector(this.identifier.showFilterButton).addEventListener('click', function (event) {
5959
this.toggleFilterVisibility(event);
6060
}.bind(this));
6161

6262

63-
this.filterElement.querySelectorAll(this.identifier.filterSection).forEach(function(fieldSet) {
63+
this.filterElement.querySelectorAll(this.identifier.filterSection).forEach(function (fieldSet) {
6464
// visibility toggle of filter sections
65-
fieldSet.querySelector(this.identifier.filterLegend).addEventListener('click', function(event) {
65+
fieldSet.querySelector(this.identifier.filterLegend).addEventListener('click', function (event) {
6666
event.target.nextElementSibling.classList.toggle(this.identifier.hideElement.substring(1));
6767
}.bind(this));
6868

6969
// tab navigation for filter
70-
fieldSet.addEventListener('keypress', function(event) {
70+
fieldSet.addEventListener('keypress', function (event) {
7171
if (event.which === 13) {
7272
event.target.querySelector(this.identifier.filterLegend).click();
7373
}
@@ -85,7 +85,7 @@ class Filter {
8585
if (this.filter.length > 0 && this.openFilterOnLoad) {
8686
this.toggleFilterVisibility();
8787

88-
this.filter.forEach(function(filterName) {
88+
this.filter.forEach(function (filterName) {
8989
let filterFieldset = this.filterElement.querySelector('[data-filtergroup="' + filterName + '"]');
9090
let filter = filterFieldset.querySelector(this.identifier.filterOptionContainer);
9191

@@ -95,7 +95,7 @@ class Filter {
9595
}
9696

9797
prepareCheckboxes() {
98-
this.filterElement.querySelectorAll(this.identifier.filterOptionContainer).forEach(function(filterOptionContainer) {
98+
this.filterElement.querySelectorAll(this.identifier.filterOptionContainer).forEach(function (filterOptionContainer) {
9999
let filterStatus = this.isFilterSet(filterOptionContainer);
100100

101101
if (filterStatus) {
@@ -158,7 +158,7 @@ class Filter {
158158
let selectionString = '';
159159
let filterFieldSets = this.filterElement.querySelectorAll(this.identifier.filterSection);
160160

161-
filterFieldSets.forEach(function(filterFieldSet) {
161+
filterFieldSets.forEach(function (filterFieldSet) {
162162
let selectedOptions = filterFieldSet.querySelectorAll(this.identifier.filterCheckbox + ':checked, ' + this.identifier.filterRadio + ':checked');
163163

164164
if (selectedOptions.length > 0) {
@@ -186,13 +186,14 @@ class Filter {
186186
selectionString = '#' + selectionString;
187187
}
188188

189-
window.location = location.protocol + '//' + location.host + location.pathname + (location.search ? location.search : '') + selectionString;
189+
const url = location.protocol + '//' + location.host + location.pathname + (location.search ? location.search : '') + selectionString;
190+
history.pushState({}, '', url);
190191
};
191192

192193
updateFilterByHashArguments(hashArguments) {
193194
let page = 1;
194195

195-
hashArguments.forEach(function(hashArgument) {
196+
hashArguments.forEach(function (hashArgument) {
196197
// if argument page is set
197198
if (hashArgument.name === 'page') {
198199
page = hashArgument.values[0];
@@ -221,19 +222,21 @@ class Filter {
221222
};
222223

223224
setFilterCheckboxEventListener() {
224-
this.filterElement.querySelector(this.identifier.filterSectionContainer).addEventListener('click', function(evt) {
225+
this.filterElement.querySelector(this.identifier.filterSectionContainer).addEventListener('click', function (evt) {
225226
let target = evt.target;
226227

227228
if (target.tagName === 'INPUT') {
228229
// if a show all checkbox is clicked
229230
if (target.classList.contains(this.identifier.filterShowAllCheckbox.substring(1))) {
231+
this.onClick(evt);
230232
let filterContainer = target.closest(this.identifier.filterOptionContainer);
231233
this.resetFilter(filterContainer);
232234
}
233235

234236
// if a specific filter checkbox is clicked
235237
if (target.classList.contains(this.identifier.filterCheckbox.substring(1)) || target.classList.contains(this.identifier.filterRadio.substring(1))) {
236238
let showAllCheckbox = target.closest(this.identifier.filterOptionContainer).querySelector(this.identifier.filterShowAllCheckbox);
239+
this.onClick(evt);
237240
showAllCheckbox.checked = false;
238241
showAllCheckbox.disabled = false;
239242
}
@@ -302,6 +305,9 @@ class Filter {
302305

303306
return status;
304307
}
308+
309+
onClick() {
310+
}
305311
}
306312

307313
export {Filter}

Resources/Private/JavaScript/Frontend/components/instance.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ class Instance {
5757
if (this.element.querySelector(this.identifier.quickSelectContainer) !== null) {
5858
this.quickselect.update(studyfinderElement);
5959
}
60+
61+
this.onUpdate();
6062
}
6163

64+
onUpdate() {}
6265
}
6366

6467
export {Instance}

Resources/Private/JavaScript/Frontend/components/pagination.js

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ class Pagination {
1515
}
1616

1717
init() {
18-
this.paginationElement.querySelectorAll(this.identifier.paginationLink).forEach(function(item) {
19-
item.addEventListener('click', function(event) {
18+
this.paginationElement.querySelectorAll(this.identifier.paginationLink).forEach(function (item) {
19+
item.addEventListener('click', function (event) {
20+
this.onClick(event);
2021
this.call(event);
2122
}.bind(this));
2223
}.bind(this));
@@ -26,59 +27,48 @@ class Pagination {
2627
this.studyfinderElement = studyfinderElement;
2728
this.paginationElement = studyfinderElement.querySelector(this.identifier.paginationContainer);
2829

29-
this.paginationElement.querySelectorAll(this.identifier.paginationLink).forEach(function(item) {
30-
item.addEventListener('click', function(event) {
30+
this.paginationElement.querySelectorAll(this.identifier.paginationLink).forEach(function (item) {
31+
item.addEventListener('click', function (event) {
32+
this.onClick(event);
3133
this.call(event);
3234
}.bind(this));
3335
}.bind(this));
34-
35-
this.onUpdate();
3636
}
3737

3838
call(event) {
3939
event.preventDefault();
4040

41-
this.afterClick(event);
42-
4341
let targetPage = event.target.getAttribute('data-target-page');
4442
let url = event.target.href;
4543
let instanceId = this.studyfinderElement.getAttribute('data-in2studyfinder-instance-id');
4644

4745
UrlUtility.addOrUpdateHash('page', [targetPage]);
4846

49-
let ajaxCall = new Promise((resolve) => {
50-
if (window.in2studyfinder.getInstance(instanceId).hasFilter) {
51-
window.in2studyfinder.getInstance(instanceId).filter.call(targetPage);
52-
} else {
53-
LoaderUtility.enableLoader();
54-
55-
fetch(url, {
56-
method: 'POST',
57-
headers: {
58-
'Content-Type': 'application/x-www-form-urlencoded',
59-
},
60-
}).then((response) => {
61-
return response.text();
62-
}).then((html) => {
63-
let tempElement = document.createElement('div');
64-
tempElement.innerHTML = html;
65-
this.studyfinderElement.innerHTML = tempElement.querySelector(this.identifier.container).innerHTML;
66-
67-
LoaderUtility.disableLoader();
68-
window.in2studyfinder.getInstance(instanceId).update(this.studyfinderElement);
69-
});
70-
}
71-
});
72-
73-
ajaxCall.then((message) => {
74-
this.afterLoad(event);
75-
});
76-
47+
if (window.in2studyfinder.getInstance(instanceId).hasFilter) {
48+
window.in2studyfinder.getInstance(instanceId).filter.call(targetPage);
49+
} else {
50+
LoaderUtility.enableLoader();
51+
52+
fetch(url, {
53+
method: 'POST',
54+
headers: {
55+
'Content-Type': 'application/x-www-form-urlencoded',
56+
},
57+
}).then((response) => {
58+
return response.text();
59+
}).then((html) => {
60+
let tempElement = document.createElement('div');
61+
tempElement.innerHTML = html;
62+
this.studyfinderElement.innerHTML = tempElement.querySelector(this.identifier.container).innerHTML;
63+
64+
LoaderUtility.disableLoader();
65+
window.in2studyfinder.getInstance(instanceId).update(this.studyfinderElement);
66+
});
67+
}
7768
};
7869

79-
onUpdate() {}
80-
afterClick() {}
81-
afterLoad() {}
70+
onClick() {
71+
}
8272
}
8373

8474
export {Pagination}

Resources/Private/Partials/StudyCourse/List/Filter/TypeObject.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<f:if condition="{filterType.singleSelect} == 1">
44
<f:then>
55
<f:form.radio name="searchOptions[{filterTypeName}][]" id="{filterTypeName}_{option.uid}"
6-
class="in2studyfinder__radio in2studyfinder-js-radio" value="{option.uid}"
6+
class="in2studyfinder__radio js-in2studyfinder-radio" value="{option.uid}"
77
checked="{f:if(condition: '{searchedOptions.{filterTypeName}.0} == {option.uid}', then: 'true', else: 'false')}"/>
88
<label for="{filterTypeName}_{option.uid}" class="in2studyfinder__radio-label">{option.optionField}</label>
99
</f:then>

0 commit comments

Comments
 (0)