mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 20:34:52 +00:00
FIX: extra-nav-item outlet no longer adds a DIV to UL
This amends the extensibility on navigation bar so extra nav items are not added to a DIV nested into the UL, instead the LIs are rendered as usual
This commit is contained in:
parent
f9aae7af6a
commit
3227d79430
@ -1,11 +1,17 @@
|
|||||||
import { default as computed, observes } from "ember-addons/ember-computed-decorators";
|
import { default as computed, observes } from "ember-addons/ember-computed-decorators";
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
import { renderedConnectorsFor } from 'discourse/lib/plugin-connectors';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
tagName: 'ul',
|
tagName: 'ul',
|
||||||
classNameBindings: [':nav', ':nav-pills'],
|
classNameBindings: [':nav', ':nav-pills'],
|
||||||
id: 'navigation-bar',
|
id: 'navigation-bar',
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this._super();
|
||||||
|
this.set('connectors', renderedConnectorsFor("extra-nav-item", null, this));
|
||||||
|
},
|
||||||
|
|
||||||
@computed("filterMode", "navItems")
|
@computed("filterMode", "navItems")
|
||||||
selectedNavItem(filterMode, navItems){
|
selectedNavItem(filterMode, navItems){
|
||||||
var item = navItems.find(i => i.get('filterMode').indexOf(filterMode) === 0);
|
var item = navItems.find(i => i.get('filterMode').indexOf(filterMode) === 0);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
The list of disabled plugins is returned via the `Site` singleton.
|
The list of disabled plugins is returned via the `Site` singleton.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
import { connectorsFor } from 'discourse/lib/plugin-connectors';
|
import { renderedConnectorsFor } from 'discourse/lib/plugin-connectors';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
@ -38,14 +38,9 @@ export default Ember.Component.extend({
|
|||||||
init() {
|
init() {
|
||||||
this._super();
|
this._super();
|
||||||
const name = this.get('name');
|
const name = this.get('name');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
const args = this.get('args');
|
const args = this.get('args');
|
||||||
const connectors = connectorsFor(name).filter(con => {
|
this.set('connectors', renderedConnectorsFor(name, args, this));
|
||||||
return con.connectorClass.shouldRender(args, this);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.set('connectors', connectors);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -92,6 +92,13 @@ export function connectorsFor(outletName) {
|
|||||||
return _connectorCache[outletName] || [];
|
return _connectorCache[outletName] || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function renderedConnectorsFor(outletName, args, context) {
|
||||||
|
return connectorsFor(outletName).filter(con => {
|
||||||
|
return con.connectorClass.shouldRender(args, context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function rawConnectorsFor(outletName) {
|
export function rawConnectorsFor(outletName) {
|
||||||
if (!_rawConnectorCache) { buildRawConnectorCache(); }
|
if (!_rawConnectorCache) { buildRawConnectorCache(); }
|
||||||
return _rawConnectorCache[outletName] || [];
|
return _rawConnectorCache[outletName] || [];
|
||||||
|
@ -2,4 +2,6 @@
|
|||||||
{{navigation-item content=navItem filterMode=filterMode}}
|
{{navigation-item content=navItem filterMode=filterMode}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{custom-html name="extraNavItem" tagName="li"}}
|
{{custom-html name="extraNavItem" tagName="li"}}
|
||||||
{{plugin-outlet name="extra-nav-item" tagName="li"}}
|
{{#each connectors as |c|}}
|
||||||
|
{{plugin-connector connector=c class=c.classNames tagName="li" args=(hash category=category filterMode=filterMode)}}
|
||||||
|
{{/each}}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
noSubcategories=noSubcategories
|
noSubcategories=noSubcategories
|
||||||
hideSubcategories=showingSubcategoryList}}
|
hideSubcategories=showingSubcategoryList}}
|
||||||
|
|
||||||
{{navigation-bar navItems=navItems filterMode=filterMode}}
|
{{navigation-bar navItems=navItems filterMode=filterMode category=category}}
|
||||||
|
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
{{category-notifications-button category=category}}
|
{{category-notifications-button category=category}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user