Commit aa66130d0ade3adfcf754c65aa7461cf5207d892
Committed by
Fabio Teixeira
1 parent
51542106
Exists in
master
and in
5 other branches
New profile page to software
Since Software is not a profile, a few adaptations were needed to print its informations.
Showing
2 changed files
with
35 additions
and
19 deletions
Show diff stats
lib/ext/profile_helper.rb
1 | 1 | module ProfileHelper extend ProfileHelper |
2 | 2 | PERSON_CATEGORIES[:mpog_profile_information] = [:secondary_email, :institutions] |
3 | + | |
4 | + def display_mpog_field(title, profile, field, force = false) | |
5 | + unless force || profile.may_display_field_to?(field, user) | |
6 | + return '' | |
7 | + end | |
8 | + value = profile.send(field) | |
9 | + if !value.blank? | |
10 | + if block_given? | |
11 | + value = yield(value) | |
12 | + end | |
13 | + content_tag('tr', content_tag('td', title, :class => 'field-name') + content_tag('td', value)) | |
14 | + else | |
15 | + '' | |
16 | + end | |
17 | + end | |
18 | + | |
3 | 19 | end | ... | ... |
views/profile/_software_tab.html.erb
... | ... | @@ -4,21 +4,21 @@ |
4 | 4 | <th colspan='2'><%= _('Software Information')%></th> |
5 | 5 | </tr> |
6 | 6 | |
7 | - <%= display_field(_('Name:'), profile, :name, true) %> | |
7 | + <%= display_mpog_field(_('Name:'), profile, :name, true) %> | |
8 | 8 | <%= content_tag('tr', content_tag('td', _("Adherent to e_mag:")) + content_tag('td', profile.software_info.e_mag ? _("Yes") : _("No"))) %> |
9 | 9 | <%= content_tag('tr', content_tag('td', _("Adherent to icp_brasil:")) + content_tag('td', profile.software_info.icp_brasil ? _("Yes") : _("No"))) %> |
10 | 10 | <%= content_tag('tr', content_tag('td', _("Adherent to e_ping:")) + content_tag('td', profile.software_info.e_ping ? _("Yes") : _("No"))) %> |
11 | 11 | <%= content_tag('tr', content_tag('td', _("Adherent to e_arq:")) + content_tag('td', profile.software_info.e_arq ? _("Yes") : _("No"))) %> |
12 | 12 | <%= content_tag('tr', content_tag('td', _("Internacionalizable:")) + content_tag('td', profile.software_info.intern ? _("Yes") : _("No"))) %> |
13 | - <%= display_field(_('Operating Platform:'), profile.software_info, :operating_platform, true) %> | |
14 | - <%= display_field(_('Demonstration URL:'), profile.software_info, :demonstration_url, true) %> | |
15 | - <%= display_field(_('Acronym:'), profile.software_info, :acronym, true) %> | |
16 | - <%= display_field(_('Objectives:'), profile.software_info, :objectives, true) %> | |
17 | - <%= display_field(_('Features:'), profile.software_info, :features, true) %> | |
13 | + <%= display_mpog_field(_('Operating Platform:'), profile.software_info, :operating_platform, true) %> | |
14 | + <%= display_mpog_field(_('Demonstration URL:'), profile.software_info, :demonstration_url, true) %> | |
15 | + <%= display_mpog_field(_('Acronym:'), profile.software_info, :acronym, true) %> | |
16 | + <%= display_mpog_field(_('Objectives:'), profile.software_info, :objectives, true) %> | |
17 | + <%= display_mpog_field(_('Features:'), profile.software_info, :features, true) %> | |
18 | 18 | |
19 | 19 | <%= content_tag('tr', content_tag('td', _("License"))) %> |
20 | - <%= display_field(_('Version:'), profile.software_info.license_info, :version, true) %> | |
21 | - <%= display_field(_('Link:'), profile.software_info.license_info, :link, true) %> | |
20 | + <%= display_mpog_field(_('Version:'), profile.software_info.license_info, :version, true) %> | |
21 | + <%= display_mpog_field(_('Link:'), profile.software_info.license_info, :link, true) %> | |
22 | 22 | </table> |
23 | 23 | |
24 | 24 | <table> |
... | ... | @@ -33,9 +33,9 @@ |
33 | 33 | <table class = "libraries-info dynamic-table"> |
34 | 34 | <%= content_tag('tr', content_tag('td', _("Libraries")) + content_tag('td', '')) %> |
35 | 35 | <% profile.software_info.libraries.each do |library| %> |
36 | - <%= display_field(_('Name:'), library, :name, true) %> | |
37 | - <%= display_field(_('Version:'), library, :version, true) %> | |
38 | - <%= display_field(_('License:'), library, :license, true) %> | |
36 | + <%= display_mpog_field(_('Name:'), library, :name, true) %> | |
37 | + <%= display_mpog_field(_('Version:'), library, :version, true) %> | |
38 | + <%= display_mpog_field(_('License:'), library, :license, true) %> | |
39 | 39 | <% end %> |
40 | 40 | </table> |
41 | 41 | </td> |
... | ... | @@ -52,9 +52,9 @@ |
52 | 52 | <table class = "database-info dynamic-table"> |
53 | 53 | <%= content_tag('tr', content_tag('td', _("Program Database")) + content_tag('td', '')) %> |
54 | 54 | <% profile.software_info.software_databases.each do |database| %> |
55 | - <%= display_field(_('Name:'), DatabaseDescription.find(database.database_description_id), :name, true) %> | |
56 | - <%= display_field(_('Version:'), database, :version, true) %> | |
57 | - <%= display_field(_('Operating System:'), database, :operating_system, true) %> | |
55 | + <%= display_mpog_field(_('Name:'), DatabaseDescription.find(database.database_description_id), :name, true) %> | |
56 | + <%= display_mpog_field(_('Version:'), database, :version, true) %> | |
57 | + <%= display_mpog_field(_('Operating System:'), database, :operating_system, true) %> | |
58 | 58 | <% end %> |
59 | 59 | </table> |
60 | 60 | </td> |
... | ... | @@ -71,9 +71,9 @@ |
71 | 71 | <table class = "language-info dynamic-table"> |
72 | 72 | <%= content_tag('tr', content_tag('td', _("Programming Language")) + content_tag('td', '')) %> |
73 | 73 | <% profile.software_info.software_languages.each do |language| %> |
74 | - <%= display_field(_('Name:'), language.programming_language , :name, true) %> | |
75 | - <%= display_field(_('Version:'), language, :version, true) %> | |
76 | - <%= display_field(_('Operating System:'), language, :operating_system, true) %> | |
74 | + <%= display_mpog_field(_('Name:'), language.programming_language , :name, true) %> | |
75 | + <%= display_mpog_field(_('Version:'), language, :version, true) %> | |
76 | + <%= display_mpog_field(_('Operating System:'), language, :operating_system, true) %> | |
77 | 77 | <% end %> |
78 | 78 | </table> |
79 | 79 | </td> |
... | ... | @@ -90,8 +90,8 @@ |
90 | 90 | <table class = "operating-system-info dynamic-table"> |
91 | 91 | <%= content_tag('tr', content_tag('td', _("Operating System")) + content_tag('td', '')) %> |
92 | 92 | <% profile.software_info.operating_systems.each do |operating_system| %> |
93 | - <%= display_field(_('Name:'), operating_system.operating_system_name , :name, true) %> | |
94 | - <%= display_field(_('Version:'), operating_system, :version, true) %> | |
93 | + <%= display_mpog_field(_('Name:'), operating_system.operating_system_name , :name, true) %> | |
94 | + <%= display_mpog_field(_('Version:'), operating_system, :version, true) %> | |
95 | 95 | <% end %> |
96 | 96 | </table> |
97 | 97 | </td> | ... | ... |