Commit f9f6d523f5255cb01cefb7bdcdcbf24934e0836b
1 parent
3a116bc3
Exists in
master
and in
5 other branches
Field role removed from user.
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
9 changed files
with
17 additions
and
69 deletions
Show diff stats
db/migrate/20140812143218_remove_field_role_from_user.rb
0 → 100644
lib/ext/person.rb
lib/ext/user.rb
| ... | ... | @@ -5,7 +5,7 @@ class User |
| 5 | 5 | belongs_to :institution |
| 6 | 6 | |
| 7 | 7 | validate :email_different_secondary?, :email_has_already_been_used?, |
| 8 | - :secondary_email_format, :email_suffix_is_gov?, :validate_role? | |
| 8 | + :secondary_email_format, :email_suffix_is_gov? | |
| 9 | 9 | |
| 10 | 10 | scope :primary_or_secondary_email_already_used?, lambda { |email| |
| 11 | 11 | where("email=? OR secondary_email=?", email, email) |
| ... | ... | @@ -54,14 +54,4 @@ class User |
| 54 | 54 | self.errors.add(:base, _("Institution is obligatory if user has a government email.")) if primary_email_has_gov_suffix and self.institution.nil? |
| 55 | 55 | end |
| 56 | 56 | |
| 57 | - def validate_role? | |
| 58 | - valid_sufix = ['gov.br','jus.br','leg.br','mp.br'] | |
| 59 | - valid_sufix.each do |sufix| | |
| 60 | - if (self.secondary_email =~ /#{sufix}(.*)/ || self.email =~ /#{sufix}(.*)/) and self.role.blank? | |
| 61 | - errors.add(:role, _("can't be blank if e-mail has governamental sulfixes.")) | |
| 62 | - break | |
| 63 | - end | |
| 64 | - end | |
| 65 | - end | |
| 66 | - | |
| 67 | 57 | end | ... | ... |
lib/mpog_software_plugin.rb
| ... | ... | @@ -31,14 +31,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 31 | 31 | |
| 32 | 32 | content_tag(:div, |
| 33 | 33 | labelled_form_field( |
| 34 | - _('Role'), text_field(:user, :role, :id => 'role_field') + | |
| 35 | - content_tag( | |
| 36 | - :small,_('If your primary email has one of those sufix: gov.br, jus.br, leg.br or mp.br, dont forget to fill your role in the organization'),:class => 'signup-form',:id =>'role-balloon')), | |
| 37 | - :id => 'signup-role' | |
| 38 | - ) + | |
| 39 | - | |
| 40 | - content_tag(:div, | |
| 41 | - labelled_form_field( | |
| 42 | 34 | _('Areas of Interest'), |
| 43 | 35 | text_field(:profile_data, :area_interest, :id => 'area_interest_field')+ |
| 44 | 36 | content_tag( |
| ... | ... | @@ -198,7 +190,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 198 | 190 | end |
| 199 | 191 | |
| 200 | 192 | def profile_required_list |
| 201 | - required_list = ["cell_phone","contact_phone","institution","comercial_phone","country","city","state","organization_website","role","area_interest","image"] | |
| 193 | + required_list = ["cell_phone","contact_phone","institution","comercial_phone","country","city","state","organization_website","area_interest","image"] | |
| 202 | 194 | end |
| 203 | 195 | |
| 204 | 196 | def profile_required_empty_list person | ... | ... |
test/functional/account_controller_test.rb
| ... | ... | @@ -27,7 +27,6 @@ class AccountControllerTest < ActionController::TestCase |
| 27 | 27 | :password_confirmation=>"nova_senha", |
| 28 | 28 | :email=>"um@novo.usuario", |
| 29 | 29 | :secondary_email=>"outro@email.com", |
| 30 | - :role=>"um role ai", | |
| 31 | 30 | :institution_id=>@institution_list.last.id |
| 32 | 31 | } |
| 33 | 32 | |
| ... | ... | @@ -99,7 +98,6 @@ class AccountControllerTest < ActionController::TestCase |
| 99 | 98 | :password_confirmation=>"nova_senha", |
| 100 | 99 | :email=>"um@novo.usuario", |
| 101 | 100 | :secondary_email=>"outro@email.com", |
| 102 | - :role=>"um role ai", | |
| 103 | 101 | :institution_id=>@institution_list.last.id |
| 104 | 102 | } |
| 105 | 103 | |
| ... | ... | @@ -116,4 +114,4 @@ class AccountControllerTest < ActionController::TestCase |
| 116 | 114 | environment.min_signup_delay = 0 |
| 117 | 115 | environment.save! |
| 118 | 116 | end |
| 119 | -end | |
| 120 | 117 | \ No newline at end of file |
| 118 | +end | ... | ... |
test/unit/mpog_user_test.rb
| ... | ... | @@ -85,7 +85,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase |
| 85 | 85 | user = fast_create(User) |
| 86 | 86 | |
| 87 | 87 | user.email = "test@gov.br" |
| 88 | - user.role = "Developer" | |
| 89 | 88 | |
| 90 | 89 | user.institution = nil |
| 91 | 90 | assert !user.save |
| ... | ... | @@ -94,19 +93,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase |
| 94 | 93 | assert user.save |
| 95 | 94 | end |
| 96 | 95 | |
| 97 | - should 'have role if email is governmental' do | |
| 98 | - user = fast_create(User) | |
| 99 | - | |
| 100 | - user.email = "test@gov.br" | |
| 101 | - user.institution = Institution::new(:name=>"Test Other institution") | |
| 102 | - | |
| 103 | - user.role = nil | |
| 104 | - assert !user.save | |
| 105 | - | |
| 106 | - user.role = "Developer" | |
| 107 | - assert user.save | |
| 108 | - end | |
| 109 | - | |
| 110 | 96 | private |
| 111 | 97 | |
| 112 | 98 | def create_default_user | ... | ... |
test/unit/mpog_validation_test.rb
| ... | ... | @@ -18,22 +18,8 @@ class MpogSoftwarePluginValidationTest < ActiveSupport::TestCase |
| 18 | 18 | assert_kind_of Noosfero::Plugin, @plugin |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | - should 'return true when the email has gov.br,jus.br,leg.br or mp.br as sufix and role its not empty' do | |
| 22 | - @user.secondary_email = "test_email2@net.br" | |
| 23 | - @user.email = "test_email@jus.br" | |
| 24 | - @user.role = "Team" | |
| 25 | - assert @user.save | |
| 26 | - end | |
| 27 | - | |
| 28 | - should 'return false when the email has gov.br,jus.br,leg.br or mp.br as sufix and role its empty' do | |
| 29 | - @user.role = "" | |
| 30 | - @user.secondary_email = "test_email@leg.br" | |
| 31 | - @user.email = "test_email@mp.br" | |
| 32 | - assert !@user.save | |
| 33 | - end | |
| 34 | 21 | |
| 35 | 22 | should 'return true when the email has not gov.br,jus.br,leg.br or mp.br' do |
| 36 | - @user.role = "" | |
| 37 | 23 | @user.secondary_email = "test_email@com.br" |
| 38 | 24 | @user.email = "test_email@net.br" |
| 39 | 25 | assert @user.save | ... | ... |
views/person_editor_extras.html.erb
| ... | ... | @@ -7,14 +7,6 @@ |
| 7 | 7 | </div> |
| 8 | 8 | |
| 9 | 9 | <div class="formfieldline"> |
| 10 | - <%= label_tag 'user[role]', _('Your role in the organization'), :class=>"formlabel" %> | |
| 11 | - | |
| 12 | - <div class="formfield type-text"> | |
| 13 | - <%= text_field_tag 'user[role]', context.profile.user.role %> | |
| 14 | - </div> | |
| 15 | -</div> | |
| 16 | - | |
| 17 | -<div class="formfieldline"> | |
| 18 | 10 | <%= label_tag 'profile_data[area_interest]', _('Areas of Interest'), :class=>"formlabel" %> |
| 19 | 11 | |
| 20 | 12 | <div class="formfield type-text"> |
| ... | ... | @@ -34,4 +26,4 @@ jQuery(document).ready(function(){ |
| 34 | 26 | select.append("<option value='-1'><%=_('Other')%></option>"); |
| 35 | 27 | }); |
| 36 | 28 | </script> |
| 37 | -</div> | |
| 38 | 29 | \ No newline at end of file |
| 30 | +</div> | ... | ... |
views/profile/_profile_tab.html.erb
| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | </tr> |
| 5 | 5 | |
| 6 | 6 | <%= display_field(_('Secondary E-mail:'), profile, :secondary_email, true) %> |
| 7 | - <%= display_field(_('Role:'), profile, :role, true) %> | |
| 8 | 7 | <%= display_field(_('Areas of Interest:'), profile, :area_interest, true) %> |
| 9 | 8 | <%= display_field(_('Institution:'), profile, :institution, true) %> |
| 10 | 9 | </table> | ... | ... |