From 382d1404ab1aa2d6c9fae51ea9694feb0844af7e Mon Sep 17 00:00:00 2001 From: David Carlos Date: Mon, 21 Jul 2014 18:31:36 +0000 Subject: [PATCH] incomplete_registration: Using partial to show percentage. --- lib/mpog_software_plugin.rb | 15 +++++++++++---- views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 4f68808..bab19c7 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -151,10 +151,17 @@ class MpogSoftwarePlugin < Noosfero::Plugin end def incomplete_registration params - person = User.find(params[:user]).person - percentege = calc_percentage_registration(person) - if percentege >= 0 and percentege <= 100 - return _("Registration "+percentege.to_s+"% incomplete ") + return if params.nil? or params[:user].nil? + + person = if params[:user].kind_of? User + User.find(params[:user]).person + else + params[:user] + end + + @percentege = calc_percentage_registration(person) + if @percentege >= 0 and @percentege <= 100 + expanded_template('mpog_software_plugin_myprofile/_incomplete_registration.html.erb') end end diff --git a/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb b/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb new file mode 100644 index 0000000..1cbe1cc --- /dev/null +++ b/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb @@ -0,0 +1,3 @@ +
+ <%= 'Teste' %> +
-- libgit2 0.21.2