[refs #265] add ajax to older messages
This commit is contained in:
parent
30038f4c9c
commit
b678320638
|
@ -35,4 +35,18 @@ $(document).ready(function() {
|
|||
$('div.information > div.profile > a').live('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('.more_activities').live('click', function(){
|
||||
var button = $(this);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: button.attr("href"),
|
||||
success: function(data){
|
||||
button.fadeOut('slow').after(data);
|
||||
button.remove();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -5,7 +5,11 @@ class ActivityFeedsController < ApplicationController
|
|||
@filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all
|
||||
@activity_feeds = current_user.activity_feeds
|
||||
@activity_feeds = @activity_feeds.where(:kind => "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all
|
||||
|
||||
@activity_feeds = @activity_feeds.paginate :page => params[:page]
|
||||
if request.format == '*/*'
|
||||
render '_list', :layout => false
|
||||
else
|
||||
render 'index'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
- @activity_feeds.each do |activity_feed|
|
||||
.activity
|
||||
= render_activity_feed(activity_feed)
|
||||
- if @activity_feeds.next_page
|
||||
%a{:href => activity_feeds_path({:filter => @filter, :page => @activity_feeds.next_page}), :class => 'more_activities'}
|
||||
.messages.messages-last=t('layout.activity_feed.load_messages')
|
|
@ -1,10 +1,5 @@
|
|||
%h3.fix= t("layout.activity_feed.header")
|
||||
- @activity_feeds.each do |activity_feed|
|
||||
.activity
|
||||
= render_activity_feed(activity_feed)
|
||||
- if @activity_feeds.next_page
|
||||
%a{:href => activity_feeds_path({:filter => @filter, :page => @activity_feeds.next_page})}
|
||||
.messages.messages-last=t('layout.activity_feed.load_messages')
|
||||
=render 'list'
|
||||
|
||||
- content_for :sidebar, render('sidebar')
|
||||
- content_for :feed_tabs, render('feed_tabs')
|
||||
|
|
Loading…
Reference in New Issue