Commit 807a7dc5bfc659958e9a4fe678d1e8a8b4d61bcf
1 parent
2cd58cb9
Exists in
master
and in
29 other branches
ActionItem556: show display_name instead of name
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2284 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
19 additions
and
2 deletions
Show diff stats
app/models/profile.rb
... | ... | @@ -161,6 +161,8 @@ class Profile < ActiveRecord::Base |
161 | 161 | validates_exclusion_of :identifier, :in => RESERVED_IDENTIFIERS |
162 | 162 | validates_uniqueness_of :identifier |
163 | 163 | |
164 | + validates_length_of :nickname, :maximum => 16, :allow_nil => true | |
165 | + | |
164 | 166 | before_create :set_default_environment |
165 | 167 | def set_default_environment |
166 | 168 | if self.environment.nil? |
... | ... | @@ -191,7 +193,7 @@ class Profile < ActiveRecord::Base |
191 | 193 | true |
192 | 194 | end |
193 | 195 | |
194 | - xss_terminate :only => [ :name, :address, :contact_phone ] | |
196 | + xss_terminate :only => [ :name, :nickname, :address, :contact_phone ] | |
195 | 197 | |
196 | 198 | # returns the contact email for this profile. By default returns the the |
197 | 199 | # e-mail of the owner user. |
... | ... | @@ -391,4 +393,12 @@ class Profile < ActiveRecord::Base |
391 | 393 | TinyMceArticle.new(attrs) |
392 | 394 | end |
393 | 395 | |
396 | + def display_name | |
397 | + if self[:nickname].blank? | |
398 | + self.name | |
399 | + else | |
400 | + self[:nickname] | |
401 | + end | |
402 | + end | |
403 | + | |
394 | 404 | end | ... | ... |
app/views/blocks/profile_info.rhtml
1 | 1 | <div class="vcard"> |
2 | 2 | |
3 | -<h2 class="<%= profile.class == Person ? 'fn' : 'org' %>"><%= block.owner.name %></h2> | |
3 | +<h2 class="<%= profile.class == Person ? 'fn' : 'org' %>"><%= block.owner.display_name %></h2> | |
4 | 4 | |
5 | 5 | <div class="profile-info-picture"> |
6 | 6 | <div class="profile-info-picture-inner1"> | ... | ... |
app/views/profile_editor/_organization.rhtml
1 | + <div class="formfieldline"> | |
2 | + <label class="formlabel" for="profile_data_nickname"><%= _('Display name') %></label> | |
3 | + <div class="formfield type-text"> | |
4 | + <%= text_field_tag 'profile_data[nickname]', @profile_data.nickname, :id => 'profile_data_nickname', :size => 30, :maxlength => 16 %> | |
5 | + </div> | |
6 | + </div> | |
1 | 7 | <%= f.text_field(:acronym) %> |
2 | 8 | <%= f.text_field(:foundation_year) %> |
3 | 9 | <%= f.text_field(:contact_person) %> | ... | ... |
app/views/profile_editor/_person.rhtml