Display topics and content types in filters header on load page with selected filters (#6446)

This commit is contained in:
Yuriy Bakhtin 2023-07-19 21:55:14 +04:00 committed by GitHub
parent 53eec3edf6
commit a7fc6f9dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 15 deletions

View File

@ -10,6 +10,7 @@ HumHub Changelog
- Fix #6377: Forgot Password - Display email input error after successful captcha verification.
- Fix #6378: Fix visibility of the link "Uninstall" on Windows server
- Fix #6404: Fix visibility of global content on dashboard for registered users
- Fix #6441: Display topics and content types in filters header on load page with selected filters
1.14.2 (May 22, 2023)
----------------------

View File

@ -299,32 +299,34 @@ humhub.module('stream.wall', function (module, require, $) {
};
WallStreamFilter.prototype.initTopicPicker = function() {
var that = this;
var topicPicker = this.getTopicPicker();
if(topicPicker) {
topicPicker.$.on('change', function() {
var topics = [];
$.each(that.getTopicPicker().map(), function(key, value) {
const topicPicker = this.getTopicPicker();
if (topicPicker) {
const updateFilterBar = function () {
const topics = [];
$.each(topicPicker.map(), function(key, value) {
topics.push({id:key, name: value})
});
// Note the stream init is triggered by the humhub:topic:updated event
topic.setTopics(topics);
});
}
topicPicker.on('afterInitSelect2', updateFilterBar)
.$.on('change', updateFilterBar);
}
};
WallStreamFilter.prototype.initContentTypePicker = function() {
var that = this;
var contentTypePicker = this.getContentTypePicker();
if(contentTypePicker) {
contentTypePicker.$.on('change', function() {
var $filterBar = that.getFilterBar();
const that = this;
const contentTypePicker = this.getContentTypePicker();
if (contentTypePicker) {
const updateFilterBar = function () {
const $filterBar = that.getFilterBar();
$filterBar.find('.content-type-remove-label').remove();
Widget.instance($(this)).data().forEach(function(contentType) {
contentTypePicker.data().forEach(function(contentType) {
$(string.template(WallStreamFilter.template.removeContentTypeLabel, contentType)).appendTo($filterBar);
});
});
}
contentTypePicker.on('afterInitSelect2', updateFilterBar)
.$.on('change', updateFilterBar);
}
};

View File

@ -170,6 +170,8 @@ humhub.module('ui.picker', function (module, require, $) {
if ($node.data('picker-focus')) {
Widget.instance($node).focus();
}
Widget.instance($node).fire('afterInitSelect2');
});
};