Commit 2925d82fc83043e0c3d604d358c71098bf8d056a
1 parent
585bcac3
Exists in
master
and in
5 other branches
Replace suggested html hotspots by javascript tricks
For this point to the eternity, there is no need to use our branch plugins_dispatch anymore. Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
2 changed files
with
32 additions
and
24 deletions
Show diff stats
lib/mpog_software_plugin.rb
... | ... | @@ -17,6 +17,22 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
17 | 17 | _('Add Public Software and MPOG features.') |
18 | 18 | end |
19 | 19 | |
20 | + # Hotspot to insert html without an especific hotspot on view. | |
21 | + def body_beginning | |
22 | + return if context.session[:user].nil? or context.session[:hide_incomplete_percentage] == true | |
23 | + | |
24 | + person = context.environment.people.where(:user_id=>context.session[:user]).first | |
25 | + | |
26 | + if context.profile && context.profile.person? and !person.nil? | |
27 | + @person = person | |
28 | + @percentege = calc_percentage_registration(person) | |
29 | + | |
30 | + if @percentege >= 0 and @percentege < 100 | |
31 | + expanded_template('incomplete_registration.html.erb') | |
32 | + end | |
33 | + end | |
34 | + end | |
35 | + | |
20 | 36 | def profile_editor_extras |
21 | 37 | profile = context.profile |
22 | 38 | |
... | ... | @@ -117,30 +133,11 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
117 | 133 | ) |
118 | 134 | end |
119 | 135 | |
120 | - def add_new_organization_buttons | |
121 | - proc do | |
122 | - button( | |
123 | - :add, | |
124 | - _('Create a new software'), | |
125 | - :controller => 'mpog_software_plugin_myprofile', | |
126 | - :action => 'new_software' | |
127 | - ) | |
128 | - end | |
129 | - end | |
130 | - | |
131 | 136 | # FIXME - if in error log apears has_permission?, try to use this method |
132 | 137 | def has_permission?(person, permission, target) |
133 | 138 | person.has_permission_without_plugins?(permission, target) |
134 | 139 | end |
135 | 140 | |
136 | - def profile_blocks_extra_content | |
137 | - return if context.session[:user].nil? || | |
138 | - !context.session[:hide_incomplete_percentage].blank? | |
139 | - | |
140 | - person = Person.where(:user_id => context.session[:user]).first | |
141 | - call_percentage_profile_template(person) | |
142 | - end | |
143 | - | |
144 | 141 | def custom_user_registration_attributes(user) |
145 | 142 | return if context.params[:user][:institution_ids].nil? |
146 | 143 | context.params[:user][:institution_ids].delete('') | ... | ... |
views/incomplete_registration.html.erb
1 | -<% if @percentege < 100 then %> | |
2 | - <div id='complete_registration'> | |
3 | - <div id="complete_registration_message"> | |
4 | - <div><%= _("Complete Profile")+": <span>#{@percentege}</span>%" %></div> | |
1 | +<div id='complete_registration'> | |
2 | + <div id="complete_registration_message"> | |
3 | + <div><%= _("Complete Profile")+": <span>#{@percentege}</span>%" %></div> | |
5 | 4 | <canvas id="complete_registration_percentage" width="100%" height="20"></canvas> |
6 | 5 | <div> |
7 | 6 | <%= link_to _("Complete your profile"), "#{Noosfero.root}/myprofile/#{@person.identifier}/profile_editor/edit" %> | |
... | ... | @@ -9,4 +8,16 @@ |
9 | 8 | </div> |
10 | 9 | </div> |
11 | 10 | </div> |
12 | -<% end %> | |
11 | +</div> | |
12 | + | |
13 | +<script type="text/javascript"> | |
14 | + (function($){ | |
15 | + 'use strict'; | |
16 | + | |
17 | + $(document).ready(function(){ | |
18 | + var complete_message = $("#complete_registration").remove(); | |
19 | + | |
20 | + $(".profile-info-options").before(complete_message); | |
21 | + }); | |
22 | + })(jQuery); | |
23 | +</script> | |
13 | 24 | \ No newline at end of file | ... | ... |