Commit b072751007c3198bab9acda5db2cb278c60b4c7f
1 parent
6b03fc9c
Exists in
master
and in
5 other branches
incomplete_registration: Using context user and changed the hot spot
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
3 changed files
with
39 additions
and
41 deletions
Show diff stats
lib/mpog_software_plugin.rb
| @@ -151,21 +151,19 @@ class MpogSoftwarePlugin < Noosfero::Plugin | @@ -151,21 +151,19 @@ class MpogSoftwarePlugin < Noosfero::Plugin | ||
| 151 | end | 151 | end |
| 152 | 152 | ||
| 153 | 153 | ||
| 154 | - def incomplete_registration params | ||
| 155 | - return if params.nil? or params[:user].nil? | 154 | + def body_middle |
| 155 | + return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true | ||
| 156 | 156 | ||
| 157 | - person = if params[:user].kind_of? User | ||
| 158 | - User.find(params[:user]).person | ||
| 159 | - else | ||
| 160 | - params[:user] | ||
| 161 | - end | 157 | + person = Person.where(:user_id=>context.session[:user]).first |
| 162 | 158 | ||
| 163 | - @profile_edit_link = link_to _("Complete your registration"), "/myprofile/#{person.identifier}/profile_editor/edit" | ||
| 164 | - @profile_empty_fields = profile_required_empty_list person | ||
| 165 | - @percentege = calc_percentage_registration(person) | 159 | + unless person.nil? |
| 160 | + @profile_edit_link = link_to _("Complete your registration"), "/myprofile/#{person.identifier}/profile_editor/edit" | ||
| 161 | + @profile_empty_fields = profile_required_empty_list person | ||
| 162 | + @percentege = calc_percentage_registration(person) | ||
| 166 | 163 | ||
| 167 | - if @percentege >= 0 and @percentege <= 100 and context.session[:hide_incomplete_percentage] != true | ||
| 168 | - expanded_template('mpog_software_plugin_myprofile/_incomplete_registration.html.erb') | 164 | + if @percentege >= 0 and @percentege <= 100 |
| 165 | + expanded_template('incomplete_registration.html.erb') | ||
| 166 | + end | ||
| 169 | end | 167 | end |
| 170 | end | 168 | end |
| 171 | 169 |
| @@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
| 1 | +<div id='incomplete_registration'> | ||
| 2 | + <div id="incomplete_percentage"> | ||
| 3 | + <%= _("Incomplete registration percentage")+":#{@percentege}%" %> | ||
| 4 | + </div> | ||
| 5 | + | ||
| 6 | + <div id="profile_empty_fields"> | ||
| 7 | + <span><%= _("List with fields to be filled")+":" %></span> | ||
| 8 | + <ul> | ||
| 9 | + <% @profile_empty_fields.each do |field|%> | ||
| 10 | + <li> | ||
| 11 | + <%= field %> | ||
| 12 | + </li> | ||
| 13 | + <% end %> | ||
| 14 | + </ul> | ||
| 15 | + </div> | ||
| 16 | + | ||
| 17 | + <div id="profile_links"> | ||
| 18 | + <table> | ||
| 19 | + <tr> | ||
| 20 | + <td> | ||
| 21 | + <%= @profile_edit_link %> | ||
| 22 | + </td> | ||
| 23 | + <td> | ||
| 24 | + <%= link_to _("Hide this message"), "#", :class=>"hide-incomplete-percentage" %></a> | ||
| 25 | + </td> | ||
| 26 | + </tr> | ||
| 27 | + </table> | ||
| 28 | + </div> | ||
| 29 | +</div> |
views/mpog_software_plugin_myprofile/_incomplete_registration.html.erb
| @@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
| 1 | -<div id='incomplete_registration'> | ||
| 2 | - <div id="incomplete_percentage"> | ||
| 3 | - <%= _("Incomplete registration percentage")+":#{@percentege}%" %> | ||
| 4 | - </div> | ||
| 5 | - | ||
| 6 | - <div id="profile_empty_fields"> | ||
| 7 | - <span><%= _("List with fields to be filled")+":" %></span> | ||
| 8 | - <ul> | ||
| 9 | - <% @profile_empty_fields.each do |field|%> | ||
| 10 | - <li> | ||
| 11 | - <%= field %> | ||
| 12 | - </li> | ||
| 13 | - <% end %> | ||
| 14 | - </ul> | ||
| 15 | - </div> | ||
| 16 | - | ||
| 17 | - <div id="profile_links"> | ||
| 18 | - <table> | ||
| 19 | - <tr> | ||
| 20 | - <td> | ||
| 21 | - <%= @profile_edit_link %> | ||
| 22 | - </td> | ||
| 23 | - <td> | ||
| 24 | - <%= link_to _("Hide this message"), "#", :class=>"hide-incomplete-percentage" %></a> | ||
| 25 | - </td> | ||
| 26 | - </tr> | ||
| 27 | - </table> | ||
| 28 | - </div> | ||
| 29 | -</div> |