diff --git a/app/models/profile.rb b/app/models/profile.rb index f15586b..891e250 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -161,6 +161,8 @@ class Profile < ActiveRecord::Base validates_exclusion_of :identifier, :in => RESERVED_IDENTIFIERS validates_uniqueness_of :identifier + validates_length_of :nickname, :maximum => 16, :allow_nil => true + before_create :set_default_environment def set_default_environment if self.environment.nil? @@ -191,7 +193,7 @@ class Profile < ActiveRecord::Base true end - xss_terminate :only => [ :name, :address, :contact_phone ] + xss_terminate :only => [ :name, :nickname, :address, :contact_phone ] # returns the contact email for this profile. By default returns the the # e-mail of the owner user. @@ -391,4 +393,12 @@ class Profile < ActiveRecord::Base TinyMceArticle.new(attrs) end + def display_name + if self[:nickname].blank? + self.name + else + self[:nickname] + end + end + end diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index de0bc95..1ff4c3a 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -1,6 +1,6 @@
-

<%= block.owner.name %>

+

<%= block.owner.display_name %>

diff --git a/app/views/profile_editor/_organization.rhtml b/app/views/profile_editor/_organization.rhtml index 76cd26e..57fa906 100644 --- a/app/views/profile_editor/_organization.rhtml +++ b/app/views/profile_editor/_organization.rhtml @@ -1,3 +1,9 @@ +
+ +
+ <%= text_field_tag 'profile_data[nickname]', @profile_data.nickname, :id => 'profile_data_nickname', :size => 30, :maxlength => 16 %> +
+
<%= f.text_field(:acronym) %> <%= f.text_field(:foundation_year) %> <%= f.text_field(:contact_person) %> diff --git a/app/views/profile_editor/_person.rhtml b/app/views/profile_editor/_person.rhtml index 8d26681..5aec4f0 100644 --- a/app/views/profile_editor/_person.rhtml +++ b/app/views/profile_editor/_person.rhtml @@ -1,3 +1,4 @@ + <%= f.text_field(:nickname, :maxlength => 16, :size => 30) %> <%= f.text_field(:name) %> <%= f.text_field(:contact_information) %> <%= f.text_field(:contact_phone) %> -- libgit2 0.21.2