diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 0b278535b..4d6449946 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -7,6 +7,7 @@ class AspectsController < ApplicationController respond_to :html respond_to :json, :only => :show + respond_to :js def index @posts = current_user.visible_posts(:_type => "StatusMessage").paginate :page => params[:page], :per_page => 15, :order => 'created_at DESC' diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 9dbf397a5..31bcec16c 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -15,10 +15,9 @@ = 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 'shared/stream', :posts => @post_hashes + %ul{:class => 'stream', :id => 'main_stream'} + = render 'shared/stream', :posts => @post_hashes - #pagination - = will_paginate @posts .span-8.last = render 'aspects/all_aspects_contacts' diff --git a/app/views/aspects/index.js.erb b/app/views/aspects/index.js.erb new file mode 100644 index 000000000..aa27af5a0 --- /dev/null +++ b/app/views/aspects/index.js.erb @@ -0,0 +1 @@ +$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>"); diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index f209ddae3..a8b7692e6 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -23,8 +23,5 @@ = 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 'shared/stream', :posts => @post_hashes - - #pagination - = will_paginate @posts - + %ul{:class => 'stream', :id => 'main_stream'} + = render 'shared/stream', :posts => @post_hashes diff --git a/app/views/aspects/show.js.erb b/app/views/aspects/show.js.erb new file mode 100644 index 000000000..aa27af5a0 --- /dev/null +++ b/app/views/aspects/show.js.erb @@ -0,0 +1 @@ +$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>"); diff --git a/app/views/shared/_stream.haml b/app/views/shared/_stream.haml index b43f40f5d..bf5dbbf6a 100644 --- a/app/views/shared/_stream.haml +++ b/app/views/shared/_stream.haml @@ -1,7 +1,8 @@ -# Copyright (c) 2010, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# 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'} - - for post_hash in posts - = render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled)) +.pagination + = will_paginate @posts diff --git a/config/assets.yml b/config/assets.yml index 567cf0bcc..739b08db3 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -14,6 +14,7 @@ javascripts: - public/javascripts/vendor/fileuploader.js - public/javascripts/view.js - public/javascripts/stream.js + - public/javascripts/application.js mobile: - public/javascripts/vendor/jquery144.min.js - public/javascripts/custom-mobile-scripting.js diff --git a/public/javascripts/application.js b/public/javascripts/application.js new file mode 100644 index 000000000..c4b61cb4d --- /dev/null +++ b/public/javascripts/application.js @@ -0,0 +1,7 @@ +$(function () { + $('#main_stream .pagination a').live('click', function () { + $.getScript(this.href); + return false; + } + ); +});