diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 index 1492a11be..13acb784e 100644 --- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 @@ -47,7 +47,7 @@ **/ -let _connectorCache; +let _connectorCache, _rawCache; function findOutlets(collection, callback) { @@ -73,6 +73,7 @@ function findOutlets(collection, callback) { function buildConnectorCache() { _connectorCache = {}; + _rawCache = {}; const uniqueViews = {}; findOutlets(requirejs._eak_seen, function(outletName, resource, uniqueName) { @@ -93,10 +94,23 @@ function buildConnectorCache() { // We are going to add it back with the proper template _connectorCache[outletName].removeObject(viewClass); } else { - viewClass = Em.View.extend({ classNames: [outletName + '-outlet', uniqueName] }); + if (!/\.raw$/.test(uniqueName)) { + viewClass = Em.View.extend({ classNames: [outletName + '-outlet', uniqueName] }); + } + } + + if (viewClass) { + _connectorCache[outletName].pushObject(viewClass.extend(mixin)); + } else { + // we have a raw template + if (!_rawCache[outletName]) { + _rawCache[outletName] = []; + } + + _rawCache[outletName].push(Ember.TEMPLATES[resource]); } - _connectorCache[outletName].pushObject(viewClass.extend(mixin)); }); + } var _viewInjections; @@ -113,6 +127,24 @@ function viewInjections(container) { return _viewInjections; } +// unbound version of outlets, only has a template +Handlebars.registerHelper('plugin-outlet', function(name){ + + if (!_rawCache) { buildConnectorCache(); } + + const functions = _rawCache[name]; + if (functions) { + var output = []; + + for(var i=0; i" + title + ""; - string = runFilters('topic-link', string, topic); - return new Handlebars.SafeString(string); }); diff --git a/app/assets/javascripts/discourse/lib/filter.js.es6 b/app/assets/javascripts/discourse/lib/filter.js.es6 deleted file mode 100644 index 7f0537f20..000000000 --- a/app/assets/javascripts/discourse/lib/filter.js.es6 +++ /dev/null @@ -1,24 +0,0 @@ -var filters = {}; - -// use filter API to register a callback from a plugin -const filter = function(name, fn) { - var current = filters[name] = filters[name] || []; - current.push(fn); -}; - -const runFilters = function(name, val) { - const current = filters[name]; - if (current) { - - var args = Array.prototype.slice.call(arguments, 1); - - for(var i = 0; i < current.length; i++) { - val = current[i].apply(this, args); - } - } - - return val; -}; - -export { runFilters }; -export default filter; diff --git a/app/assets/javascripts/discourse/templates/components/search-result-topic.hbs b/app/assets/javascripts/discourse/templates/components/search-result-topic.hbs index c092bcaa6..01d100b71 100644 --- a/app/assets/javascripts/discourse/templates/components/search-result-topic.hbs +++ b/app/assets/javascripts/discourse/templates/components/search-result-topic.hbs @@ -2,7 +2,7 @@
  • - {{topic-status topic=result.topic disableActions=true}}{{unbound result.topic.title}}{{category-badge result.topic.category}} + {{topic-status topic=result.topic disableActions=true}}{{unbound result.topic.title}}{{category-badge result.topic.category}}{{plugin-outlet "search-category"}} {{#unless site.mobileView}} diff --git a/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs b/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs index 92f0bd68e..26c958c4e 100644 --- a/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs +++ b/app/assets/javascripts/discourse/templates/list/topic-list-item.raw.hbs @@ -10,6 +10,7 @@ {{#if controller.showTopicPostBadges}} {{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}} {{/if}} + {{plugin-outlet "topic-list-tags"}} {{#if expandPinned}} {{raw "list/topic-excerpt" topic=topic}} {{/if}}