ms dg; profile (step 1) finished
This commit is contained in:
parent
c2dc5fde08
commit
c9eeeb6150
4 changed files with 143 additions and 53 deletions
34
app/helpers/profiles_helper.rb
Normal file
34
app/helpers/profiles_helper.rb
Normal 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
|
||||
|
|
@ -27,26 +27,30 @@
|
|||
|
||||
%ul#getting_started
|
||||
%li.profile
|
||||
.getting_started_number
|
||||
%h4
|
||||
1
|
||||
.content
|
||||
#getting_started_profile_photo
|
||||
= person_image_link(current_user.person, :size => :thumb_medium)
|
||||
%h4
|
||||
%span.getting_started_number
|
||||
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-8.fields
|
||||
- [:full_name, :image_url, :birthday, :gender, :bio, :location, :tag_string].each do |attr|
|
||||
.span-4.last
|
||||
= attr
|
||||
= profile_field_tag(current_user.person.profile, attr)
|
||||
|
||||
#edit_profile_button_div
|
||||
= link_to "Edit Profile", edit_profile_path, :class => "button"
|
||||
|
||||
%li.services
|
||||
.getting_started_number
|
||||
%h4
|
||||
%span.getting_started_number
|
||||
2
|
||||
.content
|
||||
%h4
|
||||
Connect to your other social networks
|
||||
#getting_started_service_icons
|
||||
- AppConfig.configured_services.each do |service|
|
||||
|
|
@ -54,9 +58,11 @@
|
|||
= link_to(image_tag("social_media_logos/#{service.downcase}-48x48.png", :title => service.titleize), "/auth/#{service}")
|
||||
|
||||
%li
|
||||
.getting_started_number
|
||||
%h4
|
||||
%span.getting_started_number
|
||||
3
|
||||
.content
|
||||
%h4
|
||||
Connect with people
|
||||
|
||||
#diaspora_hq_pane
|
||||
|
|
@ -75,17 +81,22 @@
|
|||
Get updates about the project.
|
||||
|
||||
%li
|
||||
.getting_started_number
|
||||
%h4
|
||||
%span.getting_started_number
|
||||
4
|
||||
.content
|
||||
%h4
|
||||
Follow your interests
|
||||
|
||||
%p
|
||||
popular/curated tags? person's tags?
|
||||
|
||||
%li
|
||||
.getting_started_number
|
||||
%h4
|
||||
%span.getting_started_number
|
||||
5
|
||||
.content
|
||||
%h4
|
||||
Connect to
|
||||
= link_to "Cubbi.es", "http://cubbi.es/"
|
||||
%p
|
||||
|
|
|
|||
|
|
@ -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 4px
|
||||
:left 8px
|
||||
: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
|
||||
|
|
|
|||
27
spec/helpers/profiles_helper.rb
Normal file
27
spec/helpers/profiles_helper.rb
Normal 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
|
||||
Loading…
Reference in a new issue