Commit c26c54bca2bbd1b3bc8db86a4c53fe667eb9d6e9

Authored by Antonio Terceiro
1 parent 708f1c56

ActionItem707: enhancing the profile editor

  * Making titles consistent.
  * Adding a needed zip code field
  * Explaining the nickname field
  * "Edit Profile" -> "Profile settings"
  * Better organization for the public/private table.
app/models/person.rb
... ... @@ -27,7 +27,7 @@ class Person < Profile
27 27 end
28 28  
29 29 N_('Contact information'); N_('Birth date'); N_('City'); N_('State'); N_('Country'); N_('Sex');
30   - settings_items :photo, :contact_information, :birth_date, :sex, :city, :state, :country
  30 + settings_items :photo, :contact_information, :birth_date, :sex, :city, :state, :country, :zip_code
31 31  
32 32 def self.conditions_for_profiles(conditions, person)
33 33 new_conditions = sanitize_sql(['role_assignments.accessor_id = ?', person])
... ...
app/views/profile_editor/_organization.rhtml
1   - <div class="formfieldline">
  1 +<h2><%= _('General information') %></h2>
  2 +
  3 +<div class="formfieldline">
2 4 <label class="formlabel" for="profile_data_nickname"><%= _('Display name') %></label>
3 5 <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 + <%= text_field_tag 'profile_data[nickname]', @profile_data.nickname, :id => 'profile_data_nickname', :size => 30, :maxlength => 16 %>
  7 + <em><%= _('A short name by which the organization is know.')%></em>
  8 +</div>
  9 +
6 10 </div>
7 11 <%= f.text_field(:acronym) %>
8 12 <%= f.text_field(:foundation_year) %>
... ...
app/views/profile_editor/_person.rhtml
  1 +<h2><%= _('Personal information') %></h2>
  2 +
  3 +
1 4 <%= f.text_field(:nickname, :maxlength => 16, :size => 30) %>
  5 + <div>
  6 + <small><em><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></em></small>
  7 + </div>
  8 +
  9 +
2 10 <%= f.text_field(:name) %>
3 11 <%= f.text_field(:contact_information) %>
4 12 <%= f.text_field(:contact_phone) %>
5 13 <%# use :size => 3 if you want 3 radios by line %>
6 14 <%= f.radio_group :profile_data, :sex, [ ['male',_('Male')], ['female',_('Female')] ] %>
7 15 <%= f.text_field(:birth_date) %>
8   - <%= f.text_field(:address) %>
  16 + <%= labelled_form_field(_('Address (street and number)'), text_field(:profile_data, :address)) %>
  17 + <%= labelled_form_field(_('ZIP code'), text_field(:profile_data, :zip_code)) %>
9 18 <%= f.text_field(:city) %>
10 19 <%= f.text_field(:state) %>
11 20 <%= f.text_field(:country) %>
... ...
app/views/profile_editor/edit.rhtml
1   -<h1><%= _('Edit profile') %></h1>
  1 +<h1><%= _('Profile settings') %></h1>
2 2  
3 3 <%= error_messages_for :profile %>
4 4  
5 5 <% labelled_form_for :profile_data, @profile, :html => { :multipart => true } do |f| %>
  6 +
6 7 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
7 8  
8 9 <div id="profile_change_picture">
9   - <h1><%= _('Change picture') %></h1>
  10 + <h2><%= _('Change picture') %></h2>
10 11 <% f.fields_for :image_builder, @profile.image do |i| %>
11 12 <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %>
12 13 <% end %>
13 14 </div>
14 15  
15   - <h1><%= _('Privacy options') %></h1>
  16 + <h2><%= _('Privacy options') %></h2>
16 17 <p>
17 18 <%= _('This profile is:') %>
18   - <div>
19   - <%= radio_button 'profile_data', 'public_profile', 'true' %>
20   - <%= _('Public') %>
21   - </div>
22   - <div>
23   - <%= radio_button 'profile_data', 'public_profile', 'false' %>
24   - <%= _('Private') %>
25   - </div>
26 19 </p>
27 20  
28 21 <% if profile.kind_of?(Person) %>
29 22 <table>
30   - <tr><th></th><th><%= _('Public') %></th><th><%= _('Private') %></th></tr>
  23 + <tr>
  24 + <th></th>
  25 + <th>
  26 + <%= radio_button 'profile_data', 'public_profile', 'true' %>
  27 + <label for="profile_data_public_profile_true"><u><%= _('Public') %></u></a>
  28 + </th>
  29 + <th style='padding: 2px 10px 2px 2px;'>
  30 + <%= radio_button 'profile_data', 'public_profile', 'false' %>
  31 + <label for="profile_data_public_profile_false"><u><%= _('Private') %></u></a>
  32 + </th>
  33 + </tr>
31 34 <tr>
32 35 <td> <%= _('Activate Intranet access (restricted area only for me)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td>
33 36 </tr>
... ... @@ -59,7 +62,7 @@
59 62 </table>
60 63 <% end %>
61 64  
62   - <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %>
  65 + <%= select_categories(:profile_data, _('Select the categories of your interest'), 2) %>
63 66  
64 67 <% button_bar do %>
65 68 <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %>
... ...
app/views/profile_editor/index.rhtml
... ... @@ -8,7 +8,7 @@
8 8  
9 9 <% file_manager do %>
10 10  
11   - <%= file_manager_button(_('Edit Profile'), 'icons-app/edit-profile.png', :controller => 'profile_editor', :action => 'edit') %>
  11 + <%= file_manager_button(_('Profile settings'), 'icons-app/edit-profile.png', :controller => 'profile_editor', :action => 'edit') %>
12 12  
13 13 <%= file_manager_button(_('Mail settings'), 'icons-app/mail.png', :controller => 'mailconf') if profile.person? && MailConf.enabled? %>
14 14  
... ...
public/stylesheets/common.css
... ... @@ -228,6 +228,7 @@ table {
228 228 }
229 229 th, td {
230 230 font-size: 14px;
  231 + padding: 2px 10px;
231 232 }
232 233 th {
233 234 font-weight: bold;
... ...
test/unit/person_test.rb
... ... @@ -68,7 +68,7 @@ class PersonTest &lt; Test::Unit::TestCase
68 68  
69 69 should "have person info fields" do
70 70 p = Person.new
71   - [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country ].each do |i|
  71 + [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code ].each do |i|
72 72 assert_respond_to p, i
73 73 end
74 74 end
... ...