aspect dropdown shows name of aspect if contact is only in one; green

This commit is contained in:
danielgrippi 2011-06-30 11:55:41 -07:00
parent 2c4f835998
commit 4e48db23f0
9 changed files with 31 additions and 27 deletions

View file

@ -3,7 +3,10 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
.dropdown{:class => "hang_#{hang}"} .dropdown{:class => "hang_#{hang}"}
.button.toggle .button.toggle{:class => ("in_aspects" if contact.aspects.size > 0)}
- if contact.aspects.size == 1
= contact.aspects.first.name
- else
= t('.toggle', :count => contact.aspects.size) = t('.toggle', :count => contact.aspects.size)
▼ ▼

View file

@ -11,11 +11,12 @@
%p %p
= link_to t('people.profile_sidebar.edit_my_profile'), edit_profile_path = link_to t('people.profile_sidebar.edit_my_profile'), edit_profile_path
- else
- if person != current_user.person - if @contact && @contact.receiving?
%hr{:style=>"width:300px;"}
%br %br
= render 'aspect_memberships/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left' = link_to t('people.show.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox'
- if @contact.mutual?
= link_to t('people.show.message'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name), :class => 'button', :rel => 'facebox'
%br %br
%br %br
-if contact.sharing? || person == current_user.person -if contact.sharing? || person == current_user.person

View file

@ -25,16 +25,15 @@
.span-15.last .span-15.last
#author_info #author_info
- if user_signed_in? && @contact && @contact.receiving? - if user_signed_in? && current_user.person != @person
.right .right
= link_to t('.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox' = render 'aspect_memberships/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left'
- if @contact.mutual?
= link_to t('.message'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name), :class => 'button', :rel => 'facebox'
%h3 %h3
= @person.name = @person.name
%span.diaspora_handle %span.diaspora_handle
= @person.diaspora_handle = @person.diaspora_handle
.description .description
- if !@person.profile.tag_string.blank? && user_signed_in? && (@contact.persisted? || @person == current_user.person || @incoming_request) - if !@person.profile.tag_string.blank? && user_signed_in? && (@contact.persisted? || @person == current_user.person || @incoming_request)
= @person.profile.format_tags(@person.profile.tag_string) = @person.profile.format_tags(@person.profile.tag_string)

View file

@ -91,7 +91,7 @@ Feature: sending and receiving requests
When I sign in as "bob@bob.bob" When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page And I am on "alice@alice.alice"'s page
Then I should see "In 1 aspect" Then I should see "Besties"
Then I should see "Mention" Then I should see "Mention"
Then I should not see "Message" Then I should not see "Message"

View file

@ -18,4 +18,4 @@ Feature: Interacting with tags
When I add the person to my 1st aspect When I add the person to my 1st aspect
When I search for "#rockstar" When I search for "#rockstar"
Then I should see "In 1 aspect" Then I should see "generic"

View file

@ -12,14 +12,16 @@ var ContactEdit = {
updateNumber: function(personId){ updateNumber: function(personId){
var dropdown = $(".dropdown_list[data-person_id=" + personId.toString() +"]"), var dropdown = $(".dropdown_list[data-person_id=" + personId.toString() +"]"),
number = dropdown.find(".selected").length, number = dropdown.find(".selected").length,
element = dropdown.parents(".dropdown").children('.button.toggle'); button = dropdown.parents(".dropdown").children('.button.toggle');
var replacement; var replacement;
if (number == 0) { if (number == 0) {
button.removeClass("in_aspects");
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero"); replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero");
}else if (number == 1) { }else if (number == 1) {
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.one', { count: number.toString()}) button.addClass("in_aspects");
replacement = dropdown.find(".selected").first().text();
}else if (number < 3) { }else if (number < 3) {
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.few', { count: number.toString()}) replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
}else if (number > 3) { }else if (number > 3) {
@ -29,7 +31,7 @@ var ContactEdit = {
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.other', { count: number.toString()}) replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
} }
element.html(replacement + ' ▼'); button.html(replacement + ' ▼');
}, },
toggleCheckbox: toggleCheckbox:

View file

@ -1,6 +1,6 @@
$blue: #3f8fba; $blue: #3f8fba;
$red: red; $red: red;
$background: rgb(252, 252, 252); $background: #fff;
$speed: 0.1s; $speed: 0.1s;
$easing: linear; $easing: linear;

View file

@ -38,9 +38,6 @@ h4
h1 h1
:color #111 :color #111
h3
:color #777
ul > li ul > li
:list-style none :list-style none
@ -329,7 +326,7 @@ ul.dropdown
#author_info #author_info
:position relative :position relative
img .avatar img
:position relative :position relative
:top 0px :top 0px
:display inline-block :display inline-block
@ -349,6 +346,7 @@ ul.dropdown
:display inline-block :display inline-block
:margin :margin
:bottom 10px :bottom 10px
:right 10px
&.show &.show
a a
@ -2798,9 +2796,7 @@ h1.tag
:font :font
:size 12px :size 12px
:weight normal :weight normal
:color #999 :color #555
:margin
:left 6px
.add_tags .add_tags
:font :font

View file

@ -65,6 +65,9 @@
:border :border
:top 1px solid #aaa :top 1px solid #aaa
.button.in_aspects
@include linear-gradient(lighten(#76C000,8%),#76C000)
.right .right
:position absolute :position absolute
:right 0 :right 0