ms dg; profile (step 1) finished

This commit is contained in:
danielgrippi 2011-08-02 12:18:12 -07:00
parent c2dc5fde08
commit c9eeeb6150
4 changed files with 143 additions and 53 deletions

View file

@ -0,0 +1,34 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module ProfilesHelper
# Creates a profile field <span> with a checked class if set
#
# @param [Profile, Symbol] Profile and field in question
# @return [String] A span element
def profile_field_tag(profile, field)
klass = field_filled_out?(profile, field) ? 'completed' : ''
klass += " profile_field"
field = case field
when :tag_string
:tags
when :full_name
:name
when :image_url
:photo
else
field
end
content_tag(:span, field.to_s.titleize, :class => klass)
end
private
# @param [Profile, Symbol] Profile and field in question
# @return [Boolean] The field in question is set?
def field_filled_out?(profile, field)
profile.send("#{field}".to_sym).present?
end
end

View file

@ -27,73 +27,84 @@
%ul#getting_started
%li.profile
#getting_started_profile_photo
= person_image_link(current_user.person, :size => :thumb_medium)
%h4
%span.getting_started_number
.getting_started_number
%h4
1
Fill Out Your Profile
%p
Description of why you'd want to do this (or checks like g+)
.span-8
- ["Name", "Birthday", "Gender", "Bio", "Location", "Tags"].each do |attr|
.span-4.last
= attr
.content
#getting_started_profile_photo
= person_image_link(current_user.person, :size => :thumb_medium)
%h4
Fill Out Your Profile
%p
Description of why you'd want to do this (or checks like g+)
.span-8.fields
- [:full_name, :image_url, :birthday, :gender, :bio, :location, :tag_string].each do |attr|
.span-4.last
= profile_field_tag(current_user.person.profile, attr)
#edit_profile_button_div
= link_to "Edit Profile", edit_profile_path, :class => "button"
#edit_profile_button_div
= link_to "Edit Profile", edit_profile_path, :class => "button"
%li.services
%h4
%span.getting_started_number
.getting_started_number
%h4
2
Connect to your other social networks
.content
%h4
Connect to your other social networks
#getting_started_service_icons
- AppConfig.configured_services.each do |service|
- unless current_user.services.any?{|x| x.provider == service}
= link_to(image_tag("social_media_logos/#{service.downcase}-48x48.png", :title => service.titleize), "/auth/#{service}")
%li
%h4
%span.getting_started_number
.getting_started_number
%h4
3
Connect with people
.content
%h4
Connect with people
#diaspora_hq_pane
- person = Person.first
= person_image_link(Person.first)
.add_to_aspect
= render :partial => 'people/relationship_action',
:locals => { :person => Person.first,
:contact => current_user.contact_for(Person.first),
:current_user => current_user }
#diaspora_hq_pane
- person = Person.first
= person_image_link(Person.first)
.add_to_aspect
= render :partial => 'people/relationship_action',
:locals => { :person => Person.first,
:contact => current_user.contact_for(Person.first),
:current_user => current_user }
.name
= person_link(person)
.name
= person_link(person)
.info
Get updates about the project.
.info
Get updates about the project.
%li
%h4
%span.getting_started_number
.getting_started_number
%h4
4
Follow your interests
%p
popular/curated tags? person's tags?
.content
%h4
Follow your interests
%p
popular/curated tags? person's tags?
%li
%h4
%span.getting_started_number
.getting_started_number
%h4
5
Connect to
= link_to "Cubbi.es", "http://cubbi.es/"
%p
= t('tokens.show.what_is_cubbies')
.content
%h4
Connect to
= link_to "Cubbi.es", "http://cubbi.es/"
%p
= t('tokens.show.what_is_cubbies')
.cubbies_images
= image_tag '/images/cubbies_collage.png', :width => 422, :height => 159, :class => "cubbies_collage_small"
= image_tag '/images/cubbies_screenshot2.png', :height => 151, :width => 200, :class => "cubbies_user_page_small"
.cubbies_images
= image_tag '/images/cubbies_collage.png', :width => 422, :height => 159, :class => "cubbies_collage_small"
= image_tag '/images/cubbies_screenshot2.png', :height => 151, :width => 200, :class => "cubbies_user_page_small"
.span-5.rightBar.last
/= render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count

View file

@ -3196,6 +3196,10 @@ ul#getting_started
:top 25px
:bottom 5px
.content
:padding
:left 30px
.profile
:min-height 170px
@ -3207,7 +3211,8 @@ ul#getting_started
#edit_profile_button_div
:padding
:top 70px
:top 90px
:bottom 20px
#getting_started_service_icons
:text-align center
@ -3249,12 +3254,25 @@ ul#getting_started
:position absolute
:left 250px
.getting_started_number
:background
:color #eee
:padding 4px
:left 8px
:position absolute
:left 0
:margin
:right 8px
h4
:display inline
:background
:color #eee
:padding 3px 7px
:margin
:right 8px
.completed
:background
:image url('/images/icons/check_yes_ok.png')
:position center right
:repeat no-repeat
.profile .profile_field
:padding
:right 20px

View file

@ -0,0 +1,27 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe ProfilesHelper do
before do
@profile = Factory(:person).profile
end
describe '#field_filled_out?' do
it 'returns false if not set' do
field_filled_out?(@profile, :bio).should be_false
end
it 'returns true if field is set' do
@profile.bio = "abc"
field_filled_out?(@profile, :bio).should be_true
end
end
describe '#profile_field_tag' do
it 'returns' do
profile_field_tag(@profile, :bio).should_not be_blank
end
end
end