diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 0b278535b32bda01f9073a4e77e92a2f83741f03..4d64499463d5178a7e694dc5de995e17a8a84aab 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 9dbf397a5e6cea3c49899508a7300c33005cce0b..31bcec16c6fe453c62890e2cca45cd5ee247d95a 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 0000000000000000000000000000000000000000..aa27af5a0b67b2a3f51e632eef99772c72d084ff --- /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 f209ddae35d0cb16adae65108bce51be7783ed69..a8b7692e6d601a04a37a6e6c7c4e1b127d80f800 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 0000000000000000000000000000000000000000..aa27af5a0b67b2a3f51e632eef99772c72d084ff --- /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 b43f40f5d45be2313ba841b8b030e367f322db46..bf5dbbf6a4ec7e110acea0f810eadcac1bd21e27 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 567cf0bcc7f3cad9263fa9e725a81e0ad41759a0..739b08db3554c188a2ba94e4a0312e3e17b25335 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 0000000000000000000000000000000000000000..c4b61cb4dbe4fc0e5be780cc375b0df5734e4619 --- /dev/null +++ b/public/javascripts/application.js @@ -0,0 +1,7 @@ +$(function () { + $('#main_stream .pagination a').live('click', function () { + $.getScript(this.href); + return false; + } + ); +});