From b072751007c3198bab9acda5db2cb278c60b4c7f Mon Sep 17 00:00:00 2001 From: Fabio Teixeira Date: Wed, 23 Jul 2014 14:29:29 -0300 Subject: [PATCH] incomplete_registration: Using context user and changed the hot spot --- lib/mpog_software_plugin.rb | 22 ++++++++++------------ views/incomplete_registration.html.erb | 29 +++++++++++++++++++++++++++++ views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb | 29 ----------------------------- 3 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 views/incomplete_registration.html.erb delete 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 bf63bd6..3aae3f9 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -151,21 +151,19 @@ class MpogSoftwarePlugin < Noosfero::Plugin end - def incomplete_registration params - return if params.nil? or params[:user].nil? + def body_middle + return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true - person = if params[:user].kind_of? User - User.find(params[:user]).person - else - params[:user] - end + person = Person.where(:user_id=>context.session[:user]).first - @profile_edit_link = link_to _("Complete your registration"), "/myprofile/#{person.identifier}/profile_editor/edit" - @profile_empty_fields = profile_required_empty_list person - @percentege = calc_percentage_registration(person) + unless person.nil? + @profile_edit_link = link_to _("Complete your registration"), "/myprofile/#{person.identifier}/profile_editor/edit" + @profile_empty_fields = profile_required_empty_list person + @percentege = calc_percentage_registration(person) - if @percentege >= 0 and @percentege <= 100 and context.session[:hide_incomplete_percentage] != true - expanded_template('mpog_software_plugin_myprofile/_incomplete_registration.html.erb') + if @percentege >= 0 and @percentege <= 100 + expanded_template('incomplete_registration.html.erb') + end end end diff --git a/views/incomplete_registration.html.erb b/views/incomplete_registration.html.erb new file mode 100644 index 0000000..1320475 --- /dev/null +++ b/views/incomplete_registration.html.erb @@ -0,0 +1,29 @@ +
+
+ <%= _("Incomplete registration percentage")+":#{@percentege}%" %> +
+ +
+ <%= _("List with fields to be filled")+":" %> +
    + <% @profile_empty_fields.each do |field|%> +
  • + <%= field %> +
  • + <% end %> +
+
+ + +
diff --git a/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb b/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb deleted file mode 100644 index 1320475..0000000 --- a/views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -
-
- <%= _("Incomplete registration percentage")+":#{@percentege}%" %> -
- -
- <%= _("List with fields to be filled")+":" %> -
    - <% @profile_empty_fields.each do |field|%> -
  • - <%= field %> -
  • - <% end %> -
-
- - -
-- libgit2 0.21.2