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,73 +27,84 @@
|
||||||
|
|
||||||
%ul#getting_started
|
%ul#getting_started
|
||||||
%li.profile
|
%li.profile
|
||||||
#getting_started_profile_photo
|
.getting_started_number
|
||||||
= person_image_link(current_user.person, :size => :thumb_medium)
|
%h4
|
||||||
%h4
|
|
||||||
%span.getting_started_number
|
|
||||||
1
|
1
|
||||||
Fill Out Your Profile
|
.content
|
||||||
%p
|
#getting_started_profile_photo
|
||||||
Description of why you'd want to do this (or checks like g+)
|
= person_image_link(current_user.person, :size => :thumb_medium)
|
||||||
.span-8
|
%h4
|
||||||
- ["Name", "Birthday", "Gender", "Bio", "Location", "Tags"].each do |attr|
|
Fill Out Your Profile
|
||||||
.span-4.last
|
%p
|
||||||
= attr
|
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
|
#edit_profile_button_div
|
||||||
= link_to "Edit Profile", edit_profile_path, :class => "button"
|
= link_to "Edit Profile", edit_profile_path, :class => "button"
|
||||||
|
|
||||||
%li.services
|
%li.services
|
||||||
%h4
|
.getting_started_number
|
||||||
%span.getting_started_number
|
%h4
|
||||||
2
|
2
|
||||||
Connect to your other social networks
|
.content
|
||||||
|
%h4
|
||||||
|
Connect to your other social networks
|
||||||
#getting_started_service_icons
|
#getting_started_service_icons
|
||||||
- AppConfig.configured_services.each do |service|
|
- AppConfig.configured_services.each do |service|
|
||||||
- unless current_user.services.any?{|x| x.provider == 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}")
|
= link_to(image_tag("social_media_logos/#{service.downcase}-48x48.png", :title => service.titleize), "/auth/#{service}")
|
||||||
|
|
||||||
%li
|
%li
|
||||||
%h4
|
.getting_started_number
|
||||||
%span.getting_started_number
|
%h4
|
||||||
3
|
3
|
||||||
Connect with people
|
.content
|
||||||
|
%h4
|
||||||
|
Connect with people
|
||||||
|
|
||||||
#diaspora_hq_pane
|
#diaspora_hq_pane
|
||||||
- person = Person.first
|
- person = Person.first
|
||||||
= person_image_link(Person.first)
|
= person_image_link(Person.first)
|
||||||
.add_to_aspect
|
.add_to_aspect
|
||||||
= render :partial => 'people/relationship_action',
|
= render :partial => 'people/relationship_action',
|
||||||
:locals => { :person => Person.first,
|
:locals => { :person => Person.first,
|
||||||
:contact => current_user.contact_for(Person.first),
|
:contact => current_user.contact_for(Person.first),
|
||||||
:current_user => current_user }
|
:current_user => current_user }
|
||||||
|
|
||||||
.name
|
.name
|
||||||
= person_link(person)
|
= person_link(person)
|
||||||
|
|
||||||
.info
|
.info
|
||||||
Get updates about the project.
|
Get updates about the project.
|
||||||
|
|
||||||
%li
|
%li
|
||||||
%h4
|
.getting_started_number
|
||||||
%span.getting_started_number
|
%h4
|
||||||
4
|
4
|
||||||
Follow your interests
|
.content
|
||||||
%p
|
%h4
|
||||||
popular/curated tags? person's tags?
|
Follow your interests
|
||||||
|
|
||||||
|
%p
|
||||||
|
popular/curated tags? person's tags?
|
||||||
|
|
||||||
%li
|
%li
|
||||||
%h4
|
.getting_started_number
|
||||||
%span.getting_started_number
|
%h4
|
||||||
5
|
5
|
||||||
Connect to
|
.content
|
||||||
= link_to "Cubbi.es", "http://cubbi.es/"
|
%h4
|
||||||
%p
|
Connect to
|
||||||
= t('tokens.show.what_is_cubbies')
|
= link_to "Cubbi.es", "http://cubbi.es/"
|
||||||
|
%p
|
||||||
|
= t('tokens.show.what_is_cubbies')
|
||||||
|
|
||||||
.cubbies_images
|
.cubbies_images
|
||||||
= image_tag '/images/cubbies_collage.png', :width => 422, :height => 159, :class => "cubbies_collage_small"
|
= 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"
|
= image_tag '/images/cubbies_screenshot2.png', :height => 151, :width => 200, :class => "cubbies_user_page_small"
|
||||||
|
|
||||||
.span-5.rightBar.last
|
.span-5.rightBar.last
|
||||||
/= render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count
|
/= render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count
|
||||||
|
|
|
||||||
|
|
@ -3196,6 +3196,10 @@ ul#getting_started
|
||||||
:top 25px
|
:top 25px
|
||||||
:bottom 5px
|
:bottom 5px
|
||||||
|
|
||||||
|
.content
|
||||||
|
:padding
|
||||||
|
:left 30px
|
||||||
|
|
||||||
.profile
|
.profile
|
||||||
:min-height 170px
|
:min-height 170px
|
||||||
|
|
||||||
|
|
@ -3207,7 +3211,8 @@ ul#getting_started
|
||||||
|
|
||||||
#edit_profile_button_div
|
#edit_profile_button_div
|
||||||
:padding
|
:padding
|
||||||
:top 70px
|
:top 90px
|
||||||
|
:bottom 20px
|
||||||
|
|
||||||
#getting_started_service_icons
|
#getting_started_service_icons
|
||||||
:text-align center
|
:text-align center
|
||||||
|
|
@ -3249,12 +3254,25 @@ ul#getting_started
|
||||||
:position absolute
|
:position absolute
|
||||||
:left 250px
|
:left 250px
|
||||||
|
|
||||||
|
|
||||||
.getting_started_number
|
.getting_started_number
|
||||||
:background
|
:position absolute
|
||||||
:color #eee
|
:left 0
|
||||||
:padding 4px
|
|
||||||
:left 8px
|
|
||||||
|
|
||||||
:margin
|
h4
|
||||||
:right 8px
|
: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
|
||||||
|
|
|
||||||
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