Commit 2168bebee517098f0722a0c9a23b0d77b3201ba7

Authored by Parley
Committed by Luciano Prestes
1 parent 97a4f4ad

Fix link to "Complete your profile"

Signed-off-by: Parley Martins <parley@outlook.com>
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
features/user_profile_edition.feature
... ... @@ -23,6 +23,11 @@ Feature: Institution Field
23 23 | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento |
24 24 And I am logged in as mpog_admin
25 25  
  26 + Scenario: Go to control panel when clicked on 'Complete your profile' link
  27 + When I follow "Complete your profile"
  28 + Then I should see "Profile settings for "
  29 + And I should see "Personal information"
  30 +
26 31 @selenium
27 32 Scenario: Add more then one instituion on profile editor
28 33 Given I follow "Edit Profile"
... ...
lib/mpog_software_plugin.rb
... ... @@ -7,6 +7,9 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
7 7 include FormsHelper
8 8 include LibraryHelper
9 9 include InstitutionHelper
  10 + include ActionView::Helpers
  11 + include ActionDispatch::Routing
  12 + include Rails.application.routes.url_helpers
10 13  
11 14 def self.plugin_name
12 15 "MpogSoftwarePlugin"
... ... @@ -228,9 +231,11 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
228 231 return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true
229 232  
230 233 person = Person.where(:user_id=>context.session[:user]).first
  234 +
231 235 if context.profile && context.profile.person? and !person.nil?
232   - @profile_edit_link = link_to _("Complete your profile"), "/myprofile/#{person.identifier}/profile_editor/edit"
  236 + @person = person
233 237 @percentege = calc_percentage_registration(person)
  238 +
234 239 if @percentege >= 0 and @percentege <= 100
235 240 expanded_template('incomplete_registration.html.erb')
236 241 end
... ...
views/incomplete_registration.html.erb
... ... @@ -4,9 +4,9 @@
4 4 <div><%= _("Complete Profile")+": <span>#{@percentege}</span>%" %></div>
5 5 <canvas id="complete_registration_percentage" width="100%" height="20"></canvas>
6 6 <div>
7   - <%= @profile_edit_link %> |
  7 + <%= link_to _("Complete your profile"), { :profile=>@person.identifier, :controller=>"profile_editor", :action=> "edit" } %> |
8 8 <%= link_to _("Hide"), "#", :class=>"hide-incomplete-percentage" %>
9 9 </div>
10 10 </div>
11 11 </div>
12   -<% end %>
13 12 \ No newline at end of file
  13 +<% end %>
... ...