diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6ba2f67f..2f86902cb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,14 +14,9 @@ class ApplicationController < ActionController::Base def set_contacts_and_status if current_user - if params[:aspect] == nil || params[:aspect] == 'all' - @aspect = :all - else - @aspect = current_user.aspect_by_id( params[:aspect]) - end - - @aspects = current_user.aspects - @aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]} + @aspect = nil + @aspects = current_user.aspects.fields(:name) + @aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]} @contacts = current_user.contacts end end @@ -37,7 +32,7 @@ class ApplicationController < ActionController::Base end def count_requests - @request_count = current_user.requests_for_me.size if current_user + @request_count = current_user.requests_for_me.count if current_user end def set_invites diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 04328b5fe..d64245f31 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -57,7 +57,11 @@ class AspectsController < ApplicationController render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 else @aspect_contacts = @aspect.contacts + @aspect_contacts_count = @aspect_contacts.count + @posts = @aspect.posts.find_all_by__type("StatusMessage", :order => 'created_at desc').paginate :page => params[:page], :per_page => 15 + @posts_count = @posts.count + respond_with @aspect end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d15c6b6c1..4061d12ec 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,7 +10,7 @@ module ApplicationHelper end def current_aspect?(aspect) - !@aspect.is_a?(Symbol) && @aspect.id == aspect.id + !@aspect.nil? && !@aspect.is_a?(Symbol) && @aspect.id == aspect.id end def aspect_or_all_path aspect diff --git a/app/views/aspects/_edit_aspect_pane.html.haml b/app/views/aspects/_edit_aspect_pane.html.haml index 3176be6ec..3b4f91f65 100644 --- a/app/views/aspects/_edit_aspect_pane.html.haml +++ b/app/views/aspects/_edit_aspect_pane.html.haml @@ -5,9 +5,9 @@ #edit_aspect_pane - if @contacts.count > 0 %h4= t('.add_existing') - = render 'shared/contact_list', :aspect => aspect, :contacts => contacts, :manage => defined?(manage) + = render 'shared/contact_list', :aspect_id => aspect.id, :contacts => contacts, :manage => defined?(manage) - = render 'shared/add_contact', :aspect => aspect + = render 'shared/add_contact', :aspect_id => aspect.id %hr .big_buttons diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index 5b19dfaef..9435d4afa 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -59,5 +59,5 @@ .fancybox_content %div{:id => "manage_aspect_contacts_pane_#{aspect.id}"} - = render "requests/manage_aspect_contacts", :aspect => aspect, :manage => true + = render "requests/manage_aspect_contacts", :aspect_name => aspect.name, :aspect_id => aspect.id, :manage => true diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml index 937485cb8..1eb962abd 100644 --- a/app/views/aspects/show.html.haml +++ b/app/views/aspects/show.html.haml @@ -7,16 +7,18 @@ = @aspect %span.aspect_contact_count{:style=>"color:#999;font-size:14px;"} - = t('contacts', :count=>@aspect_contacts.count) + = t('contacts', :count=>@aspect_contacts_count) = link_to t('.edit_aspect'), "#", :id => "edit_aspect_trigger" .span-8.append-1 = render 'shared/aspect_contacts', :contacts => @aspect_contacts, :aspect => @aspect + = render 'aspects/edit_aspect_pane', :contacts => @contacts, :aspect => @aspect + .span-15.last = render 'shared/publisher', :aspect => @aspect - = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts.count, :options => false - = render 'aspects/no_posts_message', :post_count => @posts.count, :contact_count=> @aspect_contacts.count + = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @aspect_contacts_count, :options => false + = render 'aspects/no_posts_message', :post_count => @posts_count, :contact_count=> @aspect_contacts_count = render 'shared/stream', :posts => @posts diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.html.haml index e057db36a..6ead23fad 100644 --- a/app/views/comments/_comments.html.haml +++ b/app/views/comments/_comments.html.haml @@ -2,9 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -%ul.comments{:id => post.id, :class => ("hidden" if defined?(hidden) && hidden)} - - for comment in post.comments +%ul.comments{:id => post_id, :class => ("hidden" if defined?(hidden) && hidden)} + - for comment in comments = render 'comments/comment', :comment => comment, :person => comment.person %li.comment.show - = render 'comments/new_comment', :post => post + = render 'comments/new_comment', :post_id => post_id diff --git a/app/views/comments/_new_comment.html.haml b/app/views/comments/_new_comment.html.haml index 38aca115e..a11d62202 100644 --- a/app/views/comments/_new_comment.html.haml +++ b/app/views/comments/_new_comment.html.haml @@ -2,10 +2,10 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -= form_for Comment.new, :html => {:id => "new_comment_on_#{post.id}" }, :remote => true do |comment| += form_for Comment.new, :html => {:id => "new_comment_on_#{post_id}" }, :remote => true do |comment| %p - = label_tag "comment_text_on_#{post.id}", t('.comment') - = comment.text_area :text, :rows => 1, :id => "comment_text_on_#{post.id}", :class => "comment_box" - = comment.hidden_field :post_id, :id => "post_id_on_#{post.id}", :value => post.id - = comment.submit t('.comment'), :id => "comment_submit_#{post.id}", :class => "comment_submit button", :disable_with => t('.commenting') + = label_tag "comment_text_on_#{post_id}", t('.comment') + = comment.text_area :text, :rows => 1, :id => "comment_text_on_#{post_id}", :class => "comment_box" + = comment.hidden_field :post_id, :id => "post_id_on_#{post_id}", :value => post_id + = comment.submit t('.comment'), :id => "comment_submit_#{post_id}", :class => "comment_submit button", :disable_with => t('.commenting') diff --git a/app/views/requests/_manage_aspect_contacts.haml b/app/views/requests/_manage_aspect_contacts.haml index 0e1901f29..e72f1bfc8 100644 --- a/app/views/requests/_manage_aspect_contacts.haml +++ b/app/views/requests/_manage_aspect_contacts.haml @@ -6,10 +6,10 @@ .modal_title_bar %h4 = t('.manage_within') - %i= aspect.name + %i= aspect_name .span-6.append-1.last %h3= t('.existing') - = render 'shared/contact_list', :aspect => aspect, :contacts => @contacts, :manage => defined?(manage) + = render 'shared/contact_list', :aspect_id => aspect_id, :contacts => @contacts, :manage => defined?(manage) .span-7.last - = render 'shared/add_contact', :aspect => aspect + = render 'shared/add_contact', :aspect_id => aspect_id diff --git a/app/views/shared/_add_contact.html.haml b/app/views/shared/_add_contact.html.haml index 953d00cd2..f09014bc6 100644 --- a/app/views/shared/_add_contact.html.haml +++ b/app/views/shared/_add_contact.html.haml @@ -7,9 +7,9 @@ = t('aspects.manage.add_a_new_contact') = info_text(t('.enter_a_diaspora_username')) -= form_tag(person_by_handle_path, :id => "new_request_to_#{aspect.id}", :class => "webfinger_form", :remote => true) do - = search_field_tag :diaspora_handle,'', :id => "request_d_handle_to_#{aspect.id}", :results => 5, :placeholder => t('.diaspora_handle') - = hidden_field_tag :aspect_id, aspect.id += form_tag(person_by_handle_path, :id => "new_request_to_#{aspect_id}", :class => "webfinger_form", :remote => true) do + = search_field_tag :diaspora_handle,'', :id => "request_d_handle_to_#{aspect_id}", :results => 5, :placeholder => t('.diaspora_handle') + = hidden_field_tag :aspect_id, aspect_id = submit_tag t('.create_request') %p{:style => "margin:12px 0 24px 0px;color:#999;text-align:center;"} @@ -18,7 +18,7 @@ #loader.hidden = image_tag 'ajax-loader.gif' -%ul#request_result{:aspect_id => aspect.id} +%ul#request_result{:aspect_id => aspect_id} %li.error.hidden #message = link_to t('.know_email'), "#invite_user_pane", :class => "invite_user_button" diff --git a/app/views/shared/_aspect_contacts.haml b/app/views/shared/_aspect_contacts.haml index 93778cf4a..160f4ab48 100644 --- a/app/views/shared/_aspect_contacts.haml +++ b/app/views/shared/_aspect_contacts.haml @@ -74,7 +74,7 @@ = link_to t('.add_aspect'), '#add_aspect_pane', :class => "add_aspect_button" %ul - - for user_aspect in current_user.aspects + - for user_aspect in @aspects %li %h4 = link_to user_aspect, user_aspect @@ -88,7 +88,3 @@ %h3= t('.invites') = render "shared/invitations", :invites => @invites - -else - = render 'aspects/edit_aspect_pane', :aspect => aspect, :contacts => @contacts - - diff --git a/app/views/shared/_contact_list.html.haml b/app/views/shared/_contact_list.html.haml index 253c9c4a4..acb413fe3 100644 --- a/app/views/shared/_contact_list.html.haml +++ b/app/views/shared/_contact_list.html.haml @@ -99,4 +99,4 @@ %span.name = link_to contact.person.real_name, contact.person .right - = aspect_membership_button(aspect.id, contact) + = aspect_membership_button(aspect_id, contact) diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index 524bd465e..5cc38106d 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -31,5 +31,5 @@ = comment_toggle(post.comments.count) - = render "comments/comments", :post => post, :hidden => (post.comments.count == 0) + = render "comments/comments", :post_id => post.id, :comments => post.comments, :hidden => (post.comments.count == 0)