Almost done with left-nav, added link to aspect edit facebox, colored share button

This commit is contained in:
danielgrippi 2011-07-01 14:22:38 -07:00
parent cd9be3904b
commit 41773cb29e
20 changed files with 90 additions and 72 deletions

View file

@ -29,9 +29,12 @@ class AspectsController < ApplicationController
return return
end end
@selected_contacts = Contact.joins(:aspect_memberships). unless params[:only_posts]
where(:aspect_memberships => {:aspect_id => aspect_ids}). all_selected_contacts = Contact.joins(:aspect_memberships).
includes(:person => :profile).limit(20) unless params[:only_posts] 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 } @aspect_ids = @aspects.map { |a| a.id }
posts = current_user.visible_posts(:by_members_of => @aspect_ids, 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 } @contacts_in_aspect = @aspect.contacts.includes(:aspect_memberships, :person => :profile).all.sort! { |x, y| x.person.name <=> y.person.name }
c = Contact.arel_table c = Contact.arel_table
if @contacts_in_aspect.empty? 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 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 end
@contacts = @contacts_in_aspect + @contacts_not_in_aspect @contacts = @contacts_in_aspect + @contacts_not_in_aspect

View file

@ -106,4 +106,8 @@ module ApplicationHelper
def rtl? def rtl?
@rtl ||= RTL_LANGUAGES.include? I18n.locale @rtl ||= RTL_LANGUAGES.include? I18n.locale
end end
def controller_index_path
self.send((request.filtered_parameters["controller"] + "_path").to_sym)
end
end end

View file

@ -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)

View file

@ -4,7 +4,7 @@
%ul#aspect_nav.left_nav %ul#aspect_nav.left_nav
%li.all_aspects{:class => ("active" if params["set"] != "all" && params["set"] != "only_sharing")} %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 .contact_count
= my_contacts_count = my_contacts_count
= t('contacts.index.my_contacts') = t('contacts.index.my_contacts')
@ -21,7 +21,7 @@
%li %li
= link_to "+ Add an aspect", "#add_aspect_pane", :class => "new_aspect", :rel => "facebox" = 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")} %a{:href => contacts_path(:set => "all"), :class => ("sub_selected" if params["set"] == "only_sharing")}
.contact_count .contact_count
= all_contacts_count = all_contacts_count

View file

@ -23,5 +23,5 @@
.bottom_submit_section .bottom_submit_section
= submit_tag t('cancel'), :class => 'button', :type => :reset, :rel => "close" = 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'

View file

@ -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

View file

@ -23,17 +23,7 @@
:posts => @posts :posts => @posts
.span-5.rightBar.last .span-5.rightBar.last
#selected_aspect_contacts.section = render 'selected_contacts', :contacts => @selected_contacts, :count => @selected_contacts_count
.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", "#"
.section .section
.title .title

View file

@ -1,3 +1,3 @@
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :aspect => @aspect, :aspect_ids => @aspect_ids, :posts => @posts)) %>"); $('#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(); $('a[rel*=facebox]').facebox();

View file

@ -9,5 +9,5 @@
= text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}" = 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}" = hidden_field_tag :post_id, post_id, :id => "post_id_on_#{post_id}"
.submit_button .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')

View file

@ -47,7 +47,7 @@
- for service in current_user.services - 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}" = 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') = 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 .facebox_content
#question_mark_pane #question_mark_pane

View file

@ -15,7 +15,7 @@ Feature: commenting
And I fill in "status_message_fake_text" with "Look at this dog" And I fill in "status_message_fake_text" with "Look at this dog"
And I press "Share" And I press "Share"
And I wait for the ajax to finish 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" Then I should see "Look at this dog" within ".stream_element"
And I should see a "img" within ".stream_element div.photo_attachments" And I should see a "img" within ".stream_element div.photo_attachments"
Then I log out Then I log out

View file

@ -48,7 +48,7 @@ Feature: sending and receiving requests
And I add the person to my 2nd aspect And I add the person to my 2nd aspect
When I go to the home page 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 "Unicorns"
Then I should have 1 contact in "Besties" 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 Then I go to the destroy user session page
When I sign in as "bob@bob.bob" 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" Then I should have 1 contacts in "Besties"
And I am on the home page And I am on the home page
@ -79,12 +79,12 @@ Feature: sending and receiving requests
And I wait for the ajax to finish And I wait for the ajax to finish
When I go to the home page 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 should have 1 contact in "Super People"
Then I go to the destroy user session page Then I go to the destroy user session page
When I sign in as "bob@bob.bob" 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" Then I should have 1 contact in "Besties"
Scenario: should not see "Add to aspect" and see mention if already a follower Scenario: should not see "Add to aspect" and see mention if already a follower

View file

@ -18,7 +18,7 @@ Feature: disconnecting users
And I remove the person from my 1st aspect And I remove the person from my 1st aspect
And I am on the home page 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 Then I go to the destroy user session page
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
@ -31,7 +31,7 @@ Feature: disconnecting users
And I remove the person from my 1st aspect 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 should have 0 contacts in "Besties"
Then I go to the destroy user session page 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 Scenario: remove a non-mutual contact from the aspect edit page
When I go to the home 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 wait for the ajax to finish
And I preemptively confirm the alert And I preemptively confirm the alert
And I press the first ".added" within "#facebox .contact_list ul > li:first-child" And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
And I wait for the ajax to finish 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 should have 0 contacts in "Besties"
Then I go to the destroy user session page Then I go to the destroy user session page

View file

@ -11,7 +11,7 @@
# Given I expand the publisher # 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" # 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 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" # Then I should see "Look at this awesome video: Youtube: Leekspin" within ".stream_element"
# When I follow "Youtube: Leekspin" # When I follow "Youtube: Leekspin"
# And I wait for the ajax to finish # And I wait for the ajax to finish

View file

@ -6,35 +6,31 @@ Feature: User manages contacts
Scenario: creating an aspect from contacts index Scenario: creating an aspect from contacts index
Given I am signed in Given I am signed in
When I follow "All Aspects" in the header And I am on the contacts page
And I follow "Your Contacts"
And I follow "My Contacts"
And I follow "+ Add an aspect" And I follow "+ Add an aspect"
And I fill in "Name" with "Dorm Mates" in the modal window And I fill in "Name" with "Dorm Mates" in the modal window
And I press "Create" 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 Scenario: creating an aspect from homepage
Given I am signed in Given I am signed in
When I follow "All Aspects" in the header When I follow "Add an aspect"
And I follow "+" in the header
And I fill in "Name" with "losers" in the modal window And I fill in "Name" with "losers" in the modal window
And I press "Create" 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 Given I am signed in
And I have 2 contacts And I have 2 contacts
And I have an aspect called "Cat People" And I have an aspect called "Cat People"
When I follow "All Aspects" in the header When I follow "My Contacts"
And I follow "2 contacts" within "#sharers" And I follow "Edit Cat People"
And I wait for the ajax to finish And I wait for the ajax to finish
And I press the first ".toggle.button" And I press the first ".contact_list .button"
And I press the 2nd "li" within ".dropdown.active .dropdown_list"
And I wait for the ajax to finish And I wait for the ajax to finish
Then I should have 1 contact in "Cat People" 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 And I wait for the ajax to finish
Then I should have 0 contacts in "Cat People" Then I should have 0 contacts in "Cat People"

View file

@ -20,7 +20,7 @@ Feature: posting
Given I expand the publisher Given I expand the publisher
When I fill in "status_message_fake_text" with "I am eating a yogurt" When I fill in "status_message_fake_text" with "I am eating a yogurt"
And I press "Share" 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" Then I should see "I am eating a yogurt" within ".stream_element"
Scenario: post a photo without text Scenario: post a photo without text
@ -30,7 +30,7 @@ Feature: posting
Then I should see an uploaded image within the photo drop zone Then I should see an uploaded image within the photo drop zone
And I press "Share" And I press "Share"
And I wait for the ajax to finish 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 should see a "img" within ".stream_element:first div.photo_attachments"
Then I log out Then I log out
And I sign in as "alice@alice.alice" 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 fill in "status_message_fake_text" with "Look at this dog"
And I press "Share" And I press "Share"
And I wait for the ajax to finish 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 should see a "img" within ".stream_element:first div.photo_attachments"
And I should see "Look at this dog" within ".stream_element:first" And I should see "Look at this dog" within ".stream_element:first"
Then I log out Then I log out
@ -68,7 +68,7 @@ Feature: posting
And I wait for the ajax to finish And I wait for the ajax to finish
And I go to "bob@bob.bob"'s page And I go to "bob@bob.bob"'s page
Then I should not see "Here is a post for you to hide" 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" Then I should not see "Here is a post for you to hide"
Scenario: delete a post Scenario: delete a post
@ -76,12 +76,12 @@ Feature: posting
When I fill in "status_message_fake_text" with "I am eating a yogurt" When I fill in "status_message_fake_text" with "I am eating a yogurt"
And I press "Share" And I press "Share"
And I wait for the ajax to finish 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 hover over the post
And I preemptively confirm the alert And I preemptively confirm the alert
And I click to delete the first post And I click to delete the first post
And I wait for the ajax to finish 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" Then I should not see "I am eating a yogurt"
Scenario Outline: post to one aspect Scenario Outline: post to one aspect
@ -90,8 +90,8 @@ Feature: posting
And I expand the publisher And I expand the publisher
And I fill in "status_message_fake_text" with "I am eating a yogurt" And I fill in "status_message_fake_text" with "I am eating a yogurt"
And I press "Share" And I press "Share"
And I follow "All Aspects" And I am on the aspects page
And I follow "<aspect>" And I follow "<aspect>" within "#aspect_nav"
Then I should <see> "I am eating a yogurt" Then I should <see> "I am eating a yogurt"
Examples: Examples:
@ -106,7 +106,8 @@ Feature: posting
And I expand the publisher in the modal window And I expand the publisher in the modal window
And I append "I am eating a yogurt" to the publisher And I append "I am eating a yogurt" to the publisher
And I press "Share" 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" Then I should <see> "I am eating a yogurt"
Examples: Examples:
@ -122,7 +123,8 @@ Feature: posting
And I append "I am eating a yogurt" to the publisher And I append "I am eating a yogurt" to the publisher
And I follow "DidntPostTo" within "#publisher" in the modal window And I follow "DidntPostTo" within "#publisher" in the modal window
And I press "Share" 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" Then I should <see> "I am eating a yogurt"
Examples: Examples:

View file

@ -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 === ''){ if (this.value === undefined || this.value === ''){
var commentBox = $(this); var commentBox = $(this);
commentBox commentBox
.attr("rows", (evt.type === "focus") ? 2 : 1)
.parent().parent() .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");
} }
}); });

View file

@ -1,6 +1,7 @@
$blue: #3f8fba; $blue: #3f8fba;
$red: red; $red: red;
$background: #fff; $background: #fff;
$creation-blue: #0097ff;
$speed: 0.1s; $speed: 0.1s;
$easing: linear; $easing: linear;

View file

@ -1,4 +1,3 @@
// 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.
@ -643,7 +642,7 @@ ul.show_comments,
textarea textarea
:width 365px :width 365px
:height 1.4em :height 21px
input input
:display none :display none
@ -2925,6 +2924,9 @@ ul.left_nav
.contact_count .contact_count
:display none !important :display none !important
.all_contacts
:display none !important
.left_nav .left_nav
a a
:width 150px :width 150px

View file

@ -68,6 +68,17 @@
.button.in_aspects .button.in_aspects
@include linear-gradient(lighten(#76C000,8%),#76C000) @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 .right
:position absolute :position absolute
:right 0 :right 0