This commit is contained in:
MrZYX 2011-04-03 14:53:40 +02:00
parent b776bb52db
commit 100d705c2f
4 changed files with 22 additions and 3 deletions

View file

@ -2,7 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%a.conversation{:href => conversations_path(:conversation_id => conversation.id)}
%a.conversation{:href => conversation_path(conversation)}
.stream_element.conversation{:data=>{:guid=>conversation.id}, :class => ('unread' if unread_counts[conversation.id].to_i > 0)}
= person_image_tag(conversation.author)

View file

@ -2,4 +2,5 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= render 'show', :conversation => @conversation

View file

@ -8,12 +8,30 @@ $(document).ready(function(){
$('a.conversation').live('click', function(){
$.getScript(this.href);
history.pushState(null, "", this.href);
var conv = $(this).children('.stream_element'),
cBadge = $("#message_inbox_badge").children(".badge_count");
if(conv.hasClass('unread') ){
conv.removeClass('unread');
}
if(cBadge.html() != null) {
cBadge.html().replace(/\d+/, function(num){
num = parseInt(num);
cBadge.html(parseInt(num)-1);
if(num == 1) {
cBadge.addClass("hidden");
}
});
}
return false;
});
$(window).bind("popstate", function(){
$.getScript(location.href);
return false;
if (location.href.match(/conversations\/\d+/) != null) {
$.getScript(location.href);
return false;
}
});
resize();