diaspora/app/views/shared/_aspect_contacts.haml
2010-11-22 21:07:01 -08:00

118 lines
3.3 KiB
Text

-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- content_for :head do
:javascript
$("#edit_aspect_trigger").live("click",
function(){
EditPane.toggle();
}
);
var EditPane = {
toggle: function() {
if( $("#edit_aspect_pane").hasClass("active") ) {
EditPane.fadeOut();
} else {
EditPane.fadeIn();
}
},
fadeIn: function(){
var trigger = $("#edit_aspect_trigger");
$("#edit_aspect_pane").addClass("active");
$(".contact_pictures").fadeOut(200, function(){
$("#edit_aspect_pane").fadeIn(200);
trigger.html("#{t('.done_editing')}");
});
},
fadeOut: function(){
var trigger = $("#edit_aspect_trigger");
trigger.html("#{t('.edit_aspect')}");
$("#edit_aspect_pane").removeClass("active");
$("#edit_aspect_pane").fadeOut(200, function(){
$(".contact_pictures").fadeIn(200);
});
}
};
- if aspect != :all && aspect.contacts.count == 0
:javascript
$(document).ready(function(){
EditPane.fadeIn();
});
- if (aspect == :all) && @request_count > 0
#new_request_pane{:class => "everyone"}
%h1.new_request{:style => 'text-align:center'}
- if @request_count > 1
= link_to t('.new_requests', :count => @request_count), aspects_manage_path
- else
= link_to t('.new_request', :count => @request_count), aspects_manage_path
#left_pane{:class => ("everyone" if aspect == :all)}
- if aspect == :all
%h2 All contacts
- unless aspect == :all
#edit_aspect_pane
- if @contacts.count > 0
%h3= t('.add_existing')
= render 'shared/contact_list', :aspect => aspect, :contacts => @contacts, :manage => defined?(manage)
= render 'shared/add_contact', :aspect => aspect
%h3= t('.aspect_settings')
.big_buttons
= button_to t('.remove_aspect'), aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')
.contact_pictures
- for contact in contacts
= person_image_link(contact.person)
- if aspect == :all && @contacts.count == 0
%h4
= t('.no_contacts')
= form_tag(people_path, :method => 'get') do
= text_field_tag 'q', nil, :placeholder => t('search'), :type => 'search', :results => 5
-if aspect == :all
%br
%br
%br
%br
%h3{:style=>"position:relative;"}
= t('.aspects')
.right{:style=>"font-size:12px;top:7px;"}
= link_to t('.add_aspect'), '#add_aspect_pane', :class => "add_aspect_button"
- for user_aspect in current_user.aspects
%div{:style=>"border-bottom:1px solid #eee;padding:6px;"}
%h4.aspect_title_right{:style => "margin-bottom:0;"}
= link_to user_aspect, user_aspect
%span{:style=>"font-size:12px;color:#888;"}
= "#{user_aspect.contacts.count} #{t('.contacts')}"
- if user_aspect.contacts.count > 0
- for aspect_contact in user_aspect.contacts[0..8]
= person_image_link(aspect_contact.person)
.clearfix
%br
%br
%br
%br
%h3= t('.invites')
%p= t('.invite_people')
= render "shared/invitations", :invites => @invites