FIX: broken header links when using relative_url_root

This commit is contained in:
Neil Lalonde 2015-04-19 13:52:10 -04:00
parent ba6d5505af
commit c2e3c86883
5 changed files with 15 additions and 9 deletions

View File

@ -20,7 +20,7 @@ export default ObjectController.extend({
var badgeId = this.safe("data.badge_id");
if (badgeId) {
var badgeName = this.safe("data.badge_name");
return '/badges/' + badgeId + '/' + badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase();
return Discourse.getURL('/badges/' + badgeId + '/' + badgeName.replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase());
}
var topicId = this.safe('topic_id');
@ -29,7 +29,7 @@ export default ObjectController.extend({
}
if (this.get('notification_type') === INVITED_TYPE) {
return '/my/invited';
return Discourse.getURL('/my/invited');
}
}.property("data.{badge_id,badge_name}", "slug", "topic_id", "post_number"),

View File

@ -1,4 +1,6 @@
export default Ember.ArrayController.extend({
needs: ['header'],
loadingNotifications: Em.computed.alias('controllers.header.loadingNotifications')
loadingNotifications: Em.computed.alias('controllers.header.loadingNotifications'),
myNotificationsUrl: Discourse.computed.url('/my/notifications')
});

View File

@ -8,7 +8,7 @@ export default Ember.ArrayController.extend({
return Discourse.SiteSettings.faq_url ? Discourse.SiteSettings.faq_url : Discourse.getURL('/faq');
}.property(),
badgesUrl: Discourse.getURL('/badges'),
badgesUrl: Discourse.computed.url('/badges'),
showKeyboardShortcuts: function(){
return !Discourse.Mobile.mobileView && !this.capabilities.touch;

View File

@ -6,7 +6,7 @@
{{notification-item notification=n scope=n.scope}}
{{/each}}
<li class="read last">
<a href="/my/notifications">{{i18n 'notifications.more'}}&hellip;</a>
<a href="{{unbound myNotificationsUrl}}">{{i18n 'notifications.more'}}&hellip;</a>
</li>
</ul>
{{else}}

View File

@ -2,19 +2,23 @@
<ul class="location-links">
{{#if showAdminLinks}}
<li>
<a href="/admin" class="admin-link"><i class='fa fa-wrench'></i> {{i18n 'admin_title'}}</a>
{{#link-to "admin" class="admin-link"}}
<i class='fa fa-wrench'></i> {{i18n 'admin_title'}}
{{/link-to}}
</li>
<li>
<a href="/admin/flags/active" class="flagged-posts-link">
{{#link-to "adminFlags" class="flagged-posts-link"}}
{{fa-icon "flag"}} {{i18n 'flags_title'}}
{{#if currentUser.site_flagged_posts_count}}
<span title='{{i18n 'notifications.total_flagged'}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</span>
{{/if}}
</a>
{{/link-to}}
</li>
{{/if}}
<li>
<a href="/latest" title="{{i18n 'filters.latest.help'}}" class="latest-topics-link">{{i18n 'filters.latest.title'}}</a>
{{#link-to "discovery.latest" class="latest-topics-link"}}
{{i18n 'filters.latest.title'}}
{{/link-to}}
</li>
{{#if showBadgesLink}}
<li>