Load Suppressed entries.

This commit is contained in:
buddha87 2017-01-04 20:25:51 +01:00
parent 16b918c155
commit e3796fb2f3
4 changed files with 102 additions and 10 deletions

View File

@ -179,3 +179,47 @@
@import "tags.less"; @import "tags.less";
} }
// LEGACY/DEPRECATED User- & Space picker
ul.tag_input {
list-style: none;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
padding: 0 0 9px 4px;
li img {
margin: 0 5px 0 0;
}
}
.tag_input_field {
outline: none;
border: none !important;
padding: 5px 4px 0 !important;
width: 170px;
margin: 2px 0 0 !important;
}
.userInput,
.spaceInput {
background-color: @info;
font-weight: 600;
color: #fff;
border-radius: 3px;
font-size: 12px !important;
padding: 2px;
float: left;
margin: 3px 4px 0 0;
}
.userInput i,
.spaceInput i {
padding: 0 6px;
font-size: 14px;
cursor: pointer;
line-height: 8px;
}

View File

@ -81,4 +81,17 @@
.stream-entry-loader { .stream-entry-loader {
float:right; float:right;
margin-top:5px; margin-top:5px;
}
.load-suppressed {
margin-bottom:5px;
a {
display:inline-block;
background-color: white;
padding:5px;
border-radius: 4px;
border: 1px solid #ddd;
font-size: 11px
}
} }

View File

@ -488,7 +488,7 @@ humhub.module('stream', function(module, require, $) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
var $result; var $result;
// Don't proceed if stream is already loading // Don't proceed if stream is already loading
if(!cfg.contentId && (that.loading || that.lastEntryLoaded)) { if(!cfg.contentId && !cfg.insertAfter && (that.loading || that.lastEntryLoaded)) {
resolve(); resolve();
return; return;
} }
@ -496,6 +496,7 @@ humhub.module('stream', function(module, require, $) {
if(cfg.loader) { if(cfg.loader) {
that.showLoader(); that.showLoader();
} }
that.loading = true; that.loading = true;
that._load(cfg).then(function(response) { that._load(cfg).then(function(response) {
if(cfg.loader) { if(cfg.loader) {
@ -504,12 +505,12 @@ humhub.module('stream', function(module, require, $) {
// If its not a single entry load and we get no content, we expect last entry is loaded // If its not a single entry load and we get no content, we expect last entry is loaded
// This may have to be change if we require to reload multiple elements. // This may have to be change if we require to reload multiple elements.
if(!cfg['contentId'] && object.isEmpty(response.content)) { if(!cfg.contentId && object.isEmpty(response.content)) {
that.lastEntryLoaded = true; that.lastEntryLoaded = true;
that.$.trigger('humhub:modules:stream:lastEntryLoaded'); that.$.trigger('humhub:modules:stream:lastEntryLoaded');
//We call onChange here, since we want to display empty messages in case its the first call //We call onChange here, since we want to display empty messages in case its the first call
that.onChange(); that.onChange();
} else if(!cfg['contentId']) { } else if(!cfg.contentId && !cfg.insertAfter) {
that.lastEntryLoaded = response.isLast; that.lastEntryLoaded = response.isLast;
$result = that.addEntries(response, cfg); $result = that.addEntries(response, cfg);
} else { } else {
@ -586,6 +587,16 @@ humhub.module('stream', function(module, require, $) {
that.onChange(); that.onChange();
}); });
}; };
Stream.prototype.after = function(html, $entryNode) {
var $html = $(html).hide();
$entryNode.after($html);
var that = this;
$html.fadeIn('fast', function() {
additions.applyTo($html);
that.onChange();
});
};
Stream.prototype.appendEntry = function(html) { Stream.prototype.appendEntry = function(html) {
var $html = $(html).hide(); var $html = $(html).hide();
@ -595,7 +606,6 @@ humhub.module('stream', function(module, require, $) {
additions.applyTo($html); additions.applyTo($html);
that.onChange(); that.onChange();
}); });
}; };
@ -622,15 +632,18 @@ humhub.module('stream', function(module, require, $) {
return $result; return $result;
} }
this.$.trigger('humhub:modules:stream:beforeAddEntries', [response, result]); this.$.trigger('humhub:stream:beforeAddEntries', [response, result]);
if(cfg['prepend']) { if(cfg['prepend']) {
this.prependEntry($result); this.prependEntry($result);
} else if(cfg.insertAfter) {
this.after($result, cfg.insertAfter);
} else { } else {
this.appendEntry($result); this.appendEntry($result);
} }
this.$.trigger('humhub:modules:stream:afterAddEntries', [response, result]); this.$.trigger('humhub:stream:afterAddEntries', [response, result]);
$result.fadeIn('fast'); $result.fadeIn('fast');
return $result; return $result;
}; };
@ -753,16 +766,27 @@ humhub.module('stream', function(module, require, $) {
} }
var that = this; var that = this;
this.$.on('humhub:modules:stream:clear', function() { this.$.on('humhub:modules:stream:clear', function() {
that.$.find(".emptyStreamMessage").hide(); that.$.find(".emptyStreamMessage").hide();
that.$.find(".emptyFilterStreamMessage").hide(); that.$.find(".emptyFilterStreamMessage").hide();
that.$.find('.back_button_holder').hide(); that.$.find('.back_button_holder').hide();
}); });
this.$.on('humhub:modules:stream:afterAppendEntries', function(evt, stream) { this.$.on('humhub:stream:afterAddEntries', function(evt, resp, res) {
if(that.isShowSingleEntry()) { $.each(resp.contentSuppressions, function(key, values) {
that.$.find('.back_button_holder').show(); var entry = that.entry(key);
} var $loadDiv = $('<div class="load-suppressed"><a href="#" data-ui-loader>'+values.length+' more...</a></div>');
entry.$.after($loadDiv);
$loadDiv.on('click', function(evt) {
evt.preventDefault();
that.loadEntries({'insertAfter': entry.$, 'from': key, 'limit': values.length}).then(function(resp) {
$loadDiv.remove();
}).catch(function(err) {
module.log.error(err, true);
});
})
});
}); });
this.$.on('humhub:modules:stream:lastEntryLoaded', function() { this.$.on('humhub:modules:stream:lastEntryLoaded', function() {

View File

@ -2018,6 +2018,17 @@ table td a:hover {
float: right; float: right;
margin-top: 5px; margin-top: 5px;
} }
.load-suppressed {
margin-bottom: 5px;
}
.load-suppressed a {
display: inline-block;
background-color: white;
padding: 5px;
border-radius: 4px;
border: 1px solid #ddd;
font-size: 11px;
}
.space-owner { .space-owner {
text-align: center; text-align: center;
margin: 14px 0; margin: 14px 0;