Commit 43e837c42fb80b8ec39299cf57ebe38a7643a4f2

Authored by Rodrigo Souto
Committed by Daniela Feitosa
1 parent 3c96d8b7

Displaying usp field on profile info

Showing 1 changed file with 11 additions and 8 deletions   Show diff stats
plugins/stoa/lib/stoa_plugin.rb
... ... @@ -32,14 +32,17 @@ class StoaPlugin < Noosfero::Plugin
32 32 end
33 33  
34 34 def profile_info_extra_contents
35   - lambda {
36   - content_tag('div', labelled_form_field(_('USP number'), text_field_tag('profile_data[usp_id]', '', :id => 'usp_id_field')) +
37   - content_tag(:small, _('The usp id grants you special powers in the network. Don\'t forget to fill it if you have one.')) +
38   - content_tag('div', labelled_check_box(_('Public'), '', '', false, :disabled => true, :title => _('This field must be private'), :class => 'disabled'), :class => 'field-privacy-selector'), :class => 'field-with-privacy-selector') +
39   - content_tag('div', required(labelled_form_field(_('Birth date (yyyy-mm-dd)'), text_field_tag('birth_date', ''))), :id => 'signup-birth-date', :style => 'display: none') +
40   - content_tag('div', required(labelled_form_field(_('CPF'), text_field_tag('cpf', ''))), :id => 'signup-cpf', :style => 'display:none') +
41   - javascript_include_tag('../plugins/stoa/javascripts/jquery.observe_field', '../plugins/stoa/javascripts/signup_complement')
42   - } if context.profile.person? && context.profile.usp_id.blank?
  35 + if context.profile.person?
  36 + usp_id = context.profile.usp_id
  37 + lambda {
  38 + content_tag('div', labelled_form_field(_('USP number'), text_field_tag('profile_data[usp_id]', usp_id, :id => 'usp_id_field', :disabled => usp_id.present?)) +
  39 + content_tag(:small, _('The usp id grants you special powers in the network. Don\'t forget to fill it if you have one.')) +
  40 + content_tag('div', labelled_check_box(_('Public'), '', '', false, :disabled => true, :title => _('This field must be private'), :class => 'disabled'), :class => 'field-privacy-selector'), :class => 'field-with-privacy-selector') +
  41 + content_tag('div', required(labelled_form_field(_('Birth date (yyyy-mm-dd)'), text_field_tag('birth_date', ''))), :id => 'signup-birth-date', :style => 'display: none') +
  42 + content_tag('div', required(labelled_form_field(_('CPF'), text_field_tag('cpf', ''))), :id => 'signup-cpf', :style => 'display:none') +
  43 + javascript_include_tag('../plugins/stoa/javascripts/jquery.observe_field', '../plugins/stoa/javascripts/signup_complement')
  44 + }
  45 + end
43 46 end
44 47  
45 48 def login_extra_contents
... ...