diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index 51e4f2ddd..cd3530c12 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -37,7 +37,7 @@ class ProfilesController < ApplicationController
if current_user.update_profile params[:profile]
flash[:notice] = I18n.t 'profiles.update.updated'
if current_user.getting_started?
- redirect_to getting_started_path
+ redirect_to getting_started_path, :notice => flash[:notice]
else
redirect_to edit_profile_path
end
diff --git a/app/controllers/vanna_controller.rb b/app/controllers/vanna_controller.rb
index 6883b16de..ce0728fda 100644
--- a/app/controllers/vanna_controller.rb
+++ b/app/controllers/vanna_controller.rb
@@ -5,6 +5,9 @@
class VannaController < Vanna::Base
include Devise::Controllers::Helpers
include AspectGlobalHelper
+ include PeopleHelper
+ include UsersHelper
+
helper :layout
helper_method :current_user
helper_method :all_aspects
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 7aa4eb30e..12951f2fd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -21,67 +21,16 @@ module ApplicationHelper
object.attributes.keys
end
- def mine?(post)
- current_user.owns? post
- end
def type_partial(post)
class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/#{class_name}"
end
- def profile_photo(person)
- person_image_link(person, :size => :thumb_large, :to => :photos)
- end
-
- def owner_image_tag(size=nil)
- person_image_tag(current_user.person, size)
- end
-
- def owner_image_link
- person_image_link(current_user.person)
- end
-
- def person_image_tag(person, size=nil)
- size ||= :thumb_small
- "".html_safe
- end
-
- def person_link(person, opts={})
- opts[:class] ||= ""
- opts[:class] << " self" if defined?(user_signed_in?) && user_signed_in? && current_user.person == person
- remote_or_hovercard_link = "/people/#{person.id}".html_safe
- if person.local?
- "
- #{h(person.name)}
- ".html_safe
- else
- "
- #{h(person.name)}
- ".html_safe
- end
- end
-
def hard_link(string, path)
link_to string, path, :rel => 'external'
end
- def person_image_link(person, opts={})
- return "" if person.nil? || person.profile.nil?
- if opts[:to] == :photos
- link_to person_image_tag(person, opts[:size]), person_photos_path(person)
- else
- if person.local?
- "
- #{person_image_tag(person, opts[:size])}
- ".html_safe
- else
- "
- #{person_image_tag(person, opts[:size])}
- ".html_safe
- end
- end
- end
def post_yield_tag(post)
(':' + post.id.to_s).to_sym
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index 9d7a30f17..bd288fee8 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -2,7 +2,10 @@ module NotificationsHelper
include ERB::Util
include ActionView::Helpers::TranslationHelper
include ActionView::Helpers::UrlHelper
+ include PeopleHelper
+ include UsersHelper
include ApplicationHelper
+
def object_link(note, actors)
target_type = note.popup_translation_key
actors_count = note.actors.count
diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb
index b149abca8..c4b971e42 100644
--- a/app/helpers/people_helper.rb
+++ b/app/helpers/people_helper.rb
@@ -3,7 +3,7 @@
# the COPYRIGHT file.
module PeopleHelper
-
+ include ERB::Util
def request_partial single_aspect_form
if single_aspect_form
'requests/new_request_with_aspect_to_person'
@@ -27,4 +27,43 @@ module PeopleHelper
I18n.l bday, :format => I18n.t('date.formats.birthday_with_year')
end
end
+
+ def person_link(person, opts={})
+ opts[:class] ||= ""
+ opts[:class] << " self" if defined?(user_signed_in?) && user_signed_in? && current_user.person == person
+ remote_or_hovercard_link = "/people/#{person.id}".html_safe
+ if person.local?
+ "
+ #{h(person.name)}
+ ".html_safe
+ else
+ "
+ #{h(person.name)}
+ ".html_safe
+ end
+ end
+
+
+ def person_image_tag(person, size=nil)
+ size ||= :thumb_small
+ "
".html_safe
+ end
+
+ def person_image_link(person, opts={})
+ return "" if person.nil? || person.profile.nil?
+ if opts[:to] == :photos
+ link_to person_image_tag(person, opts[:size]), person_photos_path(person)
+ else
+ if person.local?
+ "
+ #{person_image_tag(person, opts[:size])}
+ ".html_safe
+ else
+ "
+ #{person_image_tag(person, opts[:size])}
+ ".html_safe
+ end
+ end
+ end
+
end
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
new file mode 100644
index 000000000..d791bf86d
--- /dev/null
+++ b/app/helpers/users_helper.rb
@@ -0,0 +1,13 @@
+module UsersHelper
+ def owner_image_tag(size=nil)
+ person_image_tag(current_user.person, size)
+ end
+
+ def owner_image_link
+ person_image_link(current_user.person)
+ end
+
+ def mine?(post)
+ current_user.owns? post
+ end
+end
diff --git a/app/models/status_message.rb b/app/models/status_message.rb
index fd460f245..58ed733bb 100644
--- a/app/models/status_message.rb
+++ b/app/models/status_message.rb
@@ -9,6 +9,7 @@ class StatusMessage < Post
include YoutubeTitles
require File.join(Rails.root, 'lib/youtube_titles')
include ActionView::Helpers::TextHelper
+ include PeopleHelper
acts_as_taggable_on :tags
extract_tags_from :raw_message
@@ -55,7 +56,7 @@ class StatusMessage < Post
if opts[:plain_text]
person ? ERB::Util.h(person.name) : ERB::Util.h($~[1])
else
- person ? "@#{ERB::Util.h(person.name)}" : ERB::Util.h($~[1])
+ person ? person_link(person, :class => 'mention hovercardable') : ERB::Util.h($~[1])
end
end
form_message
diff --git a/app/views/users/getting_started.html.haml b/app/views/users/getting_started.haml
similarity index 100%
rename from app/views/users/getting_started.html.haml
rename to app/views/users/getting_started.haml
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 66a445a3a..71f187156 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -205,4 +205,19 @@ describe UsersController do
request.flash[:notice].should be_blank
end
end
+
+ describe 'getting_started' do
+ it 'does not fail miserably' do
+ get :getting_started
+ response.should be_success
+
+ end
+
+ it 'does not fail miserably on mobile' do
+ get :getting_started, :format => :mobile
+ response.should be_success
+
+ end
+ end
end
+
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 2c393e36d..824fc044a 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
+# Copyright (c) 2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
@@ -10,56 +10,7 @@ describe ApplicationHelper do
@person = Factory.create(:person)
end
- describe "#person_image_link" do
- it "returns an empty string if person is nil" do
- person_image_link(nil).should == ""
- end
- it "returns a link containing the person's photo" do
- person_image_link(@person).should include(@person.profile.image_url)
- end
- it "returns a link to the person's profile" do
- person_image_link(@person).should include(person_path(@person))
- end
- end
-
- describe "#person_image_tag" do
- it "should not allow basic XSS/HTML" do
- @person.profile.first_name = "I'm