Commit 2925d82fc83043e0c3d604d358c71098bf8d056a

Authored by Arthur Esposte
1 parent 585bcac3
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

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>
lib/mpog_software_plugin.rb
... ... @@ -17,6 +17,22 @@ class MpogSoftwarePlugin &lt; 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 &lt; 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
... ...