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"); var badgeId = this.safe("data.badge_id");
if (badgeId) { if (badgeId) {
var badgeName = this.safe("data.badge_name"); 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'); var topicId = this.safe('topic_id');
@ -29,7 +29,7 @@ export default ObjectController.extend({
} }
if (this.get('notification_type') === INVITED_TYPE) { 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"), }.property("data.{badge_id,badge_name}", "slug", "topic_id", "post_number"),

View File

@ -1,4 +1,6 @@
export default Ember.ArrayController.extend({ export default Ember.ArrayController.extend({
needs: ['header'], 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'); return Discourse.SiteSettings.faq_url ? Discourse.SiteSettings.faq_url : Discourse.getURL('/faq');
}.property(), }.property(),
badgesUrl: Discourse.getURL('/badges'), badgesUrl: Discourse.computed.url('/badges'),
showKeyboardShortcuts: function(){ showKeyboardShortcuts: function(){
return !Discourse.Mobile.mobileView && !this.capabilities.touch; return !Discourse.Mobile.mobileView && !this.capabilities.touch;

View File

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

View File

@ -2,19 +2,23 @@
<ul class="location-links"> <ul class="location-links">
{{#if showAdminLinks}} {{#if showAdminLinks}}
<li> <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>
<li> <li>
<a href="/admin/flags/active" class="flagged-posts-link"> {{#link-to "adminFlags" class="flagged-posts-link"}}
{{fa-icon "flag"}} {{i18n 'flags_title'}} {{fa-icon "flag"}} {{i18n 'flags_title'}}
{{#if currentUser.site_flagged_posts_count}} {{#if currentUser.site_flagged_posts_count}}
<span title='{{i18n 'notifications.total_flagged'}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</span> <span title='{{i18n 'notifications.total_flagged'}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</span>
{{/if}} {{/if}}
</a> {{/link-to}}
</li> </li>
{{/if}} {{/if}}
<li> <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> </li>
{{#if showBadgesLink}} {{#if showBadgesLink}}
<li> <li>