From 2168bebee517098f0722a0c9a23b0d77b3201ba7 Mon Sep 17 00:00:00 2001 From: Parley Martins Date: Thu, 13 Nov 2014 11:14:09 -0200 Subject: [PATCH] Fix link to "Complete your profile" --- features/user_profile_edition.feature | 5 +++++ lib/mpog_software_plugin.rb | 7 ++++++- views/incomplete_registration.html.erb | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/features/user_profile_edition.feature b/features/user_profile_edition.feature index 4b27f98..df6b328 100644 --- a/features/user_profile_edition.feature +++ b/features/user_profile_edition.feature @@ -23,6 +23,11 @@ Feature: Institution Field | Ministerio do Planejamento | MP | BR | DF | Brasilia | 41.769.591/0001-43 | Autarquia | Judiciario | Federal | Ministerio do Planejamento | And I am logged in as mpog_admin + Scenario: Go to control panel when clicked on 'Complete your profile' link + When I follow "Complete your profile" + Then I should see "Profile settings for " + And I should see "Personal information" + @selenium Scenario: Add more then one instituion on profile editor Given I follow "Edit Profile" diff --git a/lib/mpog_software_plugin.rb b/lib/mpog_software_plugin.rb index 2a295f8..2cd65f0 100644 --- a/lib/mpog_software_plugin.rb +++ b/lib/mpog_software_plugin.rb @@ -7,6 +7,9 @@ class MpogSoftwarePlugin < Noosfero::Plugin include FormsHelper include LibraryHelper include InstitutionHelper + include ActionView::Helpers + include ActionDispatch::Routing + include Rails.application.routes.url_helpers def self.plugin_name "MpogSoftwarePlugin" @@ -228,9 +231,11 @@ class MpogSoftwarePlugin < Noosfero::Plugin return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true person = Person.where(:user_id=>context.session[:user]).first + if context.profile && context.profile.person? and !person.nil? - @profile_edit_link = link_to _("Complete your profile"), "/myprofile/#{person.identifier}/profile_editor/edit" + @person = person @percentege = calc_percentage_registration(person) + if @percentege >= 0 and @percentege <= 100 expanded_template('incomplete_registration.html.erb') end diff --git a/views/incomplete_registration.html.erb b/views/incomplete_registration.html.erb index ae2acb8..a73dab8 100644 --- a/views/incomplete_registration.html.erb +++ b/views/incomplete_registration.html.erb @@ -4,9 +4,9 @@
<%= _("Complete Profile")+": #{@percentege}%" %>
- <%= @profile_edit_link %> | + <%= link_to _("Complete your profile"), { :profile=>@person.identifier, :controller=>"profile_editor", :action=> "edit" } %> | <%= link_to _("Hide"), "#", :class=>"hide-incomplete-percentage" %>
-<% end %> \ No newline at end of file +<% end %> -- libgit2 0.21.2