aspects streams now ajax
This commit is contained in:
parent
f6701f2262
commit
84c041ba6a
8 changed files with 19 additions and 11 deletions
|
|
@ -7,6 +7,7 @@ class AspectsController < ApplicationController
|
||||||
|
|
||||||
respond_to :html
|
respond_to :html
|
||||||
respond_to :json, :only => :show
|
respond_to :json, :only => :show
|
||||||
|
respond_to :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
@posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC'
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,9 @@
|
||||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
||||||
= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count
|
= render 'aspects/no_posts_message', :post_count => @post_hashes.length, :contact_count => @contacts.count
|
||||||
|
|
||||||
= render 'shared/stream', :posts => @post_hashes
|
%ul{:class => 'stream', :id => 'main_stream'}
|
||||||
|
= render 'shared/stream', :posts => @post_hashes
|
||||||
|
|
||||||
#pagination
|
|
||||||
= will_paginate @posts
|
|
||||||
|
|
||||||
.span-8.last
|
.span-8.last
|
||||||
= render 'aspects/all_aspects_contacts'
|
= render 'aspects/all_aspects_contacts'
|
||||||
|
|
|
||||||
1
app/views/aspects/index.js.erb
Normal file
1
app/views/aspects/index.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>");
|
||||||
|
|
@ -23,8 +23,5 @@
|
||||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts_count, :options => false
|
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts_count, :options => false
|
||||||
= render 'aspects/no_posts_message', :post_count => @post_count, :contact_count=> @aspect_contacts_count
|
= render 'aspects/no_posts_message', :post_count => @post_count, :contact_count=> @aspect_contacts_count
|
||||||
|
|
||||||
= render 'shared/stream', :posts => @post_hashes
|
%ul{:class => 'stream', :id => 'main_stream'}
|
||||||
|
= render 'shared/stream', :posts => @post_hashes
|
||||||
#pagination
|
|
||||||
= will_paginate @posts
|
|
||||||
|
|
||||||
|
|
|
||||||
1
app/views/aspects/show.js.erb
Normal file
1
app/views/aspects/show.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>");
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
- for post_hash in posts
|
||||||
|
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
|
||||||
|
|
||||||
%ul{:class => 'stream', :id => 'main_stream'}
|
.pagination
|
||||||
- for post_hash in posts
|
= will_paginate @posts
|
||||||
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ javascripts:
|
||||||
- public/javascripts/vendor/fileuploader.js
|
- public/javascripts/vendor/fileuploader.js
|
||||||
- public/javascripts/view.js
|
- public/javascripts/view.js
|
||||||
- public/javascripts/stream.js
|
- public/javascripts/stream.js
|
||||||
|
- public/javascripts/application.js
|
||||||
mobile:
|
mobile:
|
||||||
- public/javascripts/vendor/jquery144.min.js
|
- public/javascripts/vendor/jquery144.min.js
|
||||||
- public/javascripts/custom-mobile-scripting.js
|
- public/javascripts/custom-mobile-scripting.js
|
||||||
|
|
|
||||||
7
public/javascripts/application.js
Normal file
7
public/javascripts/application.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
$(function () {
|
||||||
|
$('#main_stream .pagination a').live('click', function () {
|
||||||
|
$.getScript(this.href);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue