Commit 8df7c79dfd08060f4a9dd0670926750debb0d091

Authored by MoisesMachado
1 parent ab998a29

ActionItem114: fixed a test in the person and another in the profile models

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@807 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/profile_admin/membership_editor_controller.rb
@@ -7,7 +7,7 @@ class MembershipEditorController < ProfileAdminController @@ -7,7 +7,7 @@ class MembershipEditorController < ProfileAdminController
7 protect [:index, :new_enterprise, :create_enterprise ], 'edit_profile', :profile 7 protect [:index, :new_enterprise, :create_enterprise ], 'edit_profile', :profile
8 8
9 def index 9 def index
10 - @memberships = current_user.person.memberships 10 + @memberships = current_user.person.enterprises_memberships
11 end 11 end
12 12
13 def new_enterprise 13 def new_enterprise
app/helpers/application_helper.rb
@@ -123,7 +123,7 @@ module ApplicationHelper @@ -123,7 +123,7 @@ module ApplicationHelper
123 end 123 end
124 124
125 def about_document 125 def about_document
126 - Article.find_all_by_title(_('About')).select do |a| 126 + Article.find_all_by_slug(_('about')).select do |a|
127 a.full_path.split(/\//).shift == 'noosfero' 127 a.full_path.split(/\//).shift == 'noosfero'
128 end[0] 128 end[0]
129 end 129 end
@@ -249,7 +249,7 @@ module ApplicationHelper @@ -249,7 +249,7 @@ module ApplicationHelper
249 # end 249 # end
250 250
251 def accessibility_link 251 def accessibility_link
252 - doc = Article.find_all_by_title(_('Accessibility')).select do |a| 252 + doc = Article.find_all_by_slug(_('accessibility')).select do |a|
253 a.full_path.split(/\//).shift == 'noosfero' 253 a.full_path.split(/\//).shift == 'noosfero'
254 end[0] 254 end[0]
255 link_to_document doc, _('Accessibility') if doc 255 link_to_document doc, _('Accessibility') if doc
app/models/person.rb
@@ -26,8 +26,13 @@ class Person < Profile @@ -26,8 +26,13 @@ class Person < Profile
26 :all, 26 :all,
27 :conditions => self.class.conditions_for_profiles(conditions, self), 27 :conditions => self.class.conditions_for_profiles(conditions, self),
28 :joins => "LEFT JOIN role_assignments ON profiles.id = role_assignments.resource_id AND role_assignments.resource_type = \'#{Profile.base_class.name}\'", 28 :joins => "LEFT JOIN role_assignments ON profiles.id = role_assignments.resource_id AND role_assignments.resource_type = \'#{Profile.base_class.name}\'",
29 - :select => 'profiles.*').uniq.select{|p|p.class == Enterprise} 29 + :select => 'profiles.*').uniq
30 end 30 end
  31 +
  32 + def enterprises_memberships
  33 + memberships.select{|p|p.class == Enterprise}
  34 + end
  35 +
31 36
32 def info 37 def info
33 person_info 38 person_info
po/noosfero.pot
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 msgid "" 7 msgid ""
8 msgstr "" 8 msgstr ""
9 "Project-Id-Version: noosfero 0.3.0\n" 9 "Project-Id-Version: noosfero 0.3.0\n"
10 -"POT-Creation-Date: 2007-10-20 03:04-0300\n" 10 +"POT-Creation-Date: 2007-10-22 14:20-0300\n"
11 "PO-Revision-Date: 2007-08-30 18:47-0300\n" 11 "PO-Revision-Date: 2007-08-30 18:47-0300\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n" 13 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -82,15 +82,15 @@ msgstr &quot;&quot; @@ -82,15 +82,15 @@ msgstr &quot;&quot;
82 msgid "Could not update the enterprise" 82 msgid "Could not update the enterprise"
83 msgstr "" 83 msgstr ""
84 84
85 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:34 85 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:35
86 msgid "Enterprise sucessfully erased from the system" 86 msgid "Enterprise sucessfully erased from the system"
87 msgstr "" 87 msgstr ""
88 88
89 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:44 89 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:45
90 msgid "Enterprise successfuly activacted" 90 msgid "Enterprise successfuly activacted"
91 msgstr "" 91 msgstr ""
92 92
93 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:46 93 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:47
94 msgid "Failed to activate the enterprise" 94 msgid "Failed to activate the enterprise"
95 msgstr "" 95 msgstr ""
96 96
@@ -331,19 +331,19 @@ msgstr &quot;&quot; @@ -331,19 +331,19 @@ msgstr &quot;&quot;
331 msgid "Task|Code" 331 msgid "Task|Code"
332 msgstr "" 332 msgstr ""
333 333
334 -#: app/models/task.rb:81 334 +#: app/models/task.rb:86
335 msgid "Generic task" 335 msgid "Generic task"
336 msgstr "" 336 msgstr ""
337 337
338 -#: app/models/task.rb:88 338 +#: app/models/task.rb:93
339 msgid "The task was created at %s" 339 msgid "The task was created at %s"
340 msgstr "" 340 msgstr ""
341 341
342 -#: app/models/task.rb:94 342 +#: app/models/task.rb:99
343 msgid "The task was finished at %s" 343 msgid "The task was finished at %s"
344 msgstr "" 344 msgstr ""
345 345
346 -#: app/models/task.rb:100 346 +#: app/models/task.rb:105
347 msgid "The task was cancelled at %s" 347 msgid "The task was cancelled at %s"
348 msgstr "" 348 msgstr ""
349 349
@@ -720,10 +720,14 @@ msgstr &quot;&quot; @@ -720,10 +720,14 @@ msgstr &quot;&quot;
720 msgid "Admin" 720 msgid "Admin"
721 msgstr "" 721 msgstr ""
722 722
723 -#: app/helpers/application_helper.rb:120 app/helpers/application_helper.rb:126 723 +#: app/helpers/application_helper.rb:120
724 msgid "About" 724 msgid "About"
725 msgstr "" 725 msgstr ""
726 726
  727 +#: app/helpers/application_helper.rb:126
  728 +msgid "about"
  729 +msgstr ""
  730 +
727 #: app/helpers/application_helper.rb:144 app/views/account/login.rhtml:1 731 #: app/helpers/application_helper.rb:144 app/views/account/login.rhtml:1
728 msgid "Login" 732 msgid "Login"
729 msgstr "" 733 msgstr ""
@@ -773,10 +777,6 @@ msgstr &quot;&quot; @@ -773,10 +777,6 @@ msgstr &quot;&quot;
773 msgid "Edit informations" 777 msgid "Edit informations"
774 msgstr "" 778 msgstr ""
775 779
776 -#: app/helpers/application_helper.rb:194  
777 -msgid "Exclude"  
778 -msgstr ""  
779 -  
780 #: app/helpers/application_helper.rb:200 780 #: app/helpers/application_helper.rb:200
781 #: app/views/account/new_password.rhtml:13 781 #: app/views/account/new_password.rhtml:13
782 #: app/views/account/change_password.rhtml:1 782 #: app/views/account/change_password.rhtml:1
@@ -800,7 +800,11 @@ msgstr &quot;&quot; @@ -800,7 +800,11 @@ msgstr &quot;&quot;
800 msgid "Change icon theme" 800 msgid "Change icon theme"
801 msgstr "" 801 msgstr ""
802 802
803 -#: app/helpers/application_helper.rb:252 app/helpers/application_helper.rb:255 803 +#: app/helpers/application_helper.rb:252
  804 +msgid "accessibility"
  805 +msgstr ""
  806 +
  807 +#: app/helpers/application_helper.rb:255
804 msgid "Accessibility" 808 msgid "Accessibility"
805 msgstr "" 809 msgstr ""
806 810
@@ -1156,6 +1160,7 @@ msgid &quot;Dear %s,&quot; @@ -1156,6 +1160,7 @@ msgid &quot;Dear %s,&quot;
1156 msgstr "" 1160 msgstr ""
1157 1161
1158 #: app/views/task_mailer/task_created.text.plain.rhtml:6 1162 #: app/views/task_mailer/task_created.text.plain.rhtml:6
  1163 +#: app/views/task_mailer/target_notification.rhtml:6
1159 #: app/views/task_mailer/task_finished.text.plain.rhtml:6 1164 #: app/views/task_mailer/task_finished.text.plain.rhtml:6
1160 #: app/views/task_mailer/task_cancelled.text.plain.rhtml:6 1165 #: app/views/task_mailer/task_cancelled.text.plain.rhtml:6
1161 msgid "%s environment system" 1166 msgid "%s environment system"
po/pt_BR/noosfero.po
@@ -9,8 +9,8 @@ @@ -9,8 +9,8 @@
9 msgid "" 9 msgid ""
10 msgstr "" 10 msgstr ""
11 "Project-Id-Version: noosfero 0.3.0\n" 11 "Project-Id-Version: noosfero 0.3.0\n"
12 -"POT-Creation-Date: 2007-10-20 03:04-0300\n"  
13 -"PO-Revision-Date: 2007-10-19 21:25-0300\n" 12 +"POT-Creation-Date: 2007-10-22 14:20-0300\n"
  13 +"PO-Revision-Date: 2007-10-22 14:23-0300\n"
14 "Last-Translator: Rafael Tavares Bomfim <rafael@colivre.coop.br>\n" 14 "Last-Translator: Rafael Tavares Bomfim <rafael@colivre.coop.br>\n"
15 "Language-Team: \n" 15 "Language-Team: \n"
16 "MIME-Version: 1.0\n" 16 "MIME-Version: 1.0\n"
@@ -85,15 +85,15 @@ msgstr &quot;Esta ação não está disponível para \&quot;%s\&quot;.&quot; @@ -85,15 +85,15 @@ msgstr &quot;Esta ação não está disponível para \&quot;%s\&quot;.&quot;
85 msgid "Could not update the enterprise" 85 msgid "Could not update the enterprise"
86 msgstr "Não pôde modificar o empreendimento" 86 msgstr "Não pôde modificar o empreendimento"
87 87
88 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:34 88 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:35
89 msgid "Enterprise sucessfully erased from the system" 89 msgid "Enterprise sucessfully erased from the system"
90 msgstr "Empreendimento ativado com sucesso" 90 msgstr "Empreendimento ativado com sucesso"
91 91
92 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:44 92 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:45
93 msgid "Enterprise successfuly activacted" 93 msgid "Enterprise successfuly activacted"
94 msgstr "Empreendimento ativado com sucesso" 94 msgstr "Empreendimento ativado com sucesso"
95 95
96 -#: app/controllers/profile_admin/enterprise_editor_controller.rb:46 96 +#: app/controllers/profile_admin/enterprise_editor_controller.rb:47
97 msgid "Failed to activate the enterprise" 97 msgid "Failed to activate the enterprise"
98 msgstr "Falhou em ativar o empreendimento" 98 msgstr "Falhou em ativar o empreendimento"
99 99
@@ -340,19 +340,19 @@ msgstr &quot;Alvo&quot; @@ -340,19 +340,19 @@ msgstr &quot;Alvo&quot;
340 msgid "Task|Code" 340 msgid "Task|Code"
341 msgstr "Código" 341 msgstr "Código"
342 342
343 -#: app/models/task.rb:81 343 +#: app/models/task.rb:86
344 msgid "Generic task" 344 msgid "Generic task"
345 msgstr "Tarefa genérica" 345 msgstr "Tarefa genérica"
346 346
347 -#: app/models/task.rb:88 347 +#: app/models/task.rb:93
348 msgid "The task was created at %s" 348 msgid "The task was created at %s"
349 msgstr "A tarefa foi criada em %s" 349 msgstr "A tarefa foi criada em %s"
350 350
351 -#: app/models/task.rb:94 351 +#: app/models/task.rb:99
352 msgid "The task was finished at %s" 352 msgid "The task was finished at %s"
353 msgstr "A tarefa foi finalizada em %s" 353 msgstr "A tarefa foi finalizada em %s"
354 354
355 -#: app/models/task.rb:100 355 +#: app/models/task.rb:105
356 msgid "The task was cancelled at %s" 356 msgid "The task was cancelled at %s"
357 msgstr "A tarefa foi cancelada em %s" 357 msgstr "A tarefa foi cancelada em %s"
358 358
@@ -741,10 +741,15 @@ msgstr &quot;Meus Empreendimentos&quot; @@ -741,10 +741,15 @@ msgstr &quot;Meus Empreendimentos&quot;
741 msgid "Admin" 741 msgid "Admin"
742 msgstr "Administrador" 742 msgstr "Administrador"
743 743
744 -#: app/helpers/application_helper.rb:120 app/helpers/application_helper.rb:126 744 +#: app/helpers/application_helper.rb:120
745 msgid "About" 745 msgid "About"
746 msgstr "Sobre" 746 msgstr "Sobre"
747 747
  748 +#: app/helpers/application_helper.rb:126
  749 +#, fuzzy
  750 +msgid "about"
  751 +msgstr "sobre"
  752 +
748 #: app/helpers/application_helper.rb:144 app/views/account/login.rhtml:1 753 #: app/helpers/application_helper.rb:144 app/views/account/login.rhtml:1
749 msgid "Login" 754 msgid "Login"
750 msgstr "Entrar" 755 msgstr "Entrar"
@@ -794,10 +799,6 @@ msgstr &quot;Gerenciar conteúdo&quot; @@ -794,10 +799,6 @@ msgstr &quot;Gerenciar conteúdo&quot;
794 msgid "Edit informations" 799 msgid "Edit informations"
795 msgstr "Editar informações" 800 msgstr "Editar informações"
796 801
797 -#: app/helpers/application_helper.rb:194  
798 -msgid "Exclude"  
799 -msgstr "Excluir"  
800 -  
801 #: app/helpers/application_helper.rb:200 802 #: app/helpers/application_helper.rb:200
802 #: app/views/account/new_password.rhtml:13 803 #: app/views/account/new_password.rhtml:13
803 #: app/views/account/change_password.rhtml:1 804 #: app/views/account/change_password.rhtml:1
@@ -821,7 +822,12 @@ msgstr &quot;Mude o tema de bloco&quot; @@ -821,7 +822,12 @@ msgstr &quot;Mude o tema de bloco&quot;
821 msgid "Change icon theme" 822 msgid "Change icon theme"
822 msgstr "Mudar tema do ícone" 823 msgstr "Mudar tema do ícone"
823 824
824 -#: app/helpers/application_helper.rb:252 app/helpers/application_helper.rb:255 825 +#: app/helpers/application_helper.rb:252
  826 +#, fuzzy
  827 +msgid "accessibility"
  828 +msgstr "acessibilidade"
  829 +
  830 +#: app/helpers/application_helper.rb:255
825 msgid "Accessibility" 831 msgid "Accessibility"
826 msgstr "Acessibilidade" 832 msgstr "Acessibilidade"
827 833
@@ -1179,6 +1185,7 @@ msgid &quot;Dear %s,&quot; @@ -1179,6 +1185,7 @@ msgid &quot;Dear %s,&quot;
1179 msgstr "Caro %s," 1185 msgstr "Caro %s,"
1180 1186
1181 #: app/views/task_mailer/task_created.text.plain.rhtml:6 1187 #: app/views/task_mailer/task_created.text.plain.rhtml:6
  1188 +#: app/views/task_mailer/target_notification.rhtml:6
1182 #: app/views/task_mailer/task_finished.text.plain.rhtml:6 1189 #: app/views/task_mailer/task_finished.text.plain.rhtml:6
1183 #: app/views/task_mailer/task_cancelled.text.plain.rhtml:6 1190 #: app/views/task_mailer/task_cancelled.text.plain.rhtml:6
1184 msgid "%s environment system" 1191 msgid "%s environment system"
@@ -1865,6 +1872,9 @@ msgstr &quot;Editando %s&quot; @@ -1865,6 +1872,9 @@ msgstr &quot;Editando %s&quot;
1865 msgid "Categories" 1872 msgid "Categories"
1866 msgstr "Categorias" 1873 msgstr "Categorias"
1867 1874
  1875 +#~ msgid "Exclude"
  1876 +#~ msgstr "Excluir"
  1877 +
1868 #~ msgid "Main content block" 1878 #~ msgid "Main content block"
1869 #~ msgstr "Bloco de conteúdo principal" 1879 #~ msgstr "Bloco de conteúdo principal"
1870 1880
test/unit/profile_test.rb
@@ -80,7 +80,7 @@ class ProfileTest &lt; Test::Unit::TestCase @@ -80,7 +80,7 @@ class ProfileTest &lt; Test::Unit::TestCase
80 pr = Profile.create(:name => 'composite_profile', :identifier => 'composite') 80 pr = Profile.create(:name => 'composite_profile', :identifier => 'composite')
81 pe = User.create(:login => 'aff', :email => 'aff@pr.coop', :password => 'blih', :password_confirmation => 'blih').person 81 pe = User.create(:login => 'aff', :email => 'aff@pr.coop', :password => 'blih', :password_confirmation => 'blih').person
82 82
83 - member_role = Role.new(:name => 'member') 83 + member_role = Role.new(:name => 'new_member_role')
84 assert member_role.save 84 assert member_role.save
85 assert pr.affiliate(pe, member_role) 85 assert pr.affiliate(pe, member_role)
86 86