lattes_curriculum_plugin.rb
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class LattesCurriculumPlugin < Noosfero::Plugin
def self.plugin_name
"LattesCurriculumPlugin"
end
def self.plugin_description
_("A plugin that imports the lattes curriculum into the users profiles")
end
def js_files
["singup_complement.js"]
end
def stylesheet?
true
end
def signup_extra_contents
lambda {
content_tag(:div, labelled_form_field(_('URL Lattes'), text_field(:profile_data, :lattes_url, :id => 'lattes_id_field')) +
content_tag(:small, _('The Lattes url is the link for your own curriculum so it\'ll be shown on your profile.'),
:class => 'signup-form', :id => 'lattes-id-balloon'), :id => 'signup-lattes-id')
}
end
def profile_info_extra_contents
if context.profile.person?
lattes_url = context.profile.lattes_url
lambda {
content_tag('div', labelled_form_field(_('URL Lattes'), text_field_tag('profile_data[lattes_url]', lattes_url, :id => 'lattes_url_field', :disabled => false)) +
content_tag(:small, _('The url lattes is the link for your lattes curriculum.')))
}
end
end
def profile_tabs
unless context.profile.lattes_url.nil?
href = context.profile.lattes_url
html_parser = Html_parser.new
{
:title => _("Lattes"),
:id => 'lattes_tab',
:content => lambda{html_parser.get_html(href)},
:start => false
}
end
end
end