Commit 6aa4927cd270ddc5360467302f84b77b6f082dbd

Authored by Rodrigo Souto
Committed by Joenio Costa
1 parent 89c4c155

Custom fields fixed

 * Fixed fields that weren't in the custom fields options.
 * Included "Display on creation|registration" feature for
   organization fields.
 * Included fields dependencies:
     [field]   -> [dependencies]
     required  -> active, signup
     signup    -> active
 * Javascripts to grant the dependencies on the radioboxes.
 * Changing the validation of fields presence message.
 * Also removing some unwanted endline spaces.

(ActionItem1509)
app/helpers/application_helper.rb
... ... @@ -11,7 +11,7 @@ module ApplicationHelper
11 11 include BoxesHelper
12 12  
13 13 include FormsHelper
14   -
  14 +
15 15 include AssetsHelper
16 16  
17 17 include BlockHelper
... ... @@ -94,7 +94,7 @@ module ApplicationHelper
94 94 if options[:type] == :textile
95 95 content = RedCloth.new(content).to_html
96 96 end
97   -
  97 +
98 98 options[:class] = '' if ! options[:class]
99 99 options[:class] += ' button icon-help' # with-text
100 100  
... ... @@ -269,7 +269,7 @@ module ApplicationHelper
269 269 if klass.nil?
270 270 raise ArgumentError, 'No partial for object. Is there a partial for any class in the inheritance hierarchy?'
271 271 end
272   -
  272 +
273 273 name = klass.name.underscore
274 274 if File.exists?(File.join(RAILS_ROOT, 'app', 'views', params[:controller], "_#{name}.rhtml"))
275 275 name
... ... @@ -285,7 +285,7 @@ module ApplicationHelper
285 285 # DEPRECATED. Do not use this.
286 286 def stylesheet_import(*sources)
287 287 options = sources.last.is_a?(Hash) ? sources.pop : { }
288   - themed_source = options.delete(:themed_source)
  288 + themed_source = options.delete(:themed_source)
289 289 content_tag(
290 290 'style',
291 291 "\n" +
... ... @@ -299,7 +299,7 @@ module ApplicationHelper
299 299 end.join(),
300 300 { "type" => "text/css" }.merge(options)
301 301 )
302   - end
  302 + end
303 303  
304 304 # DEPRECATED. Do not use this.
305 305 def filename_for_stylesheet(name, in_theme)
... ... @@ -391,7 +391,7 @@ module ApplicationHelper
391 391 Theme.find(current_theme).owner.identifier
392 392 end
393 393  
394   - # generates a image tag for the profile.
  394 + # generates a image tag for the profile.
395 395 #
396 396 # If the profile has no image set yet, then a default image is used.
397 397 def profile_image(profile, size=:portrait, opt={})
... ... @@ -787,8 +787,9 @@ module ApplicationHelper
787 787 field_html ||= ''
788 788 field_html += capture(&block)
789 789 end
790   - if (controller.action_name == 'signup')
791   - if profile.signup_fields.include?(name) || profile.required_fields.include?(name)
  790 +
  791 + if controller.action_name == 'signup' || controller.action_name == 'new_community' || (controller.controller_name == "enterprise_registration" && controller.action_name == 'index')
  792 + if profile.signup_fields.include?(name)
792 793 result = field_html
793 794 end
794 795 else
... ... @@ -796,6 +797,7 @@ module ApplicationHelper
796 797 result = field_html
797 798 end
798 799 end
  800 +
799 801 if is_required
800 802 result = required(result)
801 803 end
... ...
app/models/community.rb
... ... @@ -23,10 +23,6 @@ class Community < Organization
23 23 xss_terminate :only => [ :name, :address, :contact_phone, :description ], :on => 'validation'
24 24  
25 25 FIELDS = %w[
26   - city
27   - state
28   - country
29   - zip_code
30 26 language
31 27 ]
32 28  
... ... @@ -38,7 +34,7 @@ class Community < Organization
38 34 super
39 35 self.required_fields.each do |field|
40 36 if self.send(field).blank?
41   - self.errors.add(field, _('%{fn} is mandatory'))
  37 + self.errors.add(field, _('%{fn} can\'t be blank'))
42 38 end
43 39 end
44 40 end
... ... @@ -51,6 +47,10 @@ class Community < Organization
51 47 environment ? environment.required_community_fields : []
52 48 end
53 49  
  50 + def signup_fields
  51 + environment ? environment.signup_community_fields : []
  52 + end
  53 +
54 54 def name=(value)
55 55 super(value)
56 56 self.identifier = value.to_slug
... ...
app/models/create_community.rb
... ... @@ -14,7 +14,7 @@ class CreateCommunity < Task
14 14  
15 15 acts_as_having_image
16 16  
17   - DATA_FIELDS = Community.fields + ['name', 'closed', 'tag_list']
  17 + DATA_FIELDS = Community.fields + ['name', 'closed']
18 18  
19 19 DATA_FIELDS.each do |field|
20 20 # getter
... ... @@ -30,7 +30,7 @@ class CreateCommunity < Task
30 30 def validate
31 31 self.environment.required_community_fields.each do |field|
32 32 if self.send(field).blank?
33   - self.errors.add(field, _('%{fn} is mandatory'))
  33 + self.errors.add(field, _('%{fn} can\'t be blank'))
34 34 end
35 35 end
36 36 end
... ...
app/models/create_enterprise.rb
... ... @@ -106,6 +106,10 @@ class CreateEnterprise < Task
106 106 environment ? environment.required_enterprise_fields : []
107 107 end
108 108  
  109 + def signup_fields
  110 + environment ? environment.signup_enterprise_fields : []
  111 + end
  112 +
109 113 def community?
110 114 false
111 115 end
... ...
app/models/enterprise.rb
... ... @@ -27,10 +27,6 @@ class Enterprise < Organization
27 27  
28 28 FIELDS = %w[
29 29 business_name
30   - zip_code
31   - city
32   - state
33   - country
34 30 organization_website
35 31 historic_and_current_context
36 32 activities_short_description
... ... @@ -59,6 +55,10 @@ class Enterprise < Organization
59 55 environment ? environment.required_enterprise_fields : []
60 56 end
61 57  
  58 + def signup_fields
  59 + environment ? environment.signup_enterprise_fields : []
  60 + end
  61 +
62 62 def product_categories
63 63 products.map{|p| p.category_full_name}.compact
64 64 end
... ...
app/models/environment.rb
... ... @@ -238,7 +238,7 @@ class Environment < ActiveRecord::Base
238 238 def activation_blocked_text
239 239 self.settings['activation_blocked_text']
240 240 end
241   -
  241 +
242 242 def activation_blocked_text= value
243 243 self.settings['activation_blocked_text'] = value
244 244 end
... ... @@ -327,14 +327,25 @@ class Environment < ActiveRecord::Base
327 327 if values['schooling'] && values['schooling']['active'] == 'true'
328 328 schooling_status = values['schooling']
329 329 end
  330 +
330 331 self.settings[:custom_person_fields] = values.delete_if { |key, value| ! Person.fields.include?(key)}
  332 + self.settings[:custom_person_fields].each_pair do |key, value|
  333 + if value['required'] == 'true'
  334 + self.settings[:custom_person_fields][key]['active'] = 'true'
  335 + self.settings[:custom_person_fields][key]['signup'] = 'true'
  336 + end
  337 + if value['signup'] == 'true'
  338 + self.settings[:custom_person_fields][key]['active'] = 'true'
  339 + end
  340 + end
  341 +
331 342 if schooling_status
332 343 self.settings[:custom_person_fields]['schooling_status'] = schooling_status
333 344 end
334 345 end
335 346  
336 347 def custom_person_field(field, status)
337   - if (custom_person_fields[field] && custom_person_fields[field][status] == 'true')
  348 + if (custom_person_fields[field] && custom_person_fields[field][status] == 'true')
338 349 return true
339 350 end
340 351 false
... ... @@ -390,10 +401,19 @@ class Environment < ActiveRecord::Base
390 401  
391 402 def custom_enterprise_fields=(values)
392 403 self.settings[:custom_enterprise_fields] = values.delete_if { |key, value| ! Enterprise.fields.include?(key)}
  404 + self.settings[:custom_enterprise_fields].each_pair do |key, value|
  405 + if value['required'] == 'true'
  406 + self.settings[:custom_enterprise_fields][key]['active'] = 'true'
  407 + self.settings[:custom_enterprise_fields][key]['signup'] = 'true'
  408 + end
  409 + if value['signup'] == 'true'
  410 + self.settings[:custom_enterprise_fields][key]['active'] = 'true'
  411 + end
  412 + end
393 413 end
394 414  
395 415 def custom_enterprise_field(field, status)
396   - if (custom_enterprise_fields[field] && custom_enterprise_fields[field][status] == 'true')
  416 + if (custom_enterprise_fields[field] && custom_enterprise_fields[field][status] == 'true')
397 417 return true
398 418 end
399 419 false
... ... @@ -411,16 +431,32 @@ class Environment < ActiveRecord::Base
411 431 required_fields
412 432 end
413 433  
  434 + def signup_enterprise_fields
  435 + signup_fields = []
  436 + active_enterprise_fields.each do |field|
  437 + signup_fields << field if custom_enterprise_fields[field]['signup'] == 'true'
  438 + end
  439 + signup_fields
  440 + end
  441 +
414 442 def custom_community_fields
415 443 self.settings[:custom_community_fields].nil? ? {} : self.settings[:custom_community_fields]
416 444 end
417   -
418 445 def custom_community_fields=(values)
419 446 self.settings[:custom_community_fields] = values.delete_if { |key, value| ! Community.fields.include?(key) }
  447 + self.settings[:custom_community_fields].each_pair do |key, value|
  448 + if value['required'] == 'true'
  449 + self.settings[:custom_community_fields][key]['active'] = 'true'
  450 + self.settings[:custom_community_fields][key]['signup'] = 'true'
  451 + end
  452 + if value['signup'] == 'true'
  453 + self.settings[:custom_community_fields][key]['active'] = 'true'
  454 + end
  455 + end
420 456 end
421 457  
422 458 def custom_community_field(field, status)
423   - if (custom_community_fields[field] && custom_community_fields[field][status] == 'true')
  459 + if (custom_community_fields[field] && custom_community_fields[field][status] == 'true')
424 460 return true
425 461 end
426 462 false
... ... @@ -438,6 +474,14 @@ class Environment &lt; ActiveRecord::Base
438 474 required_fields
439 475 end
440 476  
  477 + def signup_community_fields
  478 + signup_fields = []
  479 + active_community_fields.each do |field|
  480 + signup_fields << field if custom_community_fields[field]['signup'] == 'true'
  481 + end
  482 + signup_fields
  483 + end
  484 +
441 485 def category_types
442 486 self.settings[:category_types].nil? ? ['Category'] : self.settings[:category_types]
443 487 end
... ... @@ -483,7 +527,7 @@ class Environment &lt; ActiveRecord::Base
483 527 self.find(:first, :conditions => [ 'is_default = ?', true ] )
484 528 end
485 529  
486   - # returns an array with the top level categories for this environment.
  530 + # returns an array with the top level categories for this environment.
487 531 def top_level_categories
488 532 Category.top_level_for(self)
489 533 end
... ... @@ -527,7 +571,7 @@ class Environment &lt; ActiveRecord::Base
527 571 self.articles.recent(limit)
528 572 end
529 573  
530   - has_many :events, :through => :profiles, :source => :articles, :class_name => 'Event'
  574 + has_many :events, :through => :profiles, :source => :articles, :class_name => 'Event'
531 575  
532 576 has_many :tags, :through => :articles
533 577  
... ... @@ -578,7 +622,7 @@ class Environment &lt; ActiveRecord::Base
578 622 def community_template=(value)
579 623 settings[:community_template_id] = value.id
580 624 end
581   -
  625 +
582 626 def person_template
583 627 Person.find_by_id settings[:person_template_id]
584 628 end
... ...
app/models/organization.rb
... ... @@ -48,14 +48,20 @@ class Organization &lt; Profile
48 48 end
49 49  
50 50 FIELDS = %w[
  51 + display_name
  52 + description
51 53 contact_person
52   - contact_phone
53 54 contact_email
54   - description
  55 + contact_phone
55 56 legal_form
56 57 economic_activity
57 58 management_information
58 59 address
  60 + zip_code
  61 + city
  62 + state
  63 + country
  64 + tag_list
59 65 ]
60 66  
61 67 def self.fields
... ... @@ -70,8 +76,12 @@ class Organization &lt; Profile
70 76 []
71 77 end
72 78  
73   - N_('Contact person'); N_('Contact email'); N_('Acronym'); N_('Foundation year'); N_('Legal form'); N_('Economic activity'); N_('Management information'); N_('Validated')
74   - settings_items :contact_person, :contact_email, :acronym, :foundation_year, :legal_form, :economic_activity, :management_information, :validated, :cnpj
  79 + def signup_fields
  80 + []
  81 + end
  82 +
  83 + N_('Display name'); N_('Description'); N_('Contact person'); N_('Contact email'); N_('Acronym'); N_('Foundation year'); N_('Legal form'); N_('Economic activity'); N_('Management information'); N_('Validated'); N_('Tag list')
  84 + settings_items :display_name, :description, :contact_person, :contact_email, :acronym, :foundation_year, :legal_form, :economic_activity, :management_information, :validated, :cnpj
75 85  
76 86 validates_format_of :foundation_year, :with => Noosfero::Constants::INTEGER_FORMAT
77 87  
... ...
app/views/cms/edit.rhtml
... ... @@ -28,9 +28,6 @@
28 28  
29 29 <%= select_categories(:article, _('Categorize your article')) %>
30 30  
31   - <%= f.text_field('tag_list', :size => 64) %>
32   - <%= content_tag( 'small', _('Separate tags with commas') ) %>
33   -
34 31 <div id='edit-article-options'>
35 32 <%= options_for_article(@article) %>
36 33 </div>
... ...
app/views/enterprise_registration/basic_information.rhtml
... ... @@ -20,8 +20,8 @@
20 20  
21 21 <% labelled_form_for(:create_enterprise, @create_enterprise) do |f| %>
22 22 <%= required f.text_field 'name', :onchange => "updateUrlField(this, 'create_enterprise_identifier')", :size => 40 %>
23   - <%= required labelled_form_field(_('Address'), content_tag('code', environment.top_url + "/" + text_field(:create_enterprise, 'identifier', :size => 25))) %>
24   - <%= render :partial => 'shared/custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise, :only_required => false } %>
  23 + <%= required labelled_form_field(_('Address'), content_tag('code', environment.top_url + "/" + text_field(:create_enterprise, 'identifier', :size => 26))) %>
  24 + <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => :create_enterprise, :profile => @create_enterprise } %>
25 25 <%= required labelled_form_field(_('Region'), f.select('region_id', @regions)) if @validation == :region %>
26 26  
27 27 <% if @validation == :admin %>
... ...
app/views/features/_manage_community_fields.rhtml
... ... @@ -7,18 +7,25 @@
7 7 <th><%= _('Field') %></th>
8 8 <th><%= _('Active') %></th>
9 9 <th><%= _('Required') %></th>
  10 + <th><%= _('Display on creation?') %></th>
10 11 </tr>
11 12 <% @community_fields.each do |field| %>
12 13 <tr>
13 14 <td><label for="community_fields[<%= field %>][active]"><%= _(field.humanize) %></label></td>
  15 +
14 16 <td>
15   - <%= check_box_tag "community_fields[#{field}][active]", true, environment.custom_community_field(field, 'active'), :onclick => "$('community_fields[#{field}][required]').disabled=!this.checked" %>
  17 + <%= check_box_tag "community_fields[#{field}][active]", true, environment.custom_community_field(field, 'active'), :onclick => "$('community_fields[#{field}][required]').disabled=$('community_fields[#{field}][signup]').disabled=!this.checked;" %>
16 18 <%= hidden_field_tag "community_fields[#{field}][active]", false %>
17 19 </td>
18 20 <td>
19   - <%= check_box_tag "community_fields[#{field}][required]", true, environment.custom_community_field(field, 'required') %>
  21 + <%= check_box_tag "community_fields[#{field}][required]", true, environment.custom_community_field(field, 'required'), :onclick => "if(this.checked) $('community_fields[#{field}][signup]').checked = true;" %>
20 22 <%= hidden_field_tag "community_fields[#{field}][required]", false %>
21 23 </td>
  24 + <td>
  25 + <%= check_box_tag "community_fields[#{field}][signup]", true, environment.custom_community_field(field, 'signup'), :onclick => "if(!this.checked) $('community_fields[#{field}][required]').checked = false;" %>
  26 + <%= hidden_field_tag "community_fields[#{field}][signup]", false %>
  27 + </td>
  28 +
22 29 </tr>
23 30 <% end %>
24 31 </table>
... ...
app/views/features/_manage_enterprise_fields.rhtml
... ... @@ -7,18 +7,25 @@
7 7 <th><%= _('Field') %></th>
8 8 <th><%= _('Active') %></th>
9 9 <th><%= _('Required') %></th>
  10 + <th><%= _('Display on registration?') %></th>
10 11 </tr>
11 12 <% @enterprise_fields.each do |field| %>
12 13 <tr>
  14 +
13 15 <td><label for="enterprise_fields[<%= field %>][active]"><%= _(field.humanize) %></label></td>
14 16 <td>
15   - <%= check_box_tag "enterprise_fields[#{field}][active]", true, environment.custom_enterprise_field(field, 'active'), :onclick => "$('enterprise_fields[#{field}][required]').disabled=!this.checked" %>
  17 + <%= check_box_tag "enterprise_fields[#{field}][active]", true, environment.custom_enterprise_field(field, 'active'), :onclick => "$('enterprise_fields[#{field}][required]').disabled=$('enterprise_fields[#{field}][signup]').disabled=!this.checked;" %>
16 18 <%= hidden_field_tag "enterprise_fields[#{field}][active]", false %>
17 19 </td>
18 20 <td>
19   - <%= check_box_tag "enterprise_fields[#{field}][required]", true, environment.custom_enterprise_field(field, 'required') %>
  21 + <%= check_box_tag "enterprise_fields[#{field}][required]", true, environment.custom_enterprise_field(field, 'required'), :onclick => "if(this.checked) $('enterprise_fields[#{field}][signup]').checked = true;" %>
20 22 <%= hidden_field_tag "enterprise_fields[#{field}][required]", false %>
21 23 </td>
  24 + <td>
  25 + <%= check_box_tag "enterprise_fields[#{field}][signup]", true, environment.custom_enterprise_field(field, 'signup'), :onclick => "if(!this.checked) $('enterprise_fields[#{field}][required]').checked = false;" %>
  26 + <%= hidden_field_tag "enterprise_fields[#{field}][signup]", false %>
  27 + </td>
  28 +
22 29 </tr>
23 30 <% end %>
24 31 </table>
... ...
app/views/features/_manage_person_fields.rhtml
... ... @@ -13,15 +13,15 @@
13 13 <tr>
14 14 <td><label for="person_fields[<%= field %>][active]"><%= _(field.humanize) %></label></td>
15 15 <td>
16   - <%= check_box_tag "person_fields[#{field}][active]", true, environment.custom_person_field(field, 'active'), :onclick => "$('person_fields[#{field}][required]').disabled=$('person_fields[#{field}][signup]').disabled=!this.checked" %>
  16 + <%= check_box_tag "person_fields[#{field}][active]", true, environment.custom_person_field(field, 'active'), :onclick => "$('person_fields[#{field}][required]').disabled=$('person_fields[#{field}][signup]').disabled=!this.checked;" %>
17 17 <%= hidden_field_tag "person_fields[#{field}][active]", false %>
18 18 </td>
19 19 <td>
20   - <%= check_box_tag "person_fields[#{field}][required]", true, environment.custom_person_field(field, 'required') %>
  20 + <%= check_box_tag "person_fields[#{field}][required]", true, environment.custom_person_field(field, 'required'), :onclick => "if(this.checked) $('person_fields[#{field}][signup]').checked = true;" %>
21 21 <%= hidden_field_tag "person_fields[#{field}][required]", false %>
22 22 </td>
23 23 <td>
24   - <%= check_box_tag "person_fields[#{field}][signup]", true, environment.custom_person_field(field, 'signup') %>
  24 + <%= check_box_tag "person_fields[#{field}][signup]", true, environment.custom_person_field(field, 'signup'), :onclick => "if(!this.checked) $('person_fields[#{field}][required]').checked = false;" %>
25 25 <%= hidden_field_tag "person_fields[#{field}][signup]", false %>
26 26 </td>
27 27 </tr>
... ...
app/views/memberships/new_community.rhtml
... ... @@ -22,10 +22,7 @@
22 22  
23 23 <%= hidden_field_tag :wizard, params[:wizard] %>
24 24  
25   - <%= render :partial => 'shared/custom_fields', :locals => { :f => f, :object_name => 'community', :profile => @community, :only_required => true } %>
26   -
27   - <%= f.text_field('tag_list', :size => 64) %>
28   - <%= content_tag( 'small', _('Separate tags with commas.') + '<br/>' + __("Tags are important to new users, they'll be able to find your new community more easily.") ) %>
  25 + <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'community', :profile => @community } %>
29 26  
30 27 <% f.fields_for :image_builder, @community.image do |i| %>
31 28 <%= file_field_or_thumbnail(_('Image:'), @community.image, i) %>
... ...
app/views/profile_editor/_organization.rhtml
... ... @@ -14,14 +14,6 @@
14 14 </script>
15 15 <% end %>
16 16  
17   -<div class="formfieldline">
18   - <label class="formlabel" for="profile_data_nickname"><%= _('Display name') %></label>
19   - <div class="formfield type-text">
20   - <%= text_field_tag 'profile_data[nickname]', @profile_data.nickname, :id => 'profile_data_nickname', :size => 30, :maxlength => 16, :onchange => (@environment.enabled?('enable_organization_url_change') ? "updateUrlField(this, 'profile_data_identifier')" : "") %>
21   - <em><%= _('A short name by which the organization is know.')%></em>
22   - </div>
23   -</div>
24   -
25 17 <% if @environment.enabled?('enable_organization_url_change') %>
26 18 <script type="text/javascript">
27 19 function submit_button() {
... ... @@ -45,7 +37,7 @@
45 37  
46 38 <%= hidden_field_tag 'old_profile_identifier', @profile.identifier %>
47 39 <div id="profile-identifier-formitem">
48   - <%= labelled_form_field( _('Address'),
  40 + <%= required labelled_form_field( _('Address'),
49 41 content_tag('code',
50 42 url_for(profile.url).gsub(/#{profile.identifier}$/, '') +
51 43 text_field(:profile_data, :identifier, :onchange => "warn_value_change()", :size => 25)
... ... @@ -66,7 +58,7 @@
66 58 </div>
67 59 <% end %>
68 60  
69   - <%= render :partial => 'shared/custom_fields', :locals => { :f => f, :object_name => 'profile_data', :profile => @profile, :only_required => false } %>
  61 + <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'profile_data', :profile => @profile } %>
70 62  
71 63 <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %>
72 64  
... ...
app/views/shared/_custom_fields.rhtml
... ... @@ -1,25 +0,0 @@
1   -<% if profile.community? %>
2   - <%= optional_field(profile, 'language', f.text_field(:language), only_required) %>
3   -<% end %>
4   -
5   -<%= optional_field(profile, 'description', f.text_area(:description, :rows => 5)) %> <!-- , :maxlength => 10 -->
6   -<%= optional_field(profile, 'contact_person', f.text_field(:contact_person), only_required) %>
7   -<%= optional_field(profile, 'contact_email', f.text_field(:contact_email), only_required) %>
8   -<%= optional_field(profile, 'contact_phone', f.text_field(:contact_phone), only_required) %>
9   -<%= optional_field(profile, 'legal_form', f.text_field(:legal_form), only_required) %>
10   -<%= optional_field(profile, 'economic_activity', f.text_field(:economic_activity), only_required) %>
11   -<%= optional_field(profile, 'management_information', f.text_area(:management_information, :rows => 5), only_required) %>
12   -<%= optional_field(profile, 'address', labelled_form_field(_('Address (street and number)'), text_field(object_name, :address)), only_required) %>
13   -
14   -<% if profile.enterprise? %>
15   - <%= optional_field(profile, 'business_name', f.text_field(:business_name), only_required) %>
16   - <%= optional_field(profile, 'zip_code', labelled_form_field(_('ZIP code'), text_field(object_name, :zip_code)), only_required) %>
17   - <%= optional_field(profile, 'city', f.text_field(:city), only_required) %>
18   - <%= optional_field(profile, 'state', f.text_field(:state), only_required) %>
19   - <%= optional_field(profile, 'country', select_country(_('Country'), object_name, 'country', {:class => 'type-select'}), only_required) %>
20   - <%= optional_field(profile, 'organization_website', f.text_field(:organization_website), only_required) %>
21   - <%= optional_field(profile, 'historic_and_current_context', f.text_area(:historic_and_current_context, :rows => 5), only_required) %>
22   - <%= optional_field(profile, 'activities_short_description', f.text_area(:activities_short_description, :rows => 5), only_required) %>
23   - <%= optional_field(profile, 'acronym', f.text_field(:acronym), only_required) %>
24   - <%= optional_field(profile, 'foundation_year', f.text_field(:foundation_year), only_required) %>
25   -<% end %>
app/views/shared/_organization_custom_fields.rhtml 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +<%= optional_field(profile, 'display_name', f.text_field(:display_name)) %>
  2 +<%= optional_field(profile, 'description', f.text_area(:description, :rows => 5)) %> <!-- , :maxlength => 10 -->
  3 +<%= optional_field(profile, 'contact_person', f.text_field(:contact_person)) %>
  4 +<%= optional_field(profile, 'contact_email', f.text_field(:contact_email)) %>
  5 +<%= optional_field(profile, 'contact_phone', f.text_field(:contact_phone)) %>
  6 +<%= optional_field(profile, 'legal_form', f.text_field(:legal_form)) %>
  7 +<%= optional_field(profile, 'economic_activity', f.text_field(:economic_activity)) %>
  8 +<%= optional_field(profile, 'management_information', f.text_area(:management_information, :rows => 5)) %>
  9 +<%= optional_field(profile, 'address', labelled_form_field(_('Address (street and number)'), text_field(object_name, :address))) %>
  10 +<%= optional_field(profile, 'zip_code', labelled_form_field(_('ZIP code'), text_field(object_name, :zip_code))) %>
  11 +<%= optional_field(profile, 'city', f.text_field(:city)) %>
  12 +<%= optional_field(profile, 'state', f.text_field(:state)) %>
  13 +<%= optional_field(profile, 'country', select_country(_('Country'), object_name, 'country', {:class => 'type-select'})) %>
  14 +<%= optional_field(profile, 'tag_list', f.text_field(:tag_list)) %>
  15 +
  16 +<% if profile.community? %>
  17 + <%= optional_field(profile, 'language', f.text_field(:language)) %>
  18 +<% end %>
  19 +
  20 +<% if profile.enterprise? %>
  21 + <%= optional_field(profile, 'business_name', f.text_field(:business_name)) %>
  22 + <%= optional_field(profile, 'organization_website', f.text_field(:organization_website)) %>
  23 + <%= optional_field(profile, 'historic_and_current_context', f.text_area(:historic_and_current_context, :rows => 5)) %>
  24 + <%= optional_field(profile, 'activities_short_description', f.text_area(:activities_short_description, :rows => 5)) %>
  25 + <%= optional_field(profile, 'acronym', f.text_field(:acronym)) %>
  26 + <%= optional_field(profile, 'foundation_year', f.text_field(:foundation_year)) %>
  27 +<% end %>
... ...
features/location.feature
... ... @@ -10,7 +10,7 @@ Feature: Location
10 10 And I am logged in as "zezinho"
11 11  
12 12 Scenario: editing my address
13   - Given the following Person fields are active
  13 + Given the following Person fields are active fields
14 14 | address |
15 15 | country |
16 16 | state |
... ... @@ -29,7 +29,7 @@ Feature: Location
29 29 | Rua Marechal Floriano, 28 | BR | Bahia | Salvador | 40110010 |
30 30  
31 31 Scenario Outline: editing address of collectives
32   - Given the following <class> fields are active
  32 + Given the following <class> fields are active fields
33 33 | address |
34 34 | country |
35 35 | state |
... ...
features/organization_custom_fields.feature 0 → 100644
... ... @@ -0,0 +1,101 @@
  1 +Feature: organization custom fields
  2 + As a noosfero admin
  3 + I want to choose what fields are active or required for organizations
  4 + In order to have more consistency in the system
  5 +
  6 + Background:
  7 + Given the following users
  8 + | login | name |
  9 + | joaosilva | Joao Silva |
  10 + And I am logged in as "joaosilva"
  11 + And feature "enterprise_registration" is enabled on environment
  12 + And I follow "Control panel"
  13 +
  14 + Scenario Outline: organization active fields are not displayed on creation
  15 + Given the following <organization> fields are active fields
  16 + | display_name |
  17 + | contact_email |
  18 + | city |
  19 + And I follow "Manage my groups"
  20 + When I follow <creation_button>
  21 + Then I should not see "Display name"
  22 + Then I should not see "Contact email"
  23 + Then I should not see "City"
  24 + Examples:
  25 + | organization | creation_button |
  26 + | community | "Create a new community" |
  27 + | enterprise | "Register a new enterprise" |
  28 +
  29 + Scenario Outline: organization active fields are displayed on edition
  30 + Given the following <organization> fields are active fields
  31 + | display_name |
  32 + | contact_email |
  33 + | city |
  34 + And the following <organization>
  35 + | name | identifier |
  36 + | Organization | organization |
  37 + And "Joao Silva" is admin of "Organization"
  38 + And I am on Organization's control panel
  39 + And I follow <information>
  40 + Then I should see "Display name"
  41 + Then I should see "Contact email"
  42 + Then I should see "City"
  43 + Examples:
  44 + | organization | information |
  45 + | community | "Community Info and settings" |
  46 + | enterprise | "Enterprise Info and settings" |
  47 +
  48 + Scenario Outline: organization required fields are displayed on creation
  49 + Given the following <organization> fields are required fields
  50 + | display_name |
  51 + | contact_email |
  52 + | city |
  53 + And I follow "Manage my groups"
  54 + And I follow <creation_button>
  55 + When I press <confirmation_button>
  56 + Then I should see "Display name can't be blank"
  57 + Then I should see "Contact email can't be blank"
  58 + Then I should see "City can't be blank"
  59 + Examples:
  60 + | organization | creation_button | confirmation_button |
  61 + | community | "Create a new community" | "Create" |
  62 + | enterprise | "Register a new enterprise" | "Next" |
  63 +
  64 + Scenario Outline: organization required fields are displayed on edition
  65 + Given the following <organization> fields are required fields
  66 + | display_name |
  67 + | contact_email |
  68 + | city |
  69 + And the following <organization>
  70 + | name | identifier | display_name | contact_email | city |
  71 + | Organization | organization | organization | bla@bleee.com | city |
  72 + And "Joao Silva" is admin of "Organization"
  73 + And I am on Organization's control panel
  74 + And I follow <information>
  75 + And I fill in the following:
  76 + | Display name | |
  77 + | Contact email | |
  78 + | City | |
  79 + When I press "Save"
  80 + Then I should see "Display name can't be blank"
  81 + Then I should see "Contact email can't be blank"
  82 + Then I should see "City can't be blank"
  83 + Examples:
  84 + | organization | information |
  85 + | community | "Community Info and settings" |
  86 + | enterprise | "Enterprise Info and settings" |
  87 +
  88 + Scenario Outline: organization signup fields are displayed on creation
  89 + Given the following <organization> fields are signup fields
  90 + | display_name |
  91 + | contact_email |
  92 + | city |
  93 + And I follow "Manage my groups"
  94 + When I follow <creation_button>
  95 + Then I should see "Display name"
  96 + Then I should see "Contact email"
  97 + Then I should see "City"
  98 + Examples:
  99 + | organization | creation_button |
  100 + | community | "Create a new community" |
  101 + | enterprise | "Register a new enterprise" |
... ...
features/register_enterprise.feature
... ... @@ -44,8 +44,8 @@ Feature: register enterprise
44 44 When I follow "Register a new enterprise"
45 45 Then I should see "There are no validators to validate the registration of this new enterprise. Contact your administrator for instructions."
46 46  
47   - Scenario: some active fields
48   - Given the following enterprise fields are active
  47 + Scenario: some signup fields
  48 + Given the following enterprise fields are signup fields
49 49 | foundation_year |
50 50 | contact_person |
51 51 | contact_email |
... ... @@ -61,7 +61,7 @@ Feature: register enterprise
61 61 And the following states
62 62 | name |
63 63 | Sample State |
64   - And the following enterprise fields are required
  64 + And the following enterprise fields are required fields
65 65 | foundation_year |
66 66 | contact_person |
67 67 | contact_email |
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -144,18 +144,21 @@ Given /^&quot;([^\&quot;]*)&quot; has no articles$/ do |profile|
144 144 (Profile[profile] || Profile.find_by_name(profile)).articles.delete_all
145 145 end
146 146  
147   -Given /^the following (\w+) fields are (\w+)$/ do |klass, status, table|
  147 +Given /^the following (\w+) fields are (\w+) fields$/ do |klass, status, table|
148 148 env = Environment.default
149 149 fields = table.raw.inject({}) do |hash, line|
150   - hash[line.first] = { "active" => 'true' }
151   - hash[line.first].merge!({ "required" => 'true'}) if status == "required"
  150 + hash[line.first] = {}
  151 + hash[line.first].merge!({ "active" => 'true' }) if status == "active"
  152 + hash[line.first].merge!({ "required" => 'true'}) if status == "required"
  153 + hash[line.first].merge!({ "signup" => 'true'}) if status == "signup"
152 154 hash
153 155 end
154 156  
155 157 env.send("custom_#{klass.downcase}_fields=", fields)
156 158 env.save!
  159 +
157 160 if fields.keys != env.send("#{status}_#{klass.downcase}_fields")
158   - raise "Not all fields #{status}! Requested: %s; #{status.camelcase}: %s" % [fields.keys.inspect, env.send("#{status}_#{klass.downcase}_fields").inspect]
  161 + raise "Not all fields #{status}! Requested: %s; #{status.camelcase}: %s" % [fields.keys.inspect, env.send("#{status}_#{klass.downcase}_fields").inspect]
159 162 end
160 163 end
161 164  
... ...
test/unit/application_helper_test.rb
... ... @@ -269,7 +269,7 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
269 269 assert_equal '', profile_sex_icon(Person.new(:sex => 'male'))
270 270 end
271 271  
272   - should 'display field on signup' do
  272 + should 'display field on person signup' do
273 273 env = Environment.create!(:name => 'env test')
274 274 stubs(:environment).returns(env)
275 275  
... ... @@ -277,9 +277,36 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
277 277 stubs(:controller).returns(controller)
278 278 controller.expects(:action_name).returns('signup')
279 279  
280   - profile = Person.new
281   - profile.expects(:signup_fields).returns(['field'])
282   - assert_equal 'SIGNUP_FIELD', optional_field(profile, 'field', 'SIGNUP_FIELD')
  280 + person = Person.new
  281 + person.expects(:signup_fields).returns(['field'])
  282 + assert_equal 'SIGNUP_FIELD', optional_field(person, 'field', 'SIGNUP_FIELD')
  283 + end
  284 +
  285 + should 'display field on enterprise registration' do
  286 + env = Environment.create!(:name => 'env test')
  287 + stubs(:environment).returns(env)
  288 +
  289 + controller = mock
  290 + stubs(:controller).returns(controller)
  291 + controller.stubs(:controller_name).returns('enterprise_registration')
  292 + controller.stubs(:action_name).returns('index')
  293 +
  294 + enterprise = Enterprise.new
  295 + enterprise.expects(:signup_fields).returns(['field'])
  296 + assert_equal 'SIGNUP_FIELD', optional_field(enterprise, 'field', 'SIGNUP_FIELD')
  297 + end
  298 +
  299 + should 'display field on community creation' do
  300 + env = Environment.create!(:name => 'env test')
  301 + stubs(:environment).returns(env)
  302 +
  303 + controller = mock
  304 + stubs(:controller).returns(controller)
  305 + controller.stubs(:action_name).returns('new_community')
  306 +
  307 + community = Community.new
  308 + community.expects(:signup_fields).returns(['field'])
  309 + assert_equal 'SIGNUP_FIELD', optional_field(community, 'field', 'SIGNUP_FIELD')
283 310 end
284 311  
285 312 should 'not display field on signup' do
... ... @@ -290,9 +317,36 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
290 317 stubs(:controller).returns(controller)
291 318 controller.expects(:action_name).returns('signup')
292 319  
293   - profile = Person.new
294   - profile.expects(:signup_fields).returns([])
295   - assert_equal '', optional_field(profile, 'field', 'SIGNUP_FIELD')
  320 + person = Person.new
  321 + person.expects(:signup_fields).returns([])
  322 + assert_equal '', optional_field(person, 'field', 'SIGNUP_FIELD')
  323 + end
  324 +
  325 + should 'not display field on enterprise registration' do
  326 + env = Environment.create!(:name => 'env test')
  327 + stubs(:environment).returns(env)
  328 +
  329 + controller = mock
  330 + stubs(:controller).returns(controller)
  331 + controller.stubs(:controller_name).returns('enterprise_registration')
  332 + controller.stubs(:action_name).returns('index')
  333 +
  334 + enterprise = Enterprise.new
  335 + enterprise.expects(:signup_fields).returns([])
  336 + assert_equal '', optional_field(enterprise, 'field', 'SIGNUP_FIELD')
  337 + end
  338 +
  339 + should 'not display field on community creation' do
  340 + env = Environment.create!(:name => 'env test')
  341 + stubs(:environment).returns(env)
  342 +
  343 + controller = mock
  344 + stubs(:controller).returns(controller)
  345 + controller.stubs(:action_name).returns('new_community')
  346 +
  347 + community = Community.new
  348 + community.stubs(:signup_fields).returns([])
  349 + assert_equal '', optional_field(community, 'field', 'SIGNUP_FIELD')
296 350 end
297 351  
298 352 should 'display active fields' do
... ... @@ -301,7 +355,8 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
301 355  
302 356 controller = mock
303 357 stubs(:controller).returns(controller)
304   - controller.expects(:action_name).returns('edit')
  358 + controller.stubs(:controller_name).returns('')
  359 + controller.stubs(:action_name).returns('edit')
305 360  
306 361 profile = Person.new
307 362 profile.expects(:active_fields).returns(['field'])
... ... @@ -314,7 +369,8 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
314 369  
315 370 controller = mock
316 371 stubs(:controller).returns(controller)
317   - controller.expects(:action_name).returns('edit')
  372 + controller.stubs(:action_name).returns('edit')
  373 + controller.stubs(:controller_name).returns('')
318 374  
319 375 profile = Person.new
320 376 profile.expects(:active_fields).returns([])
... ... @@ -327,7 +383,8 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
327 383  
328 384 controller = mock
329 385 stubs(:controller).returns(controller)
330   - controller.expects(:action_name).returns('edit')
  386 + controller.stubs(:controller_name).returns('')
  387 + controller.stubs(:action_name).returns('edit')
331 388  
332 389 stubs(:required).with('SIGNUP_FIELD').returns('<span>SIGNUP_FIELD</span>')
333 390 profile = Person.new
... ... @@ -336,21 +393,6 @@ class ApplicationHelperTest &lt; Test::Unit::TestCase
336 393 assert_equal '<span>SIGNUP_FIELD</span>', optional_field(profile, 'field', 'SIGNUP_FIELD')
337 394 end
338 395  
339   - should 'display required fields on signup even if admin did not marked field to show up in signup' do
340   - env = Environment.create!(:name => 'env test')
341   - stubs(:environment).returns(env)
342   -
343   - controller = mock
344   - stubs(:controller).returns(controller)
345   - controller.expects(:action_name).returns('signup')
346   -
347   - stubs(:required).with('SIGNUP_FIELD').returns('<span>SIGNUP_FIELD</span>')
348   - profile = Person.new
349   - profile.stubs(:required_fields).returns(['field'])
350   - profile.stubs(:signup_fields).returns([])
351   - assert_equal '<span>SIGNUP_FIELD</span>', optional_field(profile, 'field', 'SIGNUP_FIELD')
352   - end
353   -
354 396 should 'not ask_to_join unless profile defined' do
355 397 stubs(:params).returns({})
356 398  
... ...
test/unit/environment_test.rb
... ... @@ -251,7 +251,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
251 251 assert_raise ArgumentError do
252 252 env.organization_approval_method = :lalala
253 253 end
254   -
  254 +
255 255 end
256 256  
257 257 should 'provide environment name in to_s' do
... ... @@ -371,7 +371,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
371 371  
372 372 assert_includes env.products, p1
373 373 end
374   -
  374 +
375 375 should 'not have person through communities' do
376 376 env = Environment.default
377 377 com = fast_create(Community)
... ... @@ -403,7 +403,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
403 403 end
404 404  
405 405 should 'have articles and text_articles' do
406   - # FIXME
  406 + # FIXME
407 407 assert true
408 408 #environment = Environment.create(:name => 'a test environment')
409 409  
... ... @@ -494,15 +494,15 @@ class EnvironmentTest &lt; Test::Unit::TestCase
494 494  
495 495 comm = fast_create(Community)
496 496 e.community_template = comm
497   - assert_equal comm, e.community_template
  497 + assert_equal comm, e.community_template
498 498  
499 499 person = fast_create(Person)
500 500 e.person_template = person
501   - assert_equal person, e.person_template
  501 + assert_equal person, e.person_template
502 502  
503 503 enterprise = fast_create(Enterprise)
504 504 e.enterprise_template = enterprise
505   - assert_equal enterprise, e.enterprise_template
  505 + assert_equal enterprise, e.enterprise_template
506 506 end
507 507  
508 508 should 'not enable ssl by default' do
... ... @@ -545,11 +545,11 @@ class EnvironmentTest &lt; Test::Unit::TestCase
545 545 assert_equal false, Environment.new.replace_enterprise_template_when_enable
546 546 end
547 547  
548   - should 'set custom_person_fields' do
  548 + should 'set custom_person_fields with its dependecies' do
549 549 env = Environment.new
550   - env.custom_person_fields = {'cell_phone' => {'required' => 'true', 'active' => 'true'},'comercial_phone'=> {'required' => 'true', 'active' => 'true'}}
  550 + env.custom_person_fields = {'cell_phone' => {'required' => 'true', 'active' => '', 'signup' => ''}, 'comercial_phone'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => '', 'signup' => 'true'}}
551 551  
552   - assert_equal({'cell_phone' => {'required' => 'true', 'active' => 'true'},'comercial_phone'=> {'required' => 'true', 'active' => 'true'}}, env.custom_person_fields)
  552 + assert_equal({'cell_phone' => {'required' => 'true', 'active' => 'true', 'signup' => 'true'}, 'comercial_phone'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => 'true', 'signup' => 'true'}}, env.custom_person_fields)
553 553 end
554 554  
555 555 should 'have no custom_person_fields by default' do
... ... @@ -561,7 +561,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
561 561 Person.stubs(:fields).returns(['cell_phone', 'comercial_phone'])
562 562  
563 563 env.custom_person_fields = { 'birth_date' => {'required' => 'true', 'active' => 'true'}, 'cell_phone' => {'required' => 'true', 'active' => 'true'}}
564   - assert_equal({'cell_phone' => {'required' => 'true', 'active' => 'true'}}, env.custom_person_fields)
  564 + assert_equal({'cell_phone' => {'required' => 'true','signup' => 'true', 'active' => 'true'}}, env.custom_person_fields)
565 565 assert ! env.custom_person_fields.keys.include?('birth_date')
566 566 end
567 567  
... ... @@ -570,7 +570,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
570 570 Person.stubs(:fields).returns(['cell_phone', 'schooling'])
571 571  
572 572 env.custom_person_fields = { 'schooling' => {'required' => 'true', 'active' => 'true'}}
573   - assert_equal({'schooling' => {'required' => 'true', 'active' => 'true'}, 'schooling_status' => {'required' => 'true', 'active' => 'true'}}, env.custom_person_fields)
  573 + assert_equal({'schooling' => {'required' => 'true', 'signup' => 'true', 'active' => 'true'}, 'schooling_status' => {'required' => 'true', 'signup' => 'true', 'active' => 'true'}}, env.custom_person_fields)
574 574 assert ! env.custom_person_fields.keys.include?('birth_date')
575 575 end
576 576  
... ... @@ -618,11 +618,11 @@ class EnvironmentTest &lt; Test::Unit::TestCase
618 618 end
619 619 end
620 620  
621   - should 'set custom_enterprises_fields' do
  621 + should 'set custom_enterprise_fields with its dependencies' do
622 622 env = Environment.new
623   - env.custom_enterprise_fields = {'contact_person' => {'required' => 'true', 'active' => 'true'},'contact_email'=> {'required' => 'true', 'active' => 'true'}}
  623 + env.custom_enterprise_fields = {'contact_person' => {'required' => 'true', 'active' => '', 'signup' => ''}, 'contact_email'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => '', 'signup' => 'true'}}
624 624  
625   - assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true'},'contact_email'=> {'required' => 'true', 'active' => 'true'}}, env.custom_enterprise_fields)
  625 + assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true', 'signup' => 'true'}, 'contact_email'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => 'true', 'signup' => 'true'}} , env.custom_enterprise_fields)
626 626 end
627 627  
628 628 should 'have no custom_enterprise_fields by default' do
... ... @@ -634,7 +634,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
634 634 Enterprise.stubs(:fields).returns(['contact_person', 'comercial_phone'])
635 635  
636 636 env.custom_enterprise_fields = { 'contact_email' => {'required' => 'true', 'active' => 'true'}, 'contact_person' => {'required' => 'true', 'active' => 'true'}}
637   - assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true'}}, env.custom_enterprise_fields)
  637 + assert_equal({'contact_person' => {'required' => 'true', 'signup' => 'true', 'active' => 'true'}}, env.custom_enterprise_fields)
638 638 assert ! env.custom_enterprise_fields.keys.include?('contact_email')
639 639 end
640 640  
... ... @@ -661,11 +661,11 @@ class EnvironmentTest &lt; Test::Unit::TestCase
661 661 assert_equal ['contact_email'], env.required_enterprise_fields
662 662 end
663 663  
664   - should 'set custom_communitys_fields' do
  664 + should 'set custom_community_fields with its dependencies' do
665 665 env = Environment.new
666   - env.custom_community_fields = {'contact_person' => {'required' => 'true', 'active' => 'true'},'contact_email'=> {'required' => 'true', 'active' => 'true'}}
  666 + env.custom_community_fields = {'contact_person' => {'required' => 'true', 'active' => '', 'signup' => ''}, 'contact_email'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => '', 'signup' => 'true'}}
667 667  
668   - assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true'},'contact_email'=> {'required' => 'true', 'active' => 'true'}}, env.custom_community_fields)
  668 + assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true', 'signup' => 'true'}, 'contact_email'=> {'required' => '', 'active' => 'true', 'signup' => '' }, 'description' => {'required' => '', 'active' => 'true', 'signup' => 'true'}} , env.custom_community_fields)
669 669 end
670 670  
671 671 should 'have no custom_community_fields by default' do
... ... @@ -677,7 +677,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
677 677 Community.stubs(:fields).returns(['contact_person', 'comercial_phone'])
678 678  
679 679 env.custom_community_fields = { 'contact_email' => {'required' => 'true', 'active' => 'true'}, 'contact_person' => {'required' => 'true', 'active' => 'true'}}
680   - assert_equal({'contact_person' => {'required' => 'true', 'active' => 'true'}}, env.custom_community_fields)
  680 + assert_equal({'contact_person' => {'required' => 'true', 'signup' => 'true', 'active' => 'true'}}, env.custom_community_fields)
681 681 assert ! env.custom_community_fields.keys.include?('contact_email')
682 682 end
683 683  
... ...