Commit 4dcb9b6e35bbe2e478f14a82e82af26e32ad43b2
1 parent
6c2bf00e
Exists in
master
and in
29 other branches
ActionItem942: force display of mandatory fields on signup
Showing
2 changed files
with
16 additions
and
1 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -686,7 +686,7 @@ module ApplicationHelper |
686 | 686 | field_html += capture(&block) |
687 | 687 | end |
688 | 688 | if (controller.action_name == 'signup') |
689 | - if profile.signup_fields.include?(name) | |
689 | + if profile.signup_fields.include?(name) || profile.required_fields.include?(name) | |
690 | 690 | result = field_html |
691 | 691 | end |
692 | 692 | else | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -332,6 +332,21 @@ class ApplicationHelperTest < Test::Unit::TestCase |
332 | 332 | assert_equal '<span>SIGNUP_FIELD</span>', optional_field(profile, 'field', 'SIGNUP_FIELD') |
333 | 333 | end |
334 | 334 | |
335 | + should 'display required fields on signup even if admin did not marked field to show up in signup' do | |
336 | + env = Environment.create!(:name => 'env test') | |
337 | + stubs(:environment).returns(env) | |
338 | + | |
339 | + controller = mock | |
340 | + stubs(:controller).returns(controller) | |
341 | + controller.expects(:action_name).returns('signup') | |
342 | + | |
343 | + stubs(:required).with('SIGNUP_FIELD').returns('<span>SIGNUP_FIELD</span>') | |
344 | + profile = Person.new | |
345 | + profile.stubs(:required_fields).returns(['field']) | |
346 | + profile.stubs(:signup_fields).returns([]) | |
347 | + assert_equal '<span>SIGNUP_FIELD</span>', optional_field(profile, 'field', 'SIGNUP_FIELD') | |
348 | + end | |
349 | + | |
335 | 350 | should 'not ask_to_join unless profile defined' do |
336 | 351 | e = Environment.default |
337 | 352 | e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) | ... | ... |