Using replaceState instead of pushState when the social user id is there but the slug doesn't match.

This commit is contained in:
Samuel Clay 2012-06-28 11:00:50 -07:00
parent 75eb93b7b0
commit 044b34e8cb
3 changed files with 9 additions and 3 deletions

View file

@ -58,7 +58,7 @@ def index(request):
username = request.subdomain
try:
if '.' in username:
username = username.lsplit('.')[0]
username = username.split('.')[0]
user = User.objects.get(username=username)
except User.DoesNotExist:
return HttpResponseRedirect('http://%s%s' % (

View file

@ -1306,8 +1306,12 @@
var slug = _.string.words(_.string.clean(feed.get('feed_title').replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
var url = "social/" + feed.get('user_id') + "/" + slug;
if (!_.string.include(window.location.pathname, url)) {
var params = {};
if (_.string.include(window.location.pathname, "social/" + feed.get('user_id'))) {
params['replace'] = true;
}
// console.log(["Navigating to social", url, window.location.pathname]);
NEWSBLUR.router.navigate(url);
NEWSBLUR.router.navigate(url, params);
}
} else if (!feed.get('feed_title')) {
console.log(["No feed title on social", feed]);

View file

@ -1,3 +1,5 @@
{% load utils_tags %}
<!DOCTYPE html>
<html>
@ -17,7 +19,7 @@
<header class="NB-header">
<h1 class="NB-title {% if not social_profile.bio %}NB-title-no-bio{% endif %}">
<a href="{% url index %}social/{{ social_profile.user_id }}/{{ social_profile.username|slugify }}" class="NB-title-logo">
<a href="http://{% current_domain %}/social/{{ social_profile.user_id }}/{{ social_profile.username|slugify }}" class="NB-title-logo">
<img src="{{ MEDIA_URL }}img/logo_128.png" class="NB-hover-off" />
<img src="{{ MEDIA_URL }}img/logo_newsblur_512.png" class="NB-hover-on" />
</a>