diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 9efce5a0f..b6f7124f8 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -50,6 +50,11 @@ class AspectsController < ApplicationController elsif params[:aspect][:share_with] @contact = Contact.where(:id => params[:aspect][:contact_id]).first @person = Person.where(:id => params[:aspect][:person_id]).first + @contact = current_user.contact_for(@person) + + invite_or_add_contact_to_aspect(@aspect, @person, @contact) + + @contact = current_user.contact_for(@person) respond_to do |format| format.js { render :json => {:html => render_to_string( :partial => 'aspects/aspect_list_item', @@ -153,17 +158,8 @@ class AspectsController < ApplicationController @aspect = current_user.aspects.find(params[:aspect_id]) @contact = current_user.contact_for(@person) - if @contact - current_user.add_contact_to_aspect(@contact, @aspect) - else - current_user.send_contact_request_to(@person, @aspect) - contact = current_user.contact_for(@person) + invite_or_add_contact_to_aspect(@aspect, @person, @contact) - if request = Request.where(:sender_id => @person.id, :recipient_id => current_user.person.id).first - request.destroy - contact.update_attributes(:pending => false) - end - end flash.now[:notice] = I18n.t 'aspects.add_to_aspect.success' respond_to do |format| @@ -206,4 +202,20 @@ class AspectsController < ApplicationController end end end + + private + def invite_or_add_contact_to_aspect( aspect, person, contact) + if contact + current_user.add_contact_to_aspect(contact, aspect) + else + current_user.send_contact_request_to(person, aspect) + contact = current_user.contact_for(person) + + if request = Request.where(:sender_id => person.id, :recipient_id => current_user.person.id).first + request.destroy + contact.update_attributes(:pending => false) + end + end + + end end diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 95de0e13c..2bd519c75 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -8,7 +8,7 @@ class InvitationsController < Devise::InvitationsController def new @sent_invitations = current_user.invitations_from_me.includes(:recipient) - #emails_delivered = sent_invitations.map!{ |i| i.recipient.email } + render :layout => false end def create diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index cbfb39d35..b50a401ce 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -1,5 +1,5 @@ # Copyright (c) 2010, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. +# licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. class ServicesController < ApplicationController before_filter :authenticate_user! @@ -25,7 +25,7 @@ class ServicesController < ApplicationController flash[:notice] = I18n.t 'services.create.success' if current_user.getting_started - redirect_to getting_started_path(:step => 1) + redirect_to getting_started_path(:step => 3) else redirect_to services_url end @@ -46,7 +46,7 @@ class ServicesController < ApplicationController def finder service = current_user.services.where(:type => "Services::#{params[:provider].titleize}").first - @friends = service ? service.finder : {} + @friends = service ? service.finder(:remote => params[:remote]) : {} render :layout => false end @@ -67,7 +67,7 @@ class ServicesController < ApplicationController @subject = t('services.inviter.join_me_on_diaspora') @message = < invited_user.invitation_token)} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index be1b00253..d1222e176 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -21,10 +21,8 @@ class UsersController < ApplicationController params[:user].delete(:password) if params[:user][:password].blank? params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank? params[:user].delete(:language) if params[:user][:language].blank? - - - # change email notifications + # change email notifications if params[:user][:disable_mail] @user.update_attributes(:disable_mail => params[:user][:disable_mail]) flash[:notice] = I18n.t 'users.update.email_notifications_changed' @@ -80,25 +78,31 @@ class UsersController < ApplicationController @services = @user.services service = current_user.services.where(:type => "Services::Facebook").first - @step = ((params[:step].to_i>0)&&(params[:step].to_i<5)) ? params[:step].to_i : 1 + @step = ((params[:step].to_i>0)&&(params[:step].to_i<4)) ? params[:step].to_i : 1 @step ||= 1 + if @step == 2 && SERVICES['facebook']['app_id'] == "" + @step = 3 + end + if @step == 3 - @requests = Request.where(:recipient_id => @person.id).includes(:sender).all + @requests = Request.where(:recipient_id => @person.id).includes(:sender => :profile).all @friends = service ? service.finder(:local => true) : {} @friends.delete_if{|key, value| @requests.any?{ |r| r.sender_id == value[:person].id} } - elsif @step == 4 - @invites = @user.invites - @friends = service ? service.finder(:remote => true) : {} - @user.getting_started = false - @user.save end - render "users/getting_started" + + + if @step == 3 && @requests.length == 0 && @friends.length == 0 + @user.update_attributes(:getting_started => false) + redirect_to root_path + else + render "users/getting_started" + end end def getting_started_completed user = current_user - user.update_attributes( :getting_started => false ) + user.update_attributes(:getting_started => false) redirect_to root_path end diff --git a/app/views/invitations/new.html.haml b/app/views/invitations/new.html.haml index 93d2d5642..aeca8a475 100644 --- a/app/views/invitations/new.html.haml +++ b/app/views/invitations/new.html.haml @@ -4,37 +4,37 @@ $("#user_email").focus(); }); -.span-3.append-1 - = image_tag 'icons/monotone_email_letter_round.png', :height => "128px", :width => "128px" +.span-15.last + .span-3 + = image_tag 'icons/monotone_email_letter_round.png', :height => "128px", :width => "128px" -.span-20.last - .span-20.last + .span-12.last %h2 = t('.invite_someone_to_join') .description = t('.if_they_accept_info') %br + .span-7.append-1 + #email_invitation + = form_for User.new, :url => invitation_path(User) do |invite| + %h4 + = t('email') + = invite.text_field :email, :title => t('.comma_seperated_plz') + %br - .span-13.append-1 - = form_for User.new, :url => invitation_path(User) do |invite| - %h4 - = t('email') - = invite.text_field :email, :title => t('.comma_seperated_plz') - %br + %h4 + = t('.aspect') + = invite.select(:aspects, options_from_collection_for_select(@all_aspects, 'id', 'name')) - %h4 - = t('.aspect') - = invite.select(:aspects, options_from_collection_for_select(@all_aspects, 'id', 'name')) + %br + %br - %br - %br + %h4 + = t('.personal_message') + = invite.text_area :invite_messages, :rows => 3, :value => "" - %h4 - = t('.personal_message') - = invite.text_area :invite_messages, :rows => 3, :value => "" - - %p - = invite.submit t('.send_an_invitation') + %p + = invite.submit t('.send_an_invitation') - if !@sent_invitations.empty? .span-6.last diff --git a/app/views/people/_aspect_list.haml b/app/views/people/_aspect_list.haml index ffbdb61b1..02784a408 100644 --- a/app/views/people/_aspect_list.haml +++ b/app/views/people/_aspect_list.haml @@ -5,23 +5,6 @@ - content_for :head do =javascript_include_tag 'contact-list' - :javascript - $(document).ready(function() { - $("#edit_contact_aspects").click(function(evt){ - evt.preventDefault(); - $(".badges").fadeOut(200, function(){ - $(".edit").fadeIn(200); - }); - }); - - $("#done_contact_aspects").click(function(evt){ - evt.preventDefault(); - $(".edit").fadeOut(200, function(){ - $(".badges").fadeIn(200); - }); - }); - }); - .aspects - if !contact %h4 @@ -37,18 +20,10 @@ .badges{:class => ("hidden" if !contact)} = aspect_badges(aspects_with_person) - .right - = link_to t('.edit_membership'), "#", :id=> "edit_contact_aspects" - - .edit.hidden - = render :partial => 'people/share_with_pane', - :locals => {:person => person, - :contact => contact, - :aspects_with_person => aspects_with_person, - :aspects_without_person => aspects_without_person} - %br - - - if contact - .right - = link_to t('aspects.aspect_contacts.done_editing'), "#", :id => "done_contact_aspects" - = link_to t('people.profile_sidebar.remove_contact'), person, :confirm => t('are_you_sure'), :method => :delete + %p + = link_to t('.edit_membership'), + {:controller => "people", + :action => "share_with", + :id => @person.id}, + :class => 'button', + :rel => 'facebox' diff --git a/app/views/people/_share_with_pane.html.haml b/app/views/people/_share_with_pane.html.haml index 7ee48f457..a302636c7 100644 --- a/app/views/people/_share_with_pane.html.haml +++ b/app/views/people/_share_with_pane.html.haml @@ -13,19 +13,21 @@ = render :partial => 'aspects/aspect_list_item', :locals => {:aspect => aspect, :person => person, :contact => contact} - .add_aspect - = t('users.getting_started.step_3.aspect_name') = form_for(Aspect.new, :remote => true) do |aspect| + .right + = aspect.submit "add new aspect", :class => 'button' = aspect.error_messages = aspect.hidden_field :person_id, :value => person.id if person = aspect.hidden_field :contact_id, :value => contact.id if contact = aspect.hidden_field :share_with, :value => true - = aspect.text_field :name, :id => "step-3-aspect-name", :style => "display:inline;" + %p + = aspect.text_field :name, :style => "display:inline;" %p.checkbox_select = aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible') - = aspect.check_box :contacts_visible, :default => true - .right - = aspect.submit :src => '/images/icons/monotone_add_plus.png', :type => "image", :value => "", :class => 'button' - - + = aspect.check_box :contacts_visible, :checked => true, :default => true +.done + .right + = link_to t('aspects.aspect_contacts.done_editing'), "#", :class => "button", :onClick => '$.facebox.close();' + - if contact + = link_to t('people.profile_sidebar.remove_contact'), person, :confirm => t('are_you_sure'), :method => :delete diff --git a/app/views/services/_remote_friend.html.haml b/app/views/services/_remote_friend.html.haml index 90815db4a..183cd6886 100644 --- a/app/views/services/_remote_friend.html.haml +++ b/app/views/services/_remote_friend.html.haml @@ -1,22 +1,34 @@ %li - -if friend[:person] - = render :partial => 'people/person', :locals => {:person => friend[:person], :contact => friend[:contact], :request => friend[:request]} - -else - .steam_element - .right - -if friend[:invitation_id] - = t('invitations.new.already_invited') - %br - = link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend[:invitation_id]) - - elsif current_user.invites > 0 - = form_tag service_inviter_path(:provider => 'facebook') do - = select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name')) - = hidden_field_tag :uid, uid - = submit_tag t('.invite') + .right + -if friend[:contact] && !friend[:contact].pending + = t('people.person.already_connected') + - elsif (friend[:contact] && friend[:contact].pending) + = t('people.person.pending_request') + - elsif friend[:invitation_id] + = t('invitations.new.already_invited') + %br + = link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend[:invitation_id]) + - elsif friend[:person] + = link_to t('people.show.start_sharing'), + {:controller => "people", + :action => "show", + :id => friend[:person].id, + :share_with => true}, + :class => 'button' - - = image_tag('/images/user/default.png', :class => 'avatar') + - elsif current_user.invites > 0 + = form_tag service_inviter_path(:provider => 'facebook') do + = select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name')) + = hidden_field_tag :uid, uid + = submit_tag t('.invite') - .content - %span.from - = friend[:name] + - if friend[:person] + = person_image_link(friend[:person]) + - else + = image_tag('/images/user/default.png', :class => 'avatar') + + %h4.name + - if friend[:person] + = link_to friend[:name], person_path(friend[:person]) + - else + = friend[:name] diff --git a/app/views/shared/_invitations.haml b/app/views/shared/_invitations.haml index 9d802e327..2b564c3cc 100644 --- a/app/views/shared/_invitations.haml +++ b/app/views/shared/_invitations.haml @@ -4,12 +4,17 @@ -if invites > 0 - if SERVICES['facebook']['app_id'] !="" %h4{:style => 'text-align:center;'} - = link_to t('.from_facebook'), friend_finder_path('facebook'), :rel => 'facebox' + - if defined? remote + = link_to t('.from_facebook'), friend_finder_path('facebook', :remote => remote), :rel => 'facebox' + -else + = link_to t('.from_facebook'), friend_finder_path('facebook'), :rel => 'facebox' + = t('or') - = link_to t('.by_email'), new_user_invitation_path, :title => t('.invite_someone') + = link_to t('.by_email'), new_user_invitation_path, :title => t('.invite_someone'), :rel => 'facebox' - else %h4 = link_to t('.by_email'), new_user_invitation_path, :title => t('.invite_someone') - = t('.invitations_left', :count => invites) + %h5{:style => 'text-align:center;'} + = t('.invitations_left', :count => invites) - else = t('.dont_have_now') diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index 67acb744a..551c2c403 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -3,54 +3,30 @@ -# the COPYRIGHT file. -- content_for :head do - :javascript - $(document).ready(function(){ - $("#new_aspect").live("ajax:success", function(data,stat,xhr){ - window.location.reload(); - }); += content_for :head do + :css + header{ display:none; } - $(".aspects li").find(".delete").live("click", function(){ - var aspectElement = $(this).parent("li"); - if (confirm("#{t('are_you_sure')}")){ - aspectElement.fadeOut(300, function(){aspectElement.remove();}); - } - }); - }); - -.span-8.append-1.last - %h1{:style => "text-align:right;"} - = t('.welcome') - .description - =t('.signup_steps') + #getting_started_logo.start{ + -webkit-animation-name: fadeUp; + -webkit-animation-delay: 0s; + -webkit-animation-duration: 0.35s; + } - %h3{:style => "text-align:right;"} - - if @step != 1 - = link_to t('.connect_services'), getting_started_path(:step => 1) - - else - %span.current_gs_step - = t('.connect_services') - %br - - if @step != 2 - = link_to t('.edit_profile'), getting_started_path(:step => 2) - - else - %span.current_gs_step - = t('.edit_profile') - %br - - if @step != 3 - = link_to t('.connect_on_diaspora'), getting_started_path(:step => 3) - - else - %span.current_gs_step - = t('.connect_on_diaspora') - %br - - if @step != 4 - = link_to t('.finished'), getting_started_path(:step => 4) - - else - %span.current_gs_step - = t('.finished') - %br -.span-15.last - .floating{:style=>"min-height:500px;"} + @media only screen { + #getting_started_logo { -webkit-transform: translateZ(0); } + } + @-webkit-keyframes fadeUp { + 0% { opacity: 0; -webkit-transform: translate3d(0, 40px, 0); -webkit-animation-timing-function: ease-out; } + 70% { opacity: 0; -webkit-transform: translate3d(0, 35px, 0); } + 100% { opacity: 1; -webkit-transform: translate3d(0, 0, 0); -webkit-animation-timing-function: ease-out; } + } + +.span-15.prepend-4.last{:style => 'position:relative;'} + = image_tag 'logo_caps.png', :id => 'getting_started_logo', :width => 143, :height => 21, :class => ('start' if @step == 1) + %br + %br + .floating{:style=>"min-height:300px;"} = render "users/getting_started/step_#{@step}", :current_user => current_user - if @step > 1 diff --git a/app/views/users/getting_started/_step_1.html.haml b/app/views/users/getting_started/_step_1.html.haml index 8a92c6d2c..fc786edca 100644 --- a/app/views/users/getting_started/_step_1.html.haml +++ b/app/views/users/getting_started/_step_1.html.haml @@ -2,14 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -%h3 - = t('.your_services') - .description - = t('.description') - -= render 'shared/add_remove_services' - -.submit_block - = link_to "#{t('users.getting_started.save_and_continue')} →", getting_started_path(:step => 2), :class => "button" +- content_for :submit_block do + = submit_tag "#{t('users.getting_started.save_and_continue')} →" += render :partial => 'people/edit' diff --git a/app/views/users/getting_started/_step_2.html.haml b/app/views/users/getting_started/_step_2.html.haml index fc786edca..c7f4004f7 100644 --- a/app/views/users/getting_started/_step_2.html.haml +++ b/app/views/users/getting_started/_step_2.html.haml @@ -2,7 +2,18 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -- content_for :submit_block do - = submit_tag "#{t('users.getting_started.save_and_continue')} →" -= render :partial => 'people/edit' +%br +%br +%br +%br +%br +%h3{:style => 'text-align: center;'} + = t('.find_your_friends_on_facebook') + %br + %br + %br + = link_to image_tag('services/facebook_sign_in.png', :id => 'getting_started_logo', :width => 154, :height => 22), '/auth/facebook' + +.submit_block + = link_to "#{t('.skip')} →", getting_started_path(:step => @step+1), :class => 'button' diff --git a/app/views/users/getting_started/_step_3.html.haml b/app/views/users/getting_started/_step_3.html.haml index 33091cafc..bc3561dad 100644 --- a/app/views/users/getting_started/_step_3.html.haml +++ b/app/views/users/getting_started/_step_3.html.haml @@ -5,24 +5,22 @@ = include_javascripts :aspects %h3 - = t('.your_aspects') - .description - = t('.description') - %br - = t('.your_inviter') - %br + = t('.people_already_on_diaspora') - #people_stream.stream - - for pending_req in @requests - - person = pending_req.sender - - = render :partial => 'people/person', :locals => {:request => pending_req, :person => person, :contact => nil} - - for fb_id in @friends.keys - - friend = @friends[fb_id] - = render :partial => 'people/person', :locals => {:request => friend[:request], :person => friend[:person], :contact => friend[:contact]} + %br + %br +#people_stream.stream + - for pending_req in @requests + - person = pending_req.sender + = render :partial => 'people/person', :locals => {:request => pending_req, :person => person, :contact => nil} + - for fb_id in @friends.keys + - friend = @friends[fb_id] + = render :partial => 'people/person', :locals => {:request => friend[:request], :person => friend[:person], :contact => friend[:contact]} + +%br +%br .submit_block - = link_to "#{t('users.getting_started.save_and_continue')} →", getting_started_path(:step => 4), :class => "button" - + = link_to "#{t('.finish')} →", getting_started_completed_path, :class => 'button' diff --git a/app/views/users/getting_started/_step_4.html.haml b/app/views/users/getting_started/_step_4.html.haml deleted file mode 100644 index 143e011bc..000000000 --- a/app/views/users/getting_started/_step_4.html.haml +++ /dev/null @@ -1,39 +0,0 @@ --# Copyright (c) 2010, Diaspora Inc. This file is --# licensed under the Affero General Public License version 3 or later. See --# the COPYRIGHT file. - - -%h1 - = t('.set_up', :name => first_name_or_username(current_user)) - .description - = t('.ready_to_share') - %ul.inline_aspect_listing - - for aspect in @all_aspects - %li= aspect --unless @friends.blank? - %br - = t('services.finder.invite_your_friends_from', :service => "facebook".titleize) - = t('shared.invitations.invitations_left', :count => @invites) - %br - .contact_list - = render :partial => 'services/finder', :locals => {:friends => @friends, :getting_started => true} -%br -%br - -%h3 - = link_to t('.continue'), root_path - -%br -%br -%br - -%p - = t('.change_profile') - = t('.user_menu') - -%p - = t('.manage_aspects') - -.submit_block - = link_to "#{t('.finish')} →", root_url, :class => "button" - diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index b04bdcab2..5cf13a074 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -236,24 +236,11 @@ en: skip: "skip getting started" save_and_continue: "Save and continue" step_3: - your_aspects: "Your aspects" - description: "Tell Diaspora what different aspects of you are seen by different contacts. You can manage these later through your account menu at the top right. Your aspects are unique to you and not visible by others." - aspect_name: "Aspect name" - add: "Add" - your_inviter: "Here are the people who are waiting for you:" - drag_to_add: "Drag them to the aspect of yourself they know" - no_requests: "You have no requests" - step_1: - your_services: "Your services" - description: 'You are able to connect your existing social networks to your Diaspora account. You will be able to post publically through your Home page when you select “make public"' - step_4: - set_up: "You're all set up, %{name}!" - ready_to_share: "You're now ready to start sharing with " - continue: "Continue on to your Home page, an overview of all of your aspects." - change_profile: "You can edit your profile and manage your connected services at any time through " - user_menu: "the user menu located at the top right." - manage_aspects: "You can also add contacts while on any aspect page." finish: "Finish" + people_already_on_diaspora: "People already on Diaspora" + step_2: + find_your_friends_on_facebook: "would you like to find your friends on facebook?" + skip: "Skip" update: password_changed: "Password Changed" password_not_changed: "Password Change Failed" diff --git a/features/accepts_invitation.feature b/features/accepts_invitation.feature index 1df103a53..37e9f8e7e 100644 --- a/features/accepts_invitation.feature +++ b/features/accepts_invitation.feature @@ -9,15 +9,13 @@ Feature: invitation acceptance And I fill in "Password confirmation" with "secret" And I press "Sign up" Then I should be on the getting started page - And I should see "Welcome to Diaspora!" - And I should see "ohai" - When I follow "Save and continue" - And I fill in "profile_first_name" with "O" + And I should see "getting_started_logo" + When I fill in "profile_first_name" with "O" And I fill in "profile_last_name" with "Hai" And I fill in "profile_gender" with "guess!" And I press "Save and continue" Then I should see "Profile updated" - And I should see "Your aspects" + And I should see "would you like to find your friends on facebook?" And I should not see "Here are the people who are waiting for you:" Scenario: accept invitation from user @@ -29,17 +27,17 @@ Feature: invitation acceptance And I fill in "Password confirmation" with "secret" And I press "Sign up" Then I should be on the getting started page - And I should see "Welcome to Diaspora!" - And I should see "ohai" - When I follow "Save and continue" - And I fill in "profile_first_name" with "O" + And I should see "getting_started_logo" + When I fill in "profile_first_name" with "O" And I fill in "profile_last_name" with "Hai" And I fill in "profile_gender" with "guess!" And I press "Save and continue" Then I should see "Profile updated" - And I should see "Your aspects" - And I should see "Here are the people who are waiting for you:" + And I should see "would you like to find your friends on facebook?" + + When I follow "Skip" + Then I should see "People already on Diaspora" And I press the first ".share_with.button" And I press the first ".add.button" within "#facebox #aspects_list ul > li:first-child" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 12aa5f544..f40e2c909 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -1341,6 +1341,7 @@ ul#settings_nav :margin 0 :padding 0 + .dull :color #aaa :font @@ -1506,10 +1507,6 @@ ul.aspects :-moz-box-shadow 0 1px 3px #333 :box-shadow 0 1px 3px #333 - :-webkit-border-radius 2px - :-moz-border-radius 2px - :border-radius 2px - :border :bottom 1px solid #ccc :top 1px solid #fff @@ -1615,7 +1612,7 @@ h3 span.current_gs_step :left 0 :width 100% :background - :color rgba(16,127,201,0.8) + :color rgba(63,143,186,0.8) :text :align center @@ -1629,7 +1626,7 @@ h3 span.current_gs_step a :color #fafafa :background - :color rgb(16,127,201) + :color $blue :padding 8px :-webkit-border-radius 10px @@ -2393,3 +2390,40 @@ ul.show_comments #logo :position relative + +#email_invitation + input + :width 100% + textarea + :width 100% + +#share_with + .add_aspect + :-webkit-border-radius 5px + :-moz-border-radius 5px + :border-radius 5px + + :margin + :top 0.5em + :background + :color #ddd + p + :padding + :left 1em + + &.checkbox_select + label + :padding + :left 15px + :top 0 + :height 2em + + .right + :z-index 5 + :top 5px + :right 1em + .done + :padding 1em + .right + :right 1em + diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index b7fd036c9..b2e29c5a7 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -156,6 +156,14 @@ describe AspectsController do response.should redirect_to(:back) end end + it "adds to aspect if the person_id is present" do + @aspect = @user.aspects.create(:name => "new aspect") + @user.aspects.stub!(:create).and_return(@aspect) + @controller.should_receive(:invite_or_add_contact_to_aspect).with( + anything(), @user2.person, @user.contact_for(@user2.person)) + + post :create, "aspect" => {"name" => "new aspect", :person_id => @user2.person.id, :share_with => true} + end end describe "#manage" do