Commit cacb978ebfc742b16ed1889ac93abd714a9a3fc4
1 parent
740b6835
Exists in
master
and in
28 other branches
ActionItem315: fixed and improved error reporting for edit infos
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1699 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
18 additions
and
4 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
@@ -11,8 +11,9 @@ class ProfileEditorController < MyProfileController | @@ -11,8 +11,9 @@ class ProfileEditorController < MyProfileController | ||
11 | # edits the profile info (posts back) | 11 | # edits the profile info (posts back) |
12 | def edit | 12 | def edit |
13 | if request.post? | 13 | if request.post? |
14 | - profile.info.update_attributes(params[:info]) | ||
15 | - redirect_to :action => 'index' | 14 | + if profile.info.update_attributes(params[:info]) |
15 | + redirect_to :action => 'index' | ||
16 | + end | ||
16 | else | 17 | else |
17 | @info = profile.info | 18 | @info = profile.info |
18 | render :action => @info.class.name.underscore | 19 | render :action => @info.class.name.underscore |
app/models/person.rb
@@ -103,4 +103,8 @@ class Person < Profile | @@ -103,4 +103,8 @@ class Person < Profile | ||
103 | before_create :set_default_environment | 103 | before_create :set_default_environment |
104 | hacked_after_create :insert_default_homepage_and_feed | 104 | hacked_after_create :insert_default_homepage_and_feed |
105 | 105 | ||
106 | + def name | ||
107 | + person_info.name || self[:name] | ||
108 | + end | ||
109 | + | ||
106 | end | 110 | end |
app/models/user.rb
@@ -106,6 +106,10 @@ class User < ActiveRecord::Base | @@ -106,6 +106,10 @@ class User < ActiveRecord::Base | ||
106 | save! unless new_record? | 106 | save! unless new_record? |
107 | end | 107 | end |
108 | 108 | ||
109 | + def name | ||
110 | + person.name | ||
111 | + end | ||
112 | + | ||
109 | protected | 113 | protected |
110 | # before filter | 114 | # before filter |
111 | def encrypt_password | 115 | def encrypt_password |
app/views/profile_editor/organization_info.rhtml
1 | +<h1> <%= _('Edit organization info') %> </h1> | ||
2 | + | ||
3 | +<%= error_messages_for :info %> | ||
1 | <% labelled_form_for :info, @info do |f| %> | 4 | <% labelled_form_for :info, @info do |f| %> |
2 | <%= f.text_field(:contact_person) %> | 5 | <%= f.text_field(:contact_person) %> |
3 | <%= f.text_field(:acronym) %> | 6 | <%= f.text_field(:acronym) %> |
app/views/profile_editor/person_info.rhtml
app/views/shared/user_menu.rhtml
@@ -8,8 +8,8 @@ | @@ -8,8 +8,8 @@ | ||
8 | <img src="<%= | 8 | <img src="<%= |
9 | (current_user.person.image)? | 9 | (current_user.person.image)? |
10 | current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png" | 10 | current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png" |
11 | - %>" alt="<%= current_user.login %> Icon-Photo" title="" height="20" border="0"/> | ||
12 | - <span><%= _("%s's Menu") % current_user.login %></span> | 11 | + %>" alt="<%= current_user.name %> Icon-Photo" title="" height="20" border="0"/> |
12 | + <span><%= _("%s's Menu") % current_user.name %></span> | ||
13 | </div> | 13 | </div> |
14 | 14 | ||
15 | <div id="user_menu_ul"> | 15 | <div id="user_menu_ul"> |