Commit b8513f028f6485da08f3773b0954147647209a86
1 parent
0ba97d30
Exists in
staging
and in
42 other branches
ActionItem833: enhancing view for person fields
Showing
3 changed files
with
23 additions
and
18 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -691,8 +691,12 @@ module ApplicationHelper |
| 691 | 691 | form_for(name, object, { :builder => NoosferoFormBuilder }.merge(options), &proc) |
| 692 | 692 | end |
| 693 | 693 | |
| 694 | - def custom_field(profile, name, field_html, options = {}) | |
| 694 | + def custom_field(profile, name, field_html = nil, options = {}, &block) | |
| 695 | 695 | result = "" |
| 696 | + if block | |
| 697 | + field_html ||= '' | |
| 698 | + field_html += capture(&block) | |
| 699 | + end | |
| 696 | 700 | if (controller.action_name == 'signup') |
| 697 | 701 | if profile.signup_fields.include?(name) |
| 698 | 702 | result = field_html |
| ... | ... | @@ -705,6 +709,11 @@ module ApplicationHelper |
| 705 | 709 | if profile.required_fields.include?(name) |
| 706 | 710 | result = required(result) |
| 707 | 711 | end |
| 712 | + | |
| 713 | + if block | |
| 714 | + concat(result, block.binding) | |
| 715 | + end | |
| 716 | + | |
| 708 | 717 | result |
| 709 | 718 | end |
| 710 | 719 | ... | ... |
app/views/account/_signup_form.rhtml
| ... | ... | @@ -21,7 +21,7 @@ in this environment.') % environment.name %> |
| 21 | 21 | <small><%= help %></small> |
| 22 | 22 | |
| 23 | 23 | <%= required f.text_field(:email, |
| 24 | - :help => help=_('We\'ll send you an e-mail to validate your registration.')) %> | |
| 24 | + :help => help=_('This e-mail address will be used to contact you about events that deserve your attention.')) %> | |
| 25 | 25 | <small><%= help %></small> |
| 26 | 26 | |
| 27 | 27 | <%= required f.password_field(:password, | ... | ... |
app/views/profile_editor/_person_form.rhtml
| 1 | 1 | <% @person ||= @profile %> |
| 2 | 2 | |
| 3 | -<%= custom_field(@person, 'nickname', f.text_field(:nickname, :maxlength => 16, :size => 30)) %> | |
| 4 | - | |
| 5 | -<% nickname_tip = "<div><small><em>" + _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') + "</em></small></div>" %> | |
| 6 | -<% if controller.action_name == 'signup' %> | |
| 7 | - <% if @person.signup_fields.include?('nickname') %> | |
| 8 | - <%= nickname_tip %> | |
| 9 | - <% end%> | |
| 10 | -<% elsif @person.active_fields.include?('nickname') %> | |
| 11 | - <%= nickname_tip %> | |
| 3 | +<% custom_field(@person, 'nickname') do %> | |
| 4 | + <%= f.text_field(:nickname, :maxlength => 16, :size => 30) %> | |
| 5 | + <div> | |
| 6 | + <small><%= _('A short name by which you like to be known. Will be used in friends listings, community member listings etc.') %></small> | |
| 7 | + </div> | |
| 12 | 8 | <% end %> |
| 13 | 9 | |
| 14 | 10 | <%= custom_field(@person, 'contact_information', f.text_field(:contact_information)) %> |
| ... | ... | @@ -24,13 +20,13 @@ |
| 24 | 20 | <%= custom_field(@person, 'country', select_country(_('Country'), 'profile_data', 'country', {:class => 'type-select'})) %> |
| 25 | 21 | <%= custom_field(@person, 'nationality', f.text_field(:nationality)) %> |
| 26 | 22 | |
| 27 | -<% if @person.active_fields.include?('schooling') %> | |
| 28 | - <% schooling_label = "<label class='formlabel' for='profile_data_schooling'>#{_('Schooling')}</label>" %> | |
| 29 | - <div class="formfieldline"><%= @person.required_fields.include?('schooling') ? required(schooling_label) : schooling_label %> | |
| 30 | - <div class="formfield type-select"> | |
| 31 | - <%= custom_field(@person, 'schooling', select_schooling('profile_data', 'schooling', {:class => 'select-schooling'})) %> | |
| 32 | - <%= custom_field(@person, 'schooling_status', select_schooling_status('profile_data', 'schooling_status', {:class => 'select-schooling'})) %> | |
| 33 | - </div> | |
| 23 | +<% custom_field(@person, 'schooling') do %> | |
| 24 | + <div class="formfieldline"> | |
| 25 | + <label class='formlabel' for='profile_data_schooling'><%= _('Schooling') %></label> | |
| 26 | + <div class="formfield type-select"> | |
| 27 | + <%= select_schooling('profile_data', 'schooling', {:class => 'select-schooling'}) %> | |
| 28 | + <%= select_schooling_status('profile_data', 'schooling_status', {:class => 'select-schooling'}) %> | |
| 29 | + </div> | |
| 34 | 30 | </div> |
| 35 | 31 | <% end %> |
| 36 | 32 | ... | ... |