Merge branch 'get_started_tab'

This commit is contained in:
danielgrippi 2011-08-03 18:08:10 -07:00
commit 1b704fd7b2
32 changed files with 699 additions and 279 deletions

View file

@ -122,6 +122,6 @@ class ApplicationController < ActionController::Base
end
def after_sign_in_path_for(resource)
stored_location_for(:user) || aspects_path
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : aspects_path)
end
end

View file

@ -22,12 +22,6 @@ class AspectsController < ApplicationController
aspect_ids = @aspects.map{|a| a.id}
# redirect to signup
if current_user.getting_started == true && !request.format.mobile? && !request.format.js?
redirect_to getting_started_path
return
end
# redirect to aspects creation
if @aspects.blank?
redirect_to new_aspect_path

View file

@ -39,13 +39,7 @@ class ContactsController < ApplicationController
def featured
@featured = true
@people = []
if diaspora_ids = AppConfig[:featured_users]
@people = diaspora_ids.inject [] do |people, id|
person = Webfinger.new(id).fetch
people << person unless person.blank?
end
end
@people = Person.featured_users
end
private

View file

@ -36,8 +36,8 @@ class ProfilesController < ApplicationController
if current_user.update_profile params[:profile]
flash[:notice] = I18n.t 'profiles.update.updated'
if params[:getting_started]
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
if current_user.getting_started?
redirect_to getting_started_path
else
redirect_to edit_profile_path
end

View file

@ -98,27 +98,9 @@ class UsersController < ApplicationController
@person = @user.person
@profile = @user.profile
@services = @user.services
service = current_user.services.where(:type => "Services::Facebook").first
@step = 0
@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
@friends = service ? service.finder(:local => true) : []
@friends ||= []
end
if @step == 3 && @friends.length == 0
@user.update_attributes(:getting_started => false)
flash[:notice] = I18n.t('users.getting_started.could_not_find_anyone')
redirect_to root_path
else
render "users/getting_started"
end
render "users/getting_started"
end
def getting_started_completed

View file

@ -111,7 +111,11 @@ module ApplicationHelper
end
def controller_index_path
self.send((request.filtered_parameters["controller"] + "_path").to_sym)
kontroller = request.filtered_parameters["controller"]
if kontroller.downcase != "contacts"
kontroller = "aspects"
end
self.send((kontroller + "_path").to_sym)
end
def left_nav_root

View file

@ -0,0 +1,51 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module GettingStartedHelper
# @return [Boolean] The user has filled out all profile fields
def has_completed_profile?
profile = current_user.person.profile
[:full_name, :image_url,
:birthday, :gender,
:bio, :location,
:tag_string].map! do |attr|
return false if profile.send(attr).blank?
end
true
end
# @return [Boolean] The user has connected at least one service
def has_connected_services?
AppConfig[:configured_services].blank? || current_user.services.size > 0
end
# @return [Boolean] The user has at least 3 contacts
def has_few_contacts?
current_user.contacts.receiving.size > 2
end
# @return [Boolean] The user has followed at least 3 tags
def has_few_followed_tags?
current_user.followed_tags.size > 2
end
# @return [Boolean] The user has connected to cubbi.es
def has_connected_cubbies?
current_user.authorizations.size > 0
end
# @return [Boolean] The user has completed all steps in getting started
def has_completed_getting_started?
current_user.getting_started == false
end
# @return [String] Welcome text with or without the current_user's first_name
def welcome_text
if current_user.person.profile.first_name.present?
t('users.getting_started.welcome_with_name', :name => current_user.first_name)
else
t('users.getting_started.welcome')
end
end
end

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, t(".profile_fields.#{field.to_s}"), :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

@ -1,10 +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.
module UsersHelper
def first_name_or_username (user)
set_name = user.person.profile.first_name
(set_name.nil? || set_name.empty?) ? user.username : user.person.profile.first_name
end
end

View file

@ -46,6 +46,12 @@ class Person < ActiveRecord::Base
scope :remote, where('people.owner_id IS NULL')
scope :local, where('people.owner_id IS NOT NULL')
def self.featured_users
if AppConfig[:featured_users].present?
Person.where(:diaspora_handle => AppConfig[:featured_users])
end
end
def self.search_query_string(query)
query = query.downcase

View file

@ -15,7 +15,7 @@
- for aspect in all_aspects
= aspect_dropdown_list_item(aspect, contact, person)
- if defined?(@aspect) && ( @aspect == :profile || @aspect == :tag || @aspect == :search || @aspect == :notification)
- if defined?(@aspect) && ( @aspect == :profile || @aspect == :getting_started || @aspect == :tag || @aspect == :search || @aspect == :notification)
%li.newItem
.add_aspect
= link_to t('contacts.index.add_a_new_aspect'), new_aspect_path(:person_id => person.id), :rel => 'facebox', :class => 'new_aspect'

View file

@ -12,6 +12,12 @@
%h3
= current_user.first_name
- unless has_completed_getting_started?
.section
%ul.left_nav
%li
= link_to "Welcome", getting_started_path, :class => "home_selector"
.section
= render 'aspects/aspect_listings'
@ -28,67 +34,4 @@
.span-5.rightBar.last
= render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count
.section
.title
= image_tag('/images/icons/bookmark.png')
%h5
= t(".diaspora_id.heading")
.content
= t(".diaspora_id.content_1")
%b
= current_user.diaspora_handle
%br
= t(".diaspora_id.content_2")
- unless AppConfig[:invites_off]
.section
.title
= image_tag('/images/icons/plus.png')
%h5
- unless AppConfig[:open_invitations]
.right
= t('shared.invitations.invitations_left', :count => @invites)
= t('shared.invitations.invite_your_friends')
.content
= render "shared/invitations", :invites => @invites
.section
.title
= image_tag('/images/icons/cubbies.png')
%h5
= t('.cubbies.heading')
.content
= t('.cubbies.explanation')
= link_to t('.cubbies.learn_more'), token_path
- unless AppConfig.configured_services.blank?
.section
.title
= image_tag('/images/icons/monotone_wrench_settings.png')
%h5
= t('.services.heading')
.content
= t('.services.content')
- AppConfig.configured_services.each do |service|
- unless current_user.services.any?{|x| x.provider == service}
%br= link_to service.titleize, "/auth/#{service}"
.section
.title
= image_tag('/images/icons/bookmark.png')
%h5
= t('bookmarklet.heading')
.content
!= t('bookmarklet.explanation', :link => link_to(t('bookmarklet.explanation_link_text'), bookmarklet))
- unless AppConfig[:paypal_hosted_button_id].blank?
.section
.title
= image_tag('/images/icons/coffee.png')
%h5
= t('.donate')
.content
= t('.keep_us_running', :pod => URI.parse(AppConfig[:pod_url]).host)
%br
= render 'shared/donate'
= render 'shared/right_sections'

View file

@ -72,14 +72,13 @@
#lightbox-backdrop
%ul#user_menu.dropdown
%li
.right
&#9660;
.avatar
= owner_image_tag(:thumb_small)
= link_to current_user.name, '#'
= link_to current_user.name, '#', :title => current_user.diaspora_handle
%li= link_to t('.profile'), current_user.person
%li= link_to t('.settings'), edit_user_path
-if current_user.admin?

View file

@ -0,0 +1,48 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- unless has_connected_cubbies?
.section
.title
= image_tag('/images/icons/cubbies.png')
%h5
= t('aspects.index.cubbies.heading')
.content
= t('aspects.index.cubbies.explanation')
= link_to t('aspects.index.cubbies.learn_more'), token_path
- unless AppConfig.configured_services.blank?
.section
.title
= image_tag('/images/icons/monotone_wrench_settings.png')
%h5
= t('aspects.index.services.heading')
.content
%div
= t('aspects.index.services.content')
#right_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}-24x24.png", :title => service.titleize), "/auth/#{service}")
.section
.title
= image_tag('/images/icons/bookmark.png')
%h5
= t('bookmarklet.heading')
.content
!= t('bookmarklet.explanation', :link => link_to(t('bookmarklet.explanation_link_text'), bookmarklet))
- unless AppConfig[:paypal_hosted_button_id].blank?
.section
.title
= image_tag('/images/icons/coffee.png')
%h5
= t('aspects.index.donate')
.content
= t('aspects.index.keep_us_running', :pod => URI.parse(AppConfig[:pod_url]).host)
%br
= render 'shared/donate'

View file

@ -2,36 +2,167 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.span-5.leftNavBar
#home_user_badge
= owner_image_link
%h3
= current_user.first_name
= content_for :head do
:css
header{ display:none; }
- unless has_completed_getting_started?
.section
%ul.left_nav
%li
= link_to "Welcome", getting_started_path, :class => "home_selector active"
#getting_started_logo.start{
-webkit-animation-name: fadeUp;
-webkit-animation-delay: 0s;
-webkit-animation-duration: 0.35s;
}
.section
= render 'aspects/aspect_listings'
@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; }
}
.section
= render 'tags/followed_tags_listings'
.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
.span-13.append-1
.stream_container
%h2
= welcome_text
- if @step > 1
= link_to t('back'), getting_started_path(:step => @step-1), :class => "button", :id => "previous_step"
%ul#getting_started
%li.profile{:class => ("completed" if has_completed_profile?)}
.getting_started_number
%h3
= @step += 1
.content
%h3
= t(".fill_out_your_profile")
#getting_started_profile_photo
= person_image_link(current_user.person, :size => :thumb_medium)
%p
= t(".profile_description")
.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)
- if @user.getting_started
.bottom_notification
= link_to "#{t('.skip')} →", getting_started_completed_path
#edit_profile_button_div
= link_to "Edit Profile", edit_profile_path, :class => "button"
- unless AppConfig[:configured_services].blank?
%li.services{:class => ("completed" if has_connected_services?)}
.getting_started_number
%h3
= @step += 1
.content
%h3
= t('.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.connect_with_people{:class => ("completed" if has_few_contacts?)}
.getting_started_number
%h3
= @step += 1
.content
%h3
= t('.connect_with_people')
%p
= t('.connect_with_people_explanation')
#diaspora_hq_pane
- person = Person.find_by_diaspora_handle("diasporahq@joindiaspora.com")
= person_image_link(person, :size => :thumb_medium)
.name
= person_link(person)
.info
Get updates about the project from the core team.
.add_to_aspect
= render :partial => 'people/relationship_action',
:locals => { :person => person,
:contact => current_user.contact_for(person),
:current_user => current_user }
#featured_users_pane
%h4
= t('.featured_users')
%div
- Person.featured_users[0..5].each do |person|
.featured_user_card_small
= person_image_link(person)
= link_to person.name, person_path(person)
- person.profile.tags[0..2].each do |tg|
= "##{tg}"
= link_to "#{t('.see_all_featured_users')} ->", featured_users_path
%br
#find_friends_pane
%h4
= t('.find_friends')
.span-5.append-1
#global_search
= form_tag(people_path, :method => 'get', :id => "global_search_form") do
= text_field_tag 'q', nil, :placeholder => "Search for people", :type => 'search', :results => 5
.span-5.last{:style => "height:30px;"}
%h4{:style => "margin-top:7px;"}
or
= link_to t('.find_friends_from_facebook'), friend_finder_path('facebook'), :rel => 'facebox'
.clearfix
%br
%li.follow_interests{:class => ("completed" if has_few_followed_tags?)}
.getting_started_number
%h3
= @step += 1
.content
%h3
= t('.follow_your_interests')
%p
= t('.hashtag_explanation')
.span-5.append-1
#global_search
= form_tag(people_path, :method => 'get', :id => "global_search_form") do
= text_field_tag 'q', nil, :placeholder => "Search for #hashtags", :type => 'search', :results => 5
.span-5.last
%h4{:style => "margin-top:7px;"}
= t('.featured_tags')
%p
= link_to "#diaspora", tag_path('diaspora')
%br
= link_to "#art", tag_path('art')
%br
= link_to "#gif", tag_path('gif')
%br
= link_to "#french", tag_path('french')
.clearfix
%br
%br
%li.cubbies{:class => ("completed" if has_connected_cubbies?)}
.getting_started_number
%h3
= @step += 1
.content
%h3
= t(".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"
%li{:style => 'text-align:center;'}
%p
= link_to t('.finished'), getting_started_completed_path, :class => "button"
/.span-5.rightBar.last
/ = render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count
/ = render 'shared/right_sections'

View file

@ -1,22 +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.
= form_tag profile_path, :method => :put, :multipart => true, :id => 'update_profile_form' do
%div{:style => "width:360px"}
= render 'profiles/edit_public', :profile => @profile, :aspect => @aspect, :person => @person
= hidden_field_tag :getting_started, @step
%h4
= t('search')
%p{:class=>"checkbox_select"}
= label_tag 'profile[searchable]', t('profiles.edit.allow_search')
= check_box_tag 'profile[searchable]', true, @profile.searchable
%br
%br
%br
.submit_block
= submit_tag "#{t('users.getting_started.save_and_continue')} →"

View file

@ -1,19 +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.
%br
%br
%br
%br
%br
%h3{:style => 'text-align: center;'}
= t('.find_your_friends_on_diaspora')
%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'

View file

@ -1,21 +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.
- content_for :head do
= include_javascripts :aspects
%h3
= t('.people_already_on_diaspora')
%br
%br
#people_stream.stream
- for friend in @friends
= render :partial => 'people/person', :locals => {:person => friend.person, :contact => friend.contact}
%br
%br
.submit_block
= link_to "#{t('.finish')} →", getting_started_completed_path, :class => 'button'

View file

@ -0,0 +1,10 @@
#this breaks seed scripts
unless !ActiveRecord::Base.connection.table_exists?('people') || Rails.env == 'test' || AppConfig[:featured_users].count == Person.featured_users.count
print "Fetching featured users from remote servers"
AppConfig[:featured_users].each do |x|
Webfinger.new(x).fetch
print "."
end
puts " done!"
end

View file

@ -777,21 +777,37 @@ en:
email_awaiting_confirmation: "We have sent you an activation link to %{unconfirmed_email}. Until you follow this link and activate the new address, we will continue to use your original address %{email}."
destroy: "Your account has been locked. It may take 20 minutes for us to finish closing your account. Thank you for trying Diaspora."
getting_started:
welcome: "Welcome to Diaspora!"
signup_steps: "Finish your sign up by completing these three steps:"
edit_profile: "Edit your profile"
connect_on_diaspora: "Connect on Diaspora"
connect_services: "Connect your other services"
finished: "Finished!"
skip: "skip getting started"
save_and_continue: "Save and continue"
could_not_find_anyone: "Could not find any friends on Diaspora*. Use the friend finder to invite them."
step_3:
finish: "Finish"
people_already_on_diaspora: "People already on Diaspora"
step_2:
find_your_friends_on_diaspora: "Would you like to find your Facebook friends on Diaspora?"
skip: "Skip"
welcome: "Welcome!"
welcome_with_name: "Welcome, %{name}!"
finished: "Finished"
fill_out_your_profile: "Fill out your profile"
profile_description: "Make it easier for people to find you by filling out your profile information."
profile_fields:
name: "Name"
birthday: "Birthday"
bio: "Bio"
tags: "Tags"
photo: "Photo"
gender: "Gender"
location: "Location"
connect_to_your_other_social_networks: "Connect to your other social networks"
connect_with_people: "Connect with cool people"
connect_with_people_explanation: "Connect with people by placing them into one or more of your aspects. Aspects are an intuative way to group new and familar faces, allowing you to filter down or share with subsets of your contacts easily."
featured_users: "Featured users"
follow_your_interests: "Follow your interests"
connect_to: "Connect to"
find_friends_from_facebook: "find friends from Facebook"
featured_tags: "Featured tags"
find_friends: "Find friends"
see_all_featured_users: "See all featured users"
hashtag_explanation: "Hashtags allow you to talk about and follow your interests. They're also a great way to find new people on Diaspora."
update:
password_changed: "Password changed. You can now log in with your new password."
password_not_changed: "Password change failed"

View file

@ -10,14 +10,19 @@ Feature: invitation acceptance
| Password confirmation | secret |
And I press "Sign up"
Then I should be on the getting started page
And I should see "getting_started_logo"
And I should see "Welcome"
Then I follow "Edit Profile"
And I fill in the following:
| profile_first_name | O |
| profile_last_name | Hai |
| tags | #beingawesome |
And I press "Save and continue"
And I should see "Would you like to find your Facebook friends on Diaspora?"
And I should not see "Here are the people who are waiting for you:"
| profile_bio | swagger |
| profile_location | new york, ny |
| profile_gender | diasporian |
And I press "Update Profile"
And I should see "Welcome"
When I follow "Finished"
Then I should be on the aspects page
Scenario: accept invitation from user
Given I have been invited by a user
@ -29,13 +34,17 @@ Feature: invitation acceptance
| Password confirmation | secret |
And I press "Sign up"
Then I should be on the getting started page
And I should see "getting_started_logo"
And I should see "Welcome"
Then I follow "Edit Profile"
And I fill in the following:
| profile_first_name | O |
| profile_last_name | Hai |
| tags | #tags |
And I press "Save and continue"
And I should see "Would you like to find your Facebook friends on Diaspora?"
When I follow "Skip"
| profile_first_name | O |
| profile_last_name | Hai |
| tags | #beingawesome |
| profile_bio | swagger |
| profile_location | new york, ny |
| profile_gender | diasporian |
And I press "Update Profile"
And I should see "Welcome"
When I follow "Finished"
Then I should be on the aspects page

View file

@ -9,26 +9,27 @@ Feature: new user registration
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 "getting_started_logo"
And I should see "Welcome"
And I should see "Fill out your profile"
And I should see "Connect to your other social networks"
And I should see "Connect with cool people"
And I should see "Follow your interests"
And I should see "Connect to Cubbi.es"
Scenario: new user goes through the setup wizard
When I fill in "profile_first_name" with "O"
When I follow "Edit Profile"
And I fill in "profile_first_name" with "O"
And I fill in "profile_last_name" with "Hai"
And I fill in "tags" with "#tags"
And I press "Save and continue"
And I press "Update Profile"
And I wait for the ajax to finish
Then I should see "Profile updated"
And I should see "Would you like to find your Facebook friends on Diaspora?"
And I follow "Skip"
And I should see "Welcome"
And I follow "Finished"
Then I should be on the aspects page
And I should not see "skip getting started"
And I should not see "Finished"
Scenario: new user skips the setup wizard and returns to the setup wizard
When I follow "skip getting started"
And I go to the getting started page
Then I should not see "skip getting started"
Scenario: new user skips the setup wizard
When I follow "skip getting started"
When I follow "Finished"
Then I should be on the aspects page

View file

@ -11,7 +11,7 @@ end
Given /^(?:I am signed in|I sign in)$/ do
When %(I try to sign in)
wait_until { page.has_content?(@me.diaspora_handle) }
wait_until { page.has_content?("#{@me.first_name} #{@me.last_name}") }
end
When /^I try to sign in$/ do

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100px" height="74.489px" viewBox="0 0 100 74.489" enable-background="new 0 0 100 74.489" xml:space="preserve">
<path d="M91.236,1.479C73.359,18.953,55.482,36.427,37.605,53.9c-6.441-6.295-12.881-12.592-19.322-18.888
c-4.715-4.609-11.948,2.614-7.229,7.229c7.646,7.474,15.292,14.947,22.937,22.421c2.009,1.963,5.219,1.962,7.228,0
c4.65-4.546,9.302-9.092,13.951-13.637V69.81H4.679V19.318H55.17v12.52l4.679-4.678v-9.75c0-1.53-1.24-2.77-2.771-2.77H2.772
C1.241,14.64,0,15.88,0,17.41v54.307c0,1.531,1.241,2.771,2.772,2.771h54.306c1.53,0,2.771-1.24,2.771-2.771V46.452
C72.721,33.87,85.592,21.288,98.464,8.707C103.184,4.093,95.951-3.13,91.236,1.479z"/>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -1109,7 +1109,7 @@ img.scaled_full
img
:height 140px
#global_search
header #global_search
:display inline
:position relative
@ -3183,3 +3183,146 @@ ul.left_nav
:bottom 12px
:right 5px
:position absolute
ul#getting_started
:padding 0
:margin 0
> li
:position relative
:border
:bottom 1px solid #ddd
:padding
:top 25px
:bottom 5px
.content
:padding
:left 30px
input[type='search']
:width 210px
&.completed
@include opacity(0.4)
@include transition(opacity, 0.2s)
&:hover,
&:active
@include opacity(1)
.content h3
:text
:decoration line-through
.profile
:min-height 170px
#getting_started_profile_photo
:float right
.avatar
:height 150px
:width 150px
:margin
:left 5px
#edit_profile_button_div
:padding
:top 90px
:bottom 20px
#getting_started_service_icons
:text-align center
img
:margin
:right 48px
:padding
:bottom 20px
:top 10px
#right_service_icons
:text-align center
:padding 10px
:bottom 0
#diaspora_hq_pane
:padding
:bottom 20px
:min-height 70px
.add_to_aspect
:padding 10px 0
.avatar
:float left
:margin
:right 10px
:height 70px
:width 70px
.name
:font
:weight bold
.cubbies_images
:margin-left 15px
.cubbies_user_page_small
:position absolute
:left 270px
.getting_started_number
:position absolute
:left 0
h3
:display inline
:background
:color #eee
:padding 3px 7px
:margin
:right 8px
.profile .profile_field
:background
:image url('/images/icons/monotone_question.png')
:position center left
:repeat no-repeat
:padding
:left 20px
&.completed
:background
:image url('/images/icons/check_yes_ok.png') !important
#featured_users_pane
:padding 10px 0
.featured_user_card_small
:display inline-block
:width 140px
:height 30px
:vertical-align top
:position relative
:padding 5px
:margin
:bottom 10px
a
:font
:weight bold
.avatar
:height 30px
:width 30px
:margin
:right 5px
:float left

View file

@ -77,14 +77,12 @@ describe AspectsController do
alice.getting_started = true
alice.save
end
it 'redirects to getting_started' do
get :index
response.should redirect_to getting_started_path
end
it 'does not redirect mobile users to getting_started' do
get :index, :format => :mobile
response.should_not be_redirect
end
it 'does not redirect ajax to getting_started' do
get :index, :format => :js
response.should_not be_redirect

View file

@ -81,15 +81,5 @@ describe ContactsController do
get :featured
assigns[:people].should == [alice.person]
end
it 'fetches the webfinger profiles' do
AppConfig[:featured_users] = [alice.diaspora_handle]
wf = mock
wf.should_receive(:fetch)
Webfinger.should_receive(:new).with(alice.diaspora_handle).and_return(wf)
get :featured
end
end
end

View file

@ -16,7 +16,6 @@ Factory.define :profile do |p|
p.birthday Date.today
end
Factory.define :person do |p|
p.sequence(:diaspora_handle) { |n| "bob-person-#{n}#{r_str}@aol.com" }
p.sequence(:url) { |n| AppConfig[:pod_url] }

View file

@ -0,0 +1,120 @@
# 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 GettingStartedHelper do
before do
@current_user = alice
end
def current_user
@current_user
end
describe "#has_completed_profile?" do
it 'returns true if the current user has filled out all 7 suggested fields (from getting started)' do
profile = @current_user.person.profile
profile.update_attributes!(
{:first_name => "alice", :last_name => "smith", :image_url => "abcd.jpg", :birthday => Date.new,
:gender => "cow", :location => "san fran", :tag_string => "#sup", :bio => "holler" })
has_completed_profile?.should be_true
end
it 'returns false if the current user has not filled out all 7 suggested fields (from getting started)' do
@current_user.update_attributes(:person => {:profile =>
{:first_name => nil, :last_name => nil, :birthday => nil, :gender => nil }})
has_completed_profile?.should be_false
end
end
describe "#has_connected_services?" do
before do
AppConfig[:configured_services] = ['fake_service']
end
it 'returns true if the current user has connected at least one service' do
@current_user.services << Factory.build(:service)
has_connected_services?.should be_true
end
it 'returns true if the current user has zero connected services and the server has no services configured' do
AppConfig[:configured_services] = []
@current_user.services.delete_all
has_connected_services?.should be_true
end
it 'returns false if the current user has not connected any service' do
@current_user.services.delete_all
has_connected_services?.should be_false
end
end
describe "#has_few_contacts?" do
it 'returns true if the current_user has more than 2 contacts' do
3.times do |n|
@current_user.contacts << Contact.new(:person => Factory(:person), :receiving => true)
end
has_few_contacts?.should be_true
end
it 'returns false if the current_user has less than 2 contacts (inclusive)' do
@current_user.contacts.delete_all
has_few_contacts?.should be_false
end
end
describe "has_few_followed_tags?" do
it 'returns true if the current_user has more than 2 contacts' do
3.times do |n|
@current_user.followed_tags << ActsAsTaggableOn::Tag.new(:name => "poodles_#{n}")
end
has_few_followed_tags?.should be_true
end
it 'returns false if the current_user has less than 2 contacts (inclusive)' do
@current_user.followed_tags.delete_all
has_few_followed_tags?.should be_false
end
end
describe "#has_connected_cubbies?" do
it 'returns true if the current user has connected cubbies to their account' do
@current_user.authorizations << Factory(:oauth_authorization)
has_connected_cubbies?.should be_true
end
it 'returns false if the current user has not connected cubbies to their account' do
has_connected_cubbies?.should be_false
end
end
describe "#has_completed_getting_started?" do
it 'returns true if the current user has completed getting started' do
@current_user.getting_started = false
@current_user.save
has_completed_getting_started?.should be_true
end
it 'returns false if the current user has not completed getting started' do
@current_user.getting_started = true
@current_user.save
has_completed_getting_started?.should be_false
end
end
describe "#welcome_text" do
it 'returns "Welcome" without a name if first_name is not set' do
profile = @current_user.person.profile
profile.first_name = ""
profile.save
@current_user.person.instance_variable_set(:@first_name, nil)
welcome_text.should == "Welcome!"
end
it 'returns "Welcome, {first_name}" if first_name is set' do
welcome_text.should == "Welcome, #{current_user.first_name}!"
end
end
end

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

View file

@ -1,21 +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.
require 'spec_helper'
describe UsersHelper do
describe '#first_name_or_username' do
before do
@user = alice
end
it 'should display the first name if it is set' do
first_name_or_username(@user).should == @user.person.profile.first_name
end
it 'should display the username if the first name is empty' do
@user.person.profile.first_name = ""
first_name_or_username(@user).should == @user.username
end
end
end

View file

@ -390,4 +390,7 @@ describe Person do
should == @person.as_json.merge(:tags => @person.profile.tags.map{|t| "##{t.name}"})
end
end
describe '.featured_users' do
end
end