diff --git a/less/humhub.less b/less/humhub.less index 92497a8291..a779fa820a 100644 --- a/less/humhub.less +++ b/less/humhub.less @@ -179,3 +179,47 @@ @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; +} + diff --git a/less/stream.less b/less/stream.less index 789abbf2ea..5a1c4dcea1 100644 --- a/less/stream.less +++ b/less/stream.less @@ -81,4 +81,17 @@ .stream-entry-loader { float:right; 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 + } } \ No newline at end of file diff --git a/protected/humhub/modules/stream/assets/js/humhub.stream.js b/protected/humhub/modules/stream/assets/js/humhub.stream.js index 41f64c6009..7cac43ae03 100644 --- a/protected/humhub/modules/stream/assets/js/humhub.stream.js +++ b/protected/humhub/modules/stream/assets/js/humhub.stream.js @@ -488,7 +488,7 @@ humhub.module('stream', function(module, require, $) { return new Promise(function(resolve, reject) { var $result; // 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(); return; } @@ -496,6 +496,7 @@ humhub.module('stream', function(module, require, $) { if(cfg.loader) { that.showLoader(); } + that.loading = true; that._load(cfg).then(function(response) { 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 // 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.$.trigger('humhub:modules:stream:lastEntryLoaded'); //We call onChange here, since we want to display empty messages in case its the first call that.onChange(); - } else if(!cfg['contentId']) { + } else if(!cfg.contentId && !cfg.insertAfter) { that.lastEntryLoaded = response.isLast; $result = that.addEntries(response, cfg); } else { @@ -586,6 +587,16 @@ humhub.module('stream', function(module, require, $) { 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) { var $html = $(html).hide(); @@ -595,7 +606,6 @@ humhub.module('stream', function(module, require, $) { additions.applyTo($html); that.onChange(); }); - }; @@ -622,15 +632,18 @@ humhub.module('stream', function(module, require, $) { return $result; } - this.$.trigger('humhub:modules:stream:beforeAddEntries', [response, result]); + this.$.trigger('humhub:stream:beforeAddEntries', [response, result]); + if(cfg['prepend']) { this.prependEntry($result); + } else if(cfg.insertAfter) { + this.after($result, cfg.insertAfter); } else { this.appendEntry($result); } - this.$.trigger('humhub:modules:stream:afterAddEntries', [response, result]); + this.$.trigger('humhub:stream:afterAddEntries', [response, result]); $result.fadeIn('fast'); return $result; }; @@ -753,16 +766,27 @@ humhub.module('stream', function(module, require, $) { } var that = this; + this.$.on('humhub:modules:stream:clear', function() { that.$.find(".emptyStreamMessage").hide(); that.$.find(".emptyFilterStreamMessage").hide(); that.$.find('.back_button_holder').hide(); }); - this.$.on('humhub:modules:stream:afterAppendEntries', function(evt, stream) { - if(that.isShowSingleEntry()) { - that.$.find('.back_button_holder').show(); - } + this.$.on('humhub:stream:afterAddEntries', function(evt, resp, res) { + $.each(resp.contentSuppressions, function(key, values) { + var entry = that.entry(key); + var $loadDiv = $('
'); + 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() { diff --git a/themes/HumHub/css/theme.css b/themes/HumHub/css/theme.css index 469e143745..33684f1046 100644 --- a/themes/HumHub/css/theme.css +++ b/themes/HumHub/css/theme.css @@ -2018,6 +2018,17 @@ table td a:hover { float: right; 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 { text-align: center; margin: 14px 0;