broke out dropdown into its own partial. aspect dropdown on person show. user menu fixed

This commit is contained in:
danielgrippi 2011-05-11 18:33:17 -07:00
parent 7893129435
commit 4280417e41
10 changed files with 101 additions and 109 deletions

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file. # the COPYRIGHT file.
class PeopleController < ApplicationController class PeopleController < ApplicationController
helper :comments helper :comments, :aspects
before_filter :authenticate_user!, :except => [:show] before_filter :authenticate_user!, :except => [:show]
respond_to :html respond_to :html

View file

@ -0,0 +1,19 @@
-# Copyright (c) 2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.dropdown{:class => "hang_#{hang}"}
.button.toggle
= t('.toggle', :count => contact.aspects.size)
&#9660;
.wrapper
%ul.dropdown_list{:unSelectable => 'on'}
- for aspect in @all_aspects
%li{:data => {:aspect_id => aspect.id}}
= check_box_tag "in_aspect", "in_aspect", aspect.contacts.include?(contact)
= aspect.name
.hidden
= aspect_membership_button(aspect, contact, contact.person)

View file

@ -24,23 +24,9 @@
= link_to contact.person.name, contact.person = link_to contact.person.name, contact.person
.description .description
= contact.person.diaspora_handle = contact.person.diaspora_handle
.right .right
= render 'aspect_dropdown', :contact => contact, :hang => 'right'
.dropdown
.button.toggle
Add to aspect
&#9660;
.wrapper
%ul.dropdown_list{:unSelectable => 'on'}
- for aspect in @all_aspects
%li{:data => {:aspect_id => aspect.id}}
= check_box_tag "yo", "hey", aspect.contacts.include?(contact)
= aspect.name
.hidden
= aspect_membership_button(aspect, contact, contact.person)
%br %br
%div{:style => "text-align:right;"} %div{:style => "text-align:right;"}

View file

@ -18,33 +18,20 @@
.profile_photo .profile_photo
= person_image_link(person, :size => :thumb_large, :to => :photos) = person_image_link(person, :size => :thumb_large, :to => :photos)
- if user_signed_in? && person == current_user.person - if user_signed_in?
- if person == current_user.person
%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
%hr{:style=>"width:300px;"} %hr{:style=>"width:300px;"}
%ul %br
- if user_signed_in? && contact.receiving? = render 'contacts/aspect_dropdown', :contact => @contact, :hang => 'left'
%li
= render :partial => 'people/aspect_list', -if contact.sharing? || person == current_user.person
:locals => {:person => person, %br
:contact => contact,
:aspects_with_person => @aspects_with_person,
:aspects_without_person => @all_aspects.reject{ |aspect| @aspects_with_person.include?(aspect)}}
%br %br
%hr{:style=>"width:300px;"} %hr{:style=>"width:300px;"}
- if user_signed_in?
%br
- if contact.sharing?
%h4
#{person.name} is sharing with you.
- elsif contact.receiving?
%h4
You are sharing with #{person.name}
-if user_signed_in? && (contact.sharing? || person == current_user.person)
%ul#profile_information %ul#profile_information
- unless person.profile.bio.blank? - unless person.profile.bio.blank?
%li %li

View file

@ -25,29 +25,12 @@
.span-15.last .span-15.last
#author_info #author_info
- if user_signed_in? - if user_signed_in? && @contact && @contact.receiving?
- if !@contact.receiving?
.right
= link_to t('.start_sharing'),
{:controller => "contacts",
:action => "new",
:person_id => @person.id},
:class => 'share_with button',
:rel => 'facebox'
- if @share_with
= javascript_tag "$(document).ready(function() {jQuery.facebox({ ajax: '#{new_contact_path(:person_id => @person.id)}' });});"
- elsif @contact
.right .right
= link_to t('.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox' = link_to t('.mention'), new_status_message_path(:person_id => @person.id), :class => 'button', :rel => 'facebox'
- if @contact.mutual? - if @contact.mutual?
= link_to t('.message'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name, :contact_id => @contact.id), :class => 'button', :rel => 'facebox' = link_to t('.message'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name, :contact_id => @contact.id), :class => 'button', :rel => 'facebox'
/- if @post_type == :photos
/ = link_to t('layouts.header.view_profile'), person_path(@person)
/- else
/ = link_to t('_photos'), person_photos_path(@person)
%h3 %h3
= @person.name = @person.name
%span.diaspora_handle %span.diaspora_handle

View file

@ -179,6 +179,14 @@ en:
add_new_aspect: "add to new aspect" add_new_aspect: "add to new aspect"
create: create:
failure: "Failed to create contact" failure: "Failed to create contact"
aspect_dropdown:
add_to_aspect: "Add to aspect"
toggle:
zero: "Add to aspect"
one: "In %{count} aspect"
few: "In %{count} aspects"
many: "In %{count} aspects"
other: "In %{count} aspects"
conversations: conversations:
index: index:
@ -371,7 +379,6 @@ en:
message: "Message" message: "Message"
mention: "Mention" mention: "Mention"
profile_sidebar: profile_sidebar:
remove_contact: "remove contact"
edit_my_profile: "Edit my profile" edit_my_profile: "Edit my profile"
bio: "bio" bio: "bio"
location: "location" location: "location"

View file

@ -35,11 +35,11 @@ var View = {
/* Submit the form when the user hits enter */ /* Submit the form when the user hits enter */
.keypress(this.search.keyPress); .keypress(this.search.keyPress);
/* Getting started animation */
$(this.gettingStarted.selector)
.live("click", this.gettingStarted.click);
/* User menu */ /* User menu */
$(this.userMenu.selector)
.click(this.userMenu.click);
/* Dropdowns */
$(this.dropdowns.selector) $(this.dropdowns.selector)
.live('click', this.dropdowns.click); .live('click', this.dropdowns.click);
@ -119,18 +119,6 @@ var View = {
}, },
gettingStarted: {
click: function() {
var $this = $(this);
$this.animate({
left: parseInt($this.css("left"), 30) === 0 ? -$this.outerWidth() : 0
}, function() {
$this.css("left", "1000px");
});
},
selector: ".getting_started_box"
},
newRequest: { newRequest: {
submit: function() { submit: function() {
$(this).hide().parent().find(".stream_element").removeClass("hidden"); $(this).hide().parent().find(".stream_element").removeClass("hidden");
@ -240,6 +228,20 @@ var View = {
parentSelector: ".dropdown > .wrapper" parentSelector: ".dropdown > .wrapper"
}, },
userMenu: {
click: function(evt) {
$(this).parent().toggleClass("active");
evt.preventDefault();
},
removeFocus: function(evt) {
var $target = $(evt.target);
if(!$target.closest("#user_menu").length || ($target.attr('href') != undefined && $target.attr('href') != '#')) {
$(View.userMenu.selector).parent().removeClass("active");
}
},
selector: "#user_menu li:first-child"
},
webFingerForm: { webFingerForm: {
submit: function(evt) { submit: function(evt) {
$(evt.currentTarget).siblings("#loader").show(); $(evt.currentTarget).siblings("#loader").show();

View file

@ -24,7 +24,7 @@ a img {border:none;}
/* typography.css */ /* typography.css */
html {font-size:100.01%;} html {font-size:100.01%;}
body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica", Arial, sans-serif;}
h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
h2 {font-size:2em;margin-bottom:0.75em;} h2 {font-size:2em;margin-bottom:0.75em;}

View file

@ -249,12 +249,15 @@ ul.dropdown
////////////////////////////////// //////////////////////////////////
.dropdown .dropdown
:position relative
:display inline-block
.button .button
:width 240px :width 240px
.wrapper .wrapper
:z-index 20
:position absolute :position absolute
:right 4px
:display none :display none
:width 140px :width 140px
:padding 2px 0 :padding 2px 0
@ -275,6 +278,14 @@ ul.dropdown
:display inline :display inline
:top 1px :top 1px
&.hang_right
.wrapper
:right 4px
&.hang_left
.wrapper
:left 0px
&.active &.active
.wrapper .wrapper
:display block :display block
@ -814,8 +825,6 @@ a.paginate, #infscr-loading
:padding 0 10px :padding 0 10px
:font :font
:size 16px :size 16px
:font
:family 'MARKER FELT', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif
:color #333 :color #333
#debug_info #debug_info

View file

@ -14,7 +14,6 @@
:font :font
:style normal :style normal
:weight bold :weight bold
:family 'helvetica', sans-serif
:display inline :display inline