diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,7 +5,6 @@ verify :method => :post, :only => [:chg_passwd], :redirect_to => { :action => :index } - in_place_edit_for :user, :full_name in_place_edit_for :user, :alias_for_editing in_place_edit_for :user, :email_for_editing diff --git a/app/models/user.rb b/app/models/user.rb --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,6 +6,7 @@ validates_presence_of :login validates_presence_of :full_name + validates_length_of :full_name, :minimum => 1 validates_presence_of :password, :if => :password_required? validates_length_of :password, :within => 4..20, :if => :password_required? @@ -29,10 +30,12 @@ end def email_for_editing - if self.email!=nil + if self.email==nil + "(unknown)" + elsif self.email=='' + "(blank)" + else self.email - else - "unknown" end end @@ -41,10 +44,12 @@ end def alias_for_editing - if self.alias!=nil + if self.alias==nil + "(unknown)" + elsif self.alias=='' + "(blank)" + else self.alias - else - "unknown" end end diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -11,7 +11,7 @@ %td.uinfo= @user.login %tr %th.uinfo Full name - %td.uinfo= in_place_editor_field :user, 'full_name', {}, :rows => 1 + %td.uinfo= @user.full_name %tr %th.uinfo Alias %td.uinfo= in_place_editor_field :user, 'alias_for_editing', {}, :rows => 1