diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index ca10f539d14931370091380a20b2c11912043327..1bfc8b3b5ddf17603048ac6d1836e142da286f5d 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -29,9 +29,12 @@ class AspectsController < ApplicationController return end - @selected_contacts = Contact.joins(:aspect_memberships). - where(:aspect_memberships => {:aspect_id => aspect_ids}). - includes(:person => :profile).limit(20) unless params[:only_posts] + unless params[:only_posts] + all_selected_contacts = Contact.joins(:aspect_memberships). + where(:aspect_memberships => {:aspect_id => aspect_ids}) + @selected_contacts_count = all_selected_contacts.count + @selected_contacts = all_selected_contacts.limit(24) + end @aspect_ids = @aspects.map { |a| a.id } posts = current_user.visible_posts(:by_members_of => @aspect_ids, @@ -116,9 +119,9 @@ class AspectsController < ApplicationController @contacts_in_aspect = @aspect.contacts.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } c = Contact.arel_table if @contacts_in_aspect.empty? - @contacts_not_in_aspect = current_user.contacts.receiving.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } + @contacts_not_in_aspect = current_user.contacts.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } else - @contacts_not_in_aspect = current_user.contacts.receiving.where(c[:id].not_in(@contacts_in_aspect.map(&:id))).includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } + @contacts_not_in_aspect = current_user.contacts.where(c[:id].not_in(@contacts_in_aspect.map(&:id))).includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name } end @contacts = @contacts_in_aspect + @contacts_not_in_aspect diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5425d5d61cbc0b8a17f79e78da739fb6b83de383..3f5938b38031966ce289d4197ceae7c82e217c7e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -106,4 +106,8 @@ module ApplicationHelper def rtl? @rtl ||= RTL_LANGUAGES.include? I18n.locale end + + def controller_index_path + self.send((request.filtered_parameters["controller"] + "_path").to_sym) + end end diff --git a/app/views/aspects/_aspect.haml b/app/views/aspects/_aspect.haml deleted file mode 100644 index ec34c93a9c212f4804f1516dcdf3b5d2d41c0c12..0000000000000000000000000000000000000000 --- a/app/views/aspects/_aspect.haml +++ /dev/null @@ -1,12 +0,0 @@ -%li{:data=>{:guid=>aspect.id}, :class => ("dull" if contacts.size == 0)} - .right - %b - = link_to t('contacts', :count => contacts.size), edit_aspect_path(aspect), :rel => 'facebox', :class => 'contact-count' - %b - = link_for_aspect(aspect, :class => 'hard_aspect_link') - %br - - - if contacts.length > 0 - .contacts - - for contact in contacts[0..15] - = person_image_link(contact.person) diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index 6ba2bc1fa4d630f855b8f46f98951639ca33f77b..7041487d05140cdba0de9e2496d2441ed9b1cb69 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -4,7 +4,7 @@ %ul#aspect_nav.left_nav %li.all_aspects{:class => ("active" if params["set"] != "all" && params["set"] != "only_sharing")} - %a{:href => contacts_path, :class => ("sub_selected" if params["a_id"])} + %a{:href => controller_index_path, :class => ("sub_selected" if params["a_id"])} .contact_count = my_contacts_count = t('contacts.index.my_contacts') @@ -21,7 +21,7 @@ %li = link_to "+ Add an aspect", "#add_aspect_pane", :class => "new_aspect", :rel => "facebox" - %li{:class => ("active" if params["set"] == "all" || params["set"] == "only_sharing")} + %li.all_contacts{:class => ("active" if params["set"] == "all" || params["set"] == "only_sharing")} %a{:href => contacts_path(:set => "all"), :class => ("sub_selected" if params["set"] == "only_sharing")} .contact_count = all_contacts_count diff --git a/app/views/aspects/_new.haml b/app/views/aspects/_new.haml index b704af7c9e387b631e92c9e26654679bb91c1ba7..01e2ebb3b79934b73d9a508eefe863a71bbc01a9 100644 --- a/app/views/aspects/_new.haml +++ b/app/views/aspects/_new.haml @@ -23,5 +23,5 @@ .bottom_submit_section = submit_tag t('cancel'), :class => 'button', :type => :reset, :rel => "close" - = aspect.submit t('.create'), :class => 'button take_action' + = aspect.submit t('.create'), :class => 'button creation' diff --git a/app/views/aspects/_selected_contacts.html.haml b/app/views/aspects/_selected_contacts.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..54eb6ac87cd0f34f93cd4a85ef582bbd44f1d29a --- /dev/null +++ b/app/views/aspects/_selected_contacts.html.haml @@ -0,0 +1,14 @@ +#selected_aspect_contacts.section + .title.no_icon + %h5 + = "Contacts (#{count})" + + .content + - for contact in contacts + = person_image_link contact.person + + #edit_this_aspect + = link_to "View all contacts", contacts_path + - for aspect in @aspects + = link_to "Edit #{aspect.name}", edit_aspect_path(aspect), :rel => 'facebox' + %br diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index 20d5d12bf23861df8452ceebb6d6347564e777de..46335eb2042be67cdd2b0e9234956a640246b6de 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -23,17 +23,7 @@ :posts => @posts .span-5.rightBar.last - #selected_aspect_contacts.section - .title.no_icon - %h5 - = "Contacts (#{@selected_contacts.size})" - - .content - - for contact in @selected_contacts - = person_image_link contact.person - - #edit_this_aspect - = link_to "View all contacts", "#" + = render 'selected_contacts', :contacts => @selected_contacts, :count => @selected_contacts_count .section .title diff --git a/app/views/aspects/index.js.erb b/app/views/aspects/index.js.erb index 58451a81f08a1442f2bfb541ae703b11f61c2518..0938a3236fb796505c675da508359490ac36d8c0 100644 --- a/app/views/aspects/index.js.erb +++ b/app/views/aspects/index.js.erb @@ -1,3 +1,3 @@ $('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :posts => @posts)) %>"); -$('#aspect_listings').html("<%= escape_javascript(render('aspects/aspect_listings', :aspects => @aspects)) %>"); +$('#selected_aspect_contacts').html("<%= escape_javascript(render('aspects/selected_contacts', :count => @selected_contacts_count, :contacts => @selected_contacts)) %>"); $('a[rel*=facebox]').facebox(); diff --git a/app/views/comments/_new_comment.html.haml b/app/views/comments/_new_comment.html.haml index 5e777f4da6f5cbdeb346dda44932c5a5bc8c6387..2e38cf3226057bbb177d6d6a29a385eaf9e05a9c 100644 --- a/app/views/comments/_new_comment.html.haml +++ b/app/views/comments/_new_comment.html.haml @@ -9,5 +9,5 @@ = text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}" = hidden_field_tag :post_id, post_id, :id => "post_id_on_#{post_id}" .submit_button - = submit_tag t('.comment'), :id => "comment_submit_#{post_id}", :class => "comment_submit button", :disable_with => t('.commenting') + = submit_tag t('.comment'), :id => "comment_submit_#{post_id}", :class => "comment_submit button creation", :disable_with => t('.commenting') diff --git a/app/views/shared/_publisher.html.haml b/app/views/shared/_publisher.html.haml index 26f10796048e78b74d9941d63dc3b9edc2cab837..09a20c8262f1a7845af596748317144217cb00a0 100644 --- a/app/views/shared/_publisher.html.haml +++ b/app/views/shared/_publisher.html.haml @@ -47,7 +47,7 @@ - for service in current_user.services = image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider.titleize, :class => "service_icon dim", :id =>"#{service.provider}", :maxchar => "#{service.class::MAX_CHARACTERS}" = link_to (image_tag "icons/monotone_wrench_settings.png"), "#question_mark_pane", :class => 'question_mark', :rel => 'facebox', :title => t('shared.public_explain.manage') - = status.submit t('.share'), :disable_with => t('.posting'), :class => 'button', :tabindex => 2 + = status.submit t('.share'), :disable_with => t('.posting'), :class => 'button creation', :tabindex => 2 .facebox_content #question_mark_pane diff --git a/features/comments.feature b/features/comments.feature index 57c5f8b3c1044bffe8ee50b76c11ccb88017c8b0..49713a4dacf39d559261da976411ca55526149b1 100644 --- a/features/comments.feature +++ b/features/comments.feature @@ -15,7 +15,7 @@ Feature: commenting And I fill in "status_message_fake_text" with "Look at this dog" And I press "Share" And I wait for the ajax to finish - And I follow "All Aspects" + And I follow "My Contacts" Then I should see "Look at this dog" within ".stream_element" And I should see a "img" within ".stream_element div.photo_attachments" Then I log out diff --git a/features/connects_users.feature b/features/connects_users.feature index 43a0710e0904ceea33dc0636bf8e39d82cef5830..812343e66e3e28e6a0c90d2c9b6e01ab8119b5f4 100644 --- a/features/connects_users.feature +++ b/features/connects_users.feature @@ -48,7 +48,7 @@ Feature: sending and receiving requests And I add the person to my 2nd aspect When I go to the home page - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 1 contact in "Unicorns" Then I should have 1 contact in "Besties" @@ -60,7 +60,7 @@ Feature: sending and receiving requests Then I go to the destroy user session page When I sign in as "bob@bob.bob" - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 1 contacts in "Besties" And I am on the home page @@ -79,12 +79,12 @@ Feature: sending and receiving requests And I wait for the ajax to finish When I go to the home page - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 1 contact in "Super People" Then I go to the destroy user session page When I sign in as "bob@bob.bob" - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 1 contact in "Besties" Scenario: should not see "Add to aspect" and see mention if already a follower diff --git a/features/disconnects_users.feature b/features/disconnects_users.feature index f8e3a8551cb4ae2997b7a9a0f8942d4b0eb5fc0f..14c2cfe0fb7b05ab4635ffb8d2451c074aa23968 100644 --- a/features/disconnects_users.feature +++ b/features/disconnects_users.feature @@ -18,7 +18,7 @@ Feature: disconnecting users And I remove the person from my 1st aspect And I am on the home page - Then I should see "no contacts" within "#sharers" + Then I should have 0 contacts in "Besties" Then I go to the destroy user session page When I sign in as "alice@alice.alice" @@ -31,7 +31,7 @@ Feature: disconnecting users And I remove the person from my 1st aspect - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 0 contacts in "Besties" Then I go to the destroy user session page @@ -42,14 +42,14 @@ Feature: disconnecting users Scenario: remove a non-mutual contact from the aspect edit page When I go to the home page - And I press the first ".contact-count" within "#aspect_listings" + And I follow "Edit Besties" And I wait for the ajax to finish And I preemptively confirm the alert And I press the first ".added" within "#facebox .contact_list ul > li:first-child" And I wait for the ajax to finish - When I follow "All Aspects" in the header + When I follow "My Contacts" Then I should have 0 contacts in "Besties" Then I go to the destroy user session page diff --git a/features/embedder.feature b/features/embedder.feature index 96f08da488ffd55da4642af9d13a378f1c2a6771..8a9beb4312c17097019ae7807b5faa5423c5ce52 100644 --- a/features/embedder.feature +++ b/features/embedder.feature @@ -11,7 +11,7 @@ # Given I expand the publisher # When I fill in "status_message_fake_text" with "Look at this awesome video: https://www.youtube.com/watch?v=53tq9g35kwk" # And I press "Share" -# And I follow "All Aspects" +# And I follow "My Contacts" # Then I should see "Look at this awesome video: Youtube: Leekspin" within ".stream_element" # When I follow "Youtube: Leekspin" # And I wait for the ajax to finish diff --git a/features/manages_aspects.feature b/features/manages_aspects.feature index f42a81299417a79f0ecf33e330bc91c52ff456e3..c2d6fdf39536067b29437a3298c4487d300b429d 100644 --- a/features/manages_aspects.feature +++ b/features/manages_aspects.feature @@ -6,35 +6,31 @@ Feature: User manages contacts Scenario: creating an aspect from contacts index Given I am signed in - When I follow "All Aspects" in the header - And I follow "Your Contacts" - And I follow "My Contacts" + And I am on the contacts page And I follow "+ Add an aspect" And I fill in "Name" with "Dorm Mates" in the modal window And I press "Create" in the modal window - Then I should see "Dorm Mates" in the header + Then I should see "Dorm Mates" within "#aspect_nav" Scenario: creating an aspect from homepage Given I am signed in - When I follow "All Aspects" in the header - And I follow "+" in the header + When I follow "Add an aspect" And I fill in "Name" with "losers" in the modal window And I press "Create" in the modal window - Then I should see "losers" in the header + Then I should see "losers" within "#aspect_nav" - Scenario: Editing the aspect memberships of a contact from the 'sharers' facebox + Scenario: Editing the aspect memberships of a contact from the aspect edit facebox Given I am signed in And I have 2 contacts And I have an aspect called "Cat People" - When I follow "All Aspects" in the header - And I follow "2 contacts" within "#sharers" + When I follow "My Contacts" + And I follow "Edit Cat People" And I wait for the ajax to finish - And I press the first ".toggle.button" - And I press the 2nd "li" within ".dropdown.active .dropdown_list" + And I press the first ".contact_list .button" And I wait for the ajax to finish Then I should have 1 contact in "Cat People" - When I press the 2nd "li" within ".dropdown.active .dropdown_list" + When I press the first ".contact_list .button" And I wait for the ajax to finish Then I should have 0 contacts in "Cat People" diff --git a/features/posts.feature b/features/posts.feature index 94b59108b220f4e930cf59adf0757dc23ac6d7e5..89fabc5a962e357d4399065fbac7270332344983 100644 --- a/features/posts.feature +++ b/features/posts.feature @@ -20,7 +20,7 @@ Feature: posting Given I expand the publisher When I fill in "status_message_fake_text" with "I am eating a yogurt" And I press "Share" - And I follow "All Aspects" + And I follow "My Contacts" Then I should see "I am eating a yogurt" within ".stream_element" Scenario: post a photo without text @@ -30,7 +30,7 @@ Feature: posting Then I should see an uploaded image within the photo drop zone And I press "Share" And I wait for the ajax to finish - And I follow "All Aspects" + And I follow "My Contacts" Then I should see a "img" within ".stream_element:first div.photo_attachments" Then I log out And I sign in as "alice@alice.alice" @@ -44,7 +44,7 @@ Feature: posting And I fill in "status_message_fake_text" with "Look at this dog" And I press "Share" And I wait for the ajax to finish - And I follow "All Aspects" + And I follow "My Contacts" Then I should see a "img" within ".stream_element:first div.photo_attachments" And I should see "Look at this dog" within ".stream_element:first" Then I log out @@ -68,7 +68,7 @@ Feature: posting And I wait for the ajax to finish And I go to "bob@bob.bob"'s page Then I should not see "Here is a post for you to hide" - And I follow "All Aspects" + And I am on the aspects page Then I should not see "Here is a post for you to hide" Scenario: delete a post @@ -76,12 +76,12 @@ Feature: posting When I fill in "status_message_fake_text" with "I am eating a yogurt" And I press "Share" And I wait for the ajax to finish - And I follow "All Aspects" + And I follow "My Contacts" And I hover over the post And I preemptively confirm the alert And I click to delete the first post And I wait for the ajax to finish - And I follow "All Aspects" + And I follow "My Contacts" Then I should not see "I am eating a yogurt" Scenario Outline: post to one aspect @@ -90,8 +90,8 @@ Feature: posting And I expand the publisher And I fill in "status_message_fake_text" with "I am eating a yogurt" And I press "Share" - And I follow "All Aspects" - And I follow "<aspect>" + And I am on the aspects page + And I follow "<aspect>" within "#aspect_nav" Then I should <see> "I am eating a yogurt" Examples: @@ -106,7 +106,8 @@ Feature: posting And I expand the publisher in the modal window And I append "I am eating a yogurt" to the publisher And I press "Share" in the modal window - And I follow "<aspect>" + And I am on the aspects page + And I follow "<aspect>" within "#aspect_nav" Then I should <see> "I am eating a yogurt" Examples: @@ -122,7 +123,8 @@ Feature: posting And I append "I am eating a yogurt" to the publisher And I follow "DidntPostTo" within "#publisher" in the modal window And I press "Share" in the modal window - And I follow "<aspect>" + And I am on the aspects page + And I follow "<aspect>" within "#aspect_nav" Then I should <see> "I am eating a yogurt" Examples: diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 3eb95739b137c92626fee213b7b7f349875ece49..3543d980a3c222f5c38310b62c534b164257ed93 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -70,13 +70,20 @@ var Stream = { }); - $("textarea.comment_box", this.selector).live("focus blur", function(evt) { + $("textarea.comment_box", this.selector).live("focus", function(evt) { if (this.value === undefined || this.value === ''){ var commentBox = $(this); commentBox - .attr("rows", (evt.type === "focus") ? 2 : 1) .parent().parent() - .toggleClass("open"); + .addClass("open"); + } + }); + $("textarea.comment_box", this.selector).live("blur", function(evt) { + if (this.value === undefined || this.value === ''){ + var commentBox = $(this); + commentBox + .parent().parent() + .removeClass("open"); } }); diff --git a/public/stylesheets/sass/_mixins.scss b/public/stylesheets/sass/_mixins.scss index 3877d06892640395cbdfcff84bfd90a8ae35433c..ddde72768addd1bcb14854dfd400a100037c6a68 100644 --- a/public/stylesheets/sass/_mixins.scss +++ b/public/stylesheets/sass/_mixins.scss @@ -1,6 +1,7 @@ $blue: #3f8fba; $red: red; $background: #fff; +$creation-blue: #0097ff; $speed: 0.1s; $easing: linear; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index f22455e6525a1fa5844a87fb9630258c92975730..45f8d3c38af48e97545aabcc26396b6793bb17a1 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1,4 +1,3 @@ -// Copyright (c) 2010, Diaspora Inc. This file is // licensed under the Affero General Public License version 3 or later. See // the COPYRIGHT file. @@ -643,7 +642,7 @@ ul.show_comments, textarea :width 365px - :height 1.4em + :height 21px input :display none @@ -2925,6 +2924,9 @@ ul.left_nav .contact_count :display none !important + .all_contacts + :display none !important + .left_nav a :width 150px diff --git a/public/stylesheets/sass/ui.sass b/public/stylesheets/sass/ui.sass index 17e29802f9e6dbe99ce031c3655d7975c2b4e2ef..0286be23ec5d29d715a87367e8bf7c6b2b90749d 100644 --- a/public/stylesheets/sass/ui.sass +++ b/public/stylesheets/sass/ui.sass @@ -68,6 +68,17 @@ .button.in_aspects @include linear-gradient(lighten(#76C000,8%),#76C000) +.button.creation + @include linear-gradient(lighten($creation-blue,8%), darken($creation-blue, 3%)) + :color #fafafa + + :border 1px solid #666 + :top 1px solid #777 + :bottom 1px solid darken(#666,13%) + + &:hover + @include linear-gradient(lighten($creation-blue,3%), darken($creation-blue, 8%)) + .right :position absolute :right 0