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
@@ -63,14 +63,6 @@ class Person | @@ -63,14 +63,6 @@ class Person | ||
63 | end | 63 | end |
64 | end | 64 | end |
65 | 65 | ||
66 | - def role | ||
67 | - self.user.role unless self.user.nil? | ||
68 | - end | ||
69 | - | ||
70 | - def role= value | ||
71 | - self.user.role = value unless self.user.nil? | ||
72 | - end | ||
73 | - | ||
74 | def software? | 66 | def software? |
75 | false | 67 | false |
76 | end | 68 | end |
lib/ext/user.rb
@@ -5,7 +5,7 @@ class User | @@ -5,7 +5,7 @@ class User | ||
5 | belongs_to :institution | 5 | belongs_to :institution |
6 | 6 | ||
7 | validate :email_different_secondary?, :email_has_already_been_used?, | 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 | scope :primary_or_secondary_email_already_used?, lambda { |email| | 10 | scope :primary_or_secondary_email_already_used?, lambda { |email| |
11 | where("email=? OR secondary_email=?", email, email) | 11 | where("email=? OR secondary_email=?", email, email) |
@@ -54,14 +54,4 @@ class User | @@ -54,14 +54,4 @@ class User | ||
54 | self.errors.add(:base, _("Institution is obligatory if user has a government email.")) if primary_email_has_gov_suffix and self.institution.nil? | 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 | end | 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 | end | 57 | end |
lib/mpog_software_plugin.rb
@@ -31,14 +31,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin | @@ -31,14 +31,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin | ||
31 | 31 | ||
32 | content_tag(:div, | 32 | content_tag(:div, |
33 | labelled_form_field( | 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 | _('Areas of Interest'), | 34 | _('Areas of Interest'), |
43 | text_field(:profile_data, :area_interest, :id => 'area_interest_field')+ | 35 | text_field(:profile_data, :area_interest, :id => 'area_interest_field')+ |
44 | content_tag( | 36 | content_tag( |
@@ -198,7 +190,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin | @@ -198,7 +190,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin | ||
198 | end | 190 | end |
199 | 191 | ||
200 | def profile_required_list | 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 | end | 194 | end |
203 | 195 | ||
204 | def profile_required_empty_list person | 196 | def profile_required_empty_list person |
test/functional/account_controller_test.rb
@@ -27,7 +27,6 @@ class AccountControllerTest < ActionController::TestCase | @@ -27,7 +27,6 @@ class AccountControllerTest < ActionController::TestCase | ||
27 | :password_confirmation=>"nova_senha", | 27 | :password_confirmation=>"nova_senha", |
28 | :email=>"um@novo.usuario", | 28 | :email=>"um@novo.usuario", |
29 | :secondary_email=>"outro@email.com", | 29 | :secondary_email=>"outro@email.com", |
30 | - :role=>"um role ai", | ||
31 | :institution_id=>@institution_list.last.id | 30 | :institution_id=>@institution_list.last.id |
32 | } | 31 | } |
33 | 32 | ||
@@ -99,7 +98,6 @@ class AccountControllerTest < ActionController::TestCase | @@ -99,7 +98,6 @@ class AccountControllerTest < ActionController::TestCase | ||
99 | :password_confirmation=>"nova_senha", | 98 | :password_confirmation=>"nova_senha", |
100 | :email=>"um@novo.usuario", | 99 | :email=>"um@novo.usuario", |
101 | :secondary_email=>"outro@email.com", | 100 | :secondary_email=>"outro@email.com", |
102 | - :role=>"um role ai", | ||
103 | :institution_id=>@institution_list.last.id | 101 | :institution_id=>@institution_list.last.id |
104 | } | 102 | } |
105 | 103 | ||
@@ -116,4 +114,4 @@ class AccountControllerTest < ActionController::TestCase | @@ -116,4 +114,4 @@ class AccountControllerTest < ActionController::TestCase | ||
116 | environment.min_signup_delay = 0 | 114 | environment.min_signup_delay = 0 |
117 | environment.save! | 115 | environment.save! |
118 | end | 116 | end |
119 | -end | ||
120 | \ No newline at end of file | 117 | \ No newline at end of file |
118 | +end |
test/unit/mpog_user_test.rb
@@ -85,7 +85,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase | @@ -85,7 +85,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase | ||
85 | user = fast_create(User) | 85 | user = fast_create(User) |
86 | 86 | ||
87 | user.email = "test@gov.br" | 87 | user.email = "test@gov.br" |
88 | - user.role = "Developer" | ||
89 | 88 | ||
90 | user.institution = nil | 89 | user.institution = nil |
91 | assert !user.save | 90 | assert !user.save |
@@ -94,19 +93,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase | @@ -94,19 +93,6 @@ class MpogSoftwarePluginUserTest < ActiveSupport::TestCase | ||
94 | assert user.save | 93 | assert user.save |
95 | end | 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 | private | 96 | private |
111 | 97 | ||
112 | def create_default_user | 98 | def create_default_user |
test/unit/mpog_validation_test.rb
@@ -18,22 +18,8 @@ class MpogSoftwarePluginValidationTest < ActiveSupport::TestCase | @@ -18,22 +18,8 @@ class MpogSoftwarePluginValidationTest < ActiveSupport::TestCase | ||
18 | assert_kind_of Noosfero::Plugin, @plugin | 18 | assert_kind_of Noosfero::Plugin, @plugin |
19 | end | 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 | should 'return true when the email has not gov.br,jus.br,leg.br or mp.br' do | 22 | should 'return true when the email has not gov.br,jus.br,leg.br or mp.br' do |
36 | - @user.role = "" | ||
37 | @user.secondary_email = "test_email@com.br" | 23 | @user.secondary_email = "test_email@com.br" |
38 | @user.email = "test_email@net.br" | 24 | @user.email = "test_email@net.br" |
39 | assert @user.save | 25 | assert @user.save |
views/person_editor_extras.html.erb
@@ -7,14 +7,6 @@ | @@ -7,14 +7,6 @@ | ||
7 | </div> | 7 | </div> |
8 | 8 | ||
9 | <div class="formfieldline"> | 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 | <%= label_tag 'profile_data[area_interest]', _('Areas of Interest'), :class=>"formlabel" %> | 10 | <%= label_tag 'profile_data[area_interest]', _('Areas of Interest'), :class=>"formlabel" %> |
19 | 11 | ||
20 | <div class="formfield type-text"> | 12 | <div class="formfield type-text"> |
@@ -34,4 +26,4 @@ jQuery(document).ready(function(){ | @@ -34,4 +26,4 @@ jQuery(document).ready(function(){ | ||
34 | select.append("<option value='-1'><%=_('Other')%></option>"); | 26 | select.append("<option value='-1'><%=_('Other')%></option>"); |
35 | }); | 27 | }); |
36 | </script> | 28 | </script> |
37 | -</div> | ||
38 | \ No newline at end of file | 29 | \ No newline at end of file |
30 | +</div> |
views/profile/_profile_tab.html.erb
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | </tr> | 4 | </tr> |
5 | 5 | ||
6 | <%= display_field(_('Secondary E-mail:'), profile, :secondary_email, true) %> | 6 | <%= display_field(_('Secondary E-mail:'), profile, :secondary_email, true) %> |
7 | - <%= display_field(_('Role:'), profile, :role, true) %> | ||
8 | <%= display_field(_('Areas of Interest:'), profile, :area_interest, true) %> | 7 | <%= display_field(_('Areas of Interest:'), profile, :area_interest, true) %> |
9 | <%= display_field(_('Institution:'), profile, :institution, true) %> | 8 | <%= display_field(_('Institution:'), profile, :institution, true) %> |
10 | </table> | 9 | </table> |