Support adding items to the site map via plugin outlet.

This commit is contained in:
Robin Ward 2015-01-09 15:40:25 -05:00
parent bce12d17c7
commit 38e4defaee
4 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,6 @@
export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
needs: ['application'],
showBadgesLink: function(){return Discourse.SiteSettings.enable_badges;}.property(),
showAdminLinks: Em.computed.alias('currentUser.staff'),
flaggedPostsCount: Em.computed.alias("currentUser.site_flagged_posts_count"),
@ -22,8 +24,8 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
}.property(),
categories: function() {
var hideUncategorized = !Discourse.SiteSettings.allow_uncategorized_topics,
showSubcatList = Discourse.SiteSettings.show_subcategory_list,
var hideUncategorized = !this.siteSettings.allow_uncategorized_topics,
showSubcatList = this.siteSettings.show_subcategory_list,
isStaff = Discourse.User.currentProp('staff');
return Discourse.Category.list().reject(function(c) {
if (showSubcatList && c.get('parent_category_id')) { return true; }
@ -34,7 +36,7 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
actions: {
keyboardShortcuts: function(){
Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp');
this.get('controllers.application').send('showKeyboardShortcutsHelp');
},
toggleMobileView: function() {
Discourse.Mobile.toggleMobileView();

View File

@ -87,7 +87,7 @@
{{render "notifications" notifications}}
{{#if view.renderSiteMap}}
{{render "siteMap"}}
{{render "site-map"}}
{{/if}}
{{render "user-dropdown"}}

View File

@ -21,8 +21,11 @@
<a href="{{unbound badgesUrl}}" class="badge-link">{{i18n 'badges.title'}}</a>
</li>
{{/if}}
{{plugin-outlet "site-map-links"}}
{{#if showKeyboardShortcuts}}
<li><a href="#" {{action "keyboardShortcuts"}} class="keyboard-shortcuts-link">{{i18n 'keyboard_shortcuts_help.title'}}</a></li>
<li><a href {{action "keyboardShortcuts"}} class="keyboard-shortcuts-link">{{i18n 'keyboard_shortcuts_help.title'}}</a></li>
{{/if}}
<li>
<a href="{{unbound faqUrl}}" class="faq-link">{{i18n 'faq'}}</a>
@ -31,7 +34,7 @@
{{#link-to 'about'}}{{i18n 'about.simple_title'}}{{/link-to}}
</li>
{{#if showMobileToggle}}
<li><a href="#" class="mobile-toggle-link" {{action "toggleMobileView"}}>{{boundI18n mobileViewLinkTextKey}}</a></li>
<li><a href class="mobile-toggle-link" {{action "toggleMobileView"}}>{{boundI18n mobileViewLinkTextKey}}</a></li>
{{/if}}
</ul>

View File

@ -1,6 +1,8 @@
var oldMobileView;
moduleFor("controller:site-map", "controller:site-map", {
needs: ['controller:application'],
setup: function() {
oldMobileView = Discourse.Mobile.mobileView;
},
@ -77,7 +79,7 @@ test("categories", function() {
var categoryListStub = ["category1", "category2"];
sandbox.stub(Discourse.Category, "list").returns(categoryListStub);
var controller = this.subject();
var controller = this.subject({ siteSettings: Discourse.SiteSettings });
deepEqual(controller.get("categories"), categoryListStub, "returns the list of categories");
});