FIX: Use replaceWith instead of transitionTo when redirecting to a

user's activity. That way the back button works nicely. Also we can now
shorten a lot of links that were going to activity instead.
This commit is contained in:
Robin Ward 2014-06-03 10:47:21 -04:00
parent 3f9c4100ef
commit 80fd714b23
8 changed files with 8 additions and 8 deletions

View file

@ -4,7 +4,7 @@
<div class='field'>{{i18n user.username.title}}</div>
<div class='value'>{{username}}</div>
<div class='controls'>
{{#link-to 'userActivity' model class="btn"}}
{{#link-to 'user' model class="btn"}}
<i class='fa fa-user'></i>
{{i18n admin.user.show_public_profile}}
{{/link-to}}

View file

@ -11,7 +11,7 @@ Discourse.RestrictedUserRoute = Discourse.Route.extend({
afterModel: function() {
var user = this.modelFor('user');
if (!user.get('can_edit')) {
this.transitionTo('userActivity');
this.replaceWith('userActivity');
}
}

View file

@ -8,6 +8,6 @@
**/
Discourse.UserIndexRoute = Discourse.UserActivityRoute.extend({
redirect: function() {
this.transitionTo('userActivity', this.modelFor('user'));
this.replaceWith('userActivity', this.modelFor('user'));
}
});

View file

@ -16,7 +16,7 @@
{{#if userBadges}}
<div>
{{#each userBadges}}
{{#link-to 'userActivity' user}}
{{#link-to 'user' user}}
<div class="badge-user">
{{avatar user imageSize="large"}}
<div class="details">

View file

@ -9,7 +9,7 @@
{{avatar this imageSize="large"}}
</td>
<td>
<h3>{{#link-to 'userActivity' this}}{{username}}{{/link-to}}</h3>
<h3>{{#link-to 'user' this}}{{username}}{{/link-to}}</h3>
<p>{{name}}</p>
</td>
<td>

View file

@ -37,7 +37,7 @@
<button class='btn btn-primary' {{action composePrivateMessage user}}><i class='fa fa-envelope'></i>{{i18n user.private_message}}</button>
{{/if}}
{{#link-to 'userActivity.index' user class="btn"}}<i class='fa fa-user'></i>{{i18n user.show_profile}}{{/link-to}}
{{#link-to 'user' user class="btn"}}<i class='fa fa-user'></i>{{i18n user.show_profile}}{{/link-to}}
{{#if showFilter}}
<button class='btn' {{action togglePosts user}}><i class='fa fa-filter'></i>{{i18n topic.filter_to username="username" post_count="participant.post_count"}}</button>

View file

@ -102,7 +102,7 @@
<dt>{{i18n user.last_seen}}</dt><dd>{{date last_seen_at}}</dd>
{{/if}}
{{#if invited_by}}
<dt>{{i18n user.invited_by}}</dt><dd>{{#link-to 'userActivity' invited_by}}{{invited_by.username}}{{/link-to}}</dd>
<dt>{{i18n user.invited_by}}</dt><dd>{{#link-to 'user' invited_by}}{{invited_by.username}}{{/link-to}}</dd>
{{/if}}
{{#if email}}
<dt>{{i18n user.email.title}}</dt><dd {{bind-attr title="email"}}>{{email}}</dd>

View file

@ -1,6 +1,6 @@
<section class='d-dropdown' id='user-dropdown'>
<ul class='user-dropdown-links'>
<li>{{#link-to 'userActivity' currentUser class="user-activity-link" }}{{i18n user.profile}}{{/link-to}}</li>
<li>{{#link-to 'user' currentUser class="user-activity-link" }}{{i18n user.profile}}{{/link-to}}</li>
{{#if showAdminLinks}}
<li>{{#link-to 'adminUser' currentUser.username }}{{i18n admin_title}}{{/link-to}}</li>
{{/if}}