diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..41ac2a2d11a56a177f0e03b6f1ee6f5820fd401a --- /dev/null +++ b/app/helpers/profiles_helper.rb @@ -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 diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.html.haml index e628bdf7d11d274214305bbd93e53867cf306676..6d2021e16a21dd86e19882485389cc912dfca4d5 100644 --- a/app/views/users/getting_started.html.haml +++ b/app/views/users/getting_started.html.haml @@ -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 - - #edit_profile_button_div - = link_to "Edit Profile", edit_profile_path, :class => "button" + .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" %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') - - .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" + .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" .span-5.rightBar.last /= render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index ae7b07fe01a6eeb09fa66d44f404f70be1cd1573..2d0b6856b6fd1e3eb3e7dff854e4cc9930728786 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -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 + :position absolute + :left 0 + + h4 + :display inline + :background + :color #eee + :padding 3px 7px + + :margin + :right 8px + +.completed :background - :color #eee - :padding 4px - :left 8px + :image url('/images/icons/check_yes_ok.png') + :position center right + :repeat no-repeat - :margin - :right 8px +.profile .profile_field + :padding + :right 20px diff --git a/spec/helpers/profiles_helper.rb b/spec/helpers/profiles_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..27f59ae3ac4bcb8a15499502115d5192b4f2374e --- /dev/null +++ b/spec/helpers/profiles_helper.rb @@ -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