Commit cda90bda83d9737417f1777f8d005cadce29af89

Authored by Fabio Teixeira
Committed by Gabriela Navarro
1 parent 35138b91

fix_institution: Put Institution Info link at the top on its control panel

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
lib/mpog_software_plugin.rb
... ... @@ -229,12 +229,12 @@ class MpogSoftwarePlugin &lt; Noosfero::Plugin
229 229  
230 230 def control_panel_buttons
231 231 if context.profile.software?
232   - return { :title => _("Software Info"), :icon => "edit-profile-group", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_software"} }
  232 + return { :title => _("Software Info"), :icon => "edit-profile-group control-panel-software-link", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_software"} }
233 233 elsif context.profile.person?
234 234 return { :title => _("Create a new software"), :icon => "design-editor", :url => {:controller => "mpog_software_plugin_myprofile", :action => "new_software"} }
235 235 return nil
236 236 elsif context.profile.institution?
237   - return { :title => _("Institution Info"), :icon => "edit-profile-group", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_institution"} }
  237 + return { :title => _("Institution Info"), :icon => "edit-profile-group control-panel-instituton-link", :url => {:controller => "mpog_software_plugin_myprofile", :action => "edit_institution"} }
238 238 end
239 239 end
240 240  
... ...
public/mpog-institution-validations.js
... ... @@ -184,7 +184,6 @@
184 184 }
185 185  
186 186 function show_hide_cnpj_city(country) {
187   - console.log(country)
188 187 var cnpj = jQuery("#institutions_cnpj").parent().parent();
189 188 var city = jQuery("#community_city").parent().parent();
190 189 var state = jQuery("#community_state").parent().parent();
... ...
public/mpog-software.js
... ... @@ -10,15 +10,33 @@
10 10 jQuery(".operating-system-button-hide").hide();
11 11 }
12 12  
13   - function add_software_on_control_panel() {
14   - if(jQuery(".control-panel").size() > 0 && jQuery(".control-panel-edit-profile-group:contains('Software')").size() > 0 ) {
15   - jQuery(".control-panel")[0].innerHTML = jQuery(".control-panel-edit-profile-group:contains('Software')")[0].outerHTML + jQuery(".control-panel")[0].innerHTML
16   - jQuery(".control-panel-edit-profile-group:contains('Software')")[1].remove();
  13 + function add_software_on_control_panel(control_panel) {
  14 + var software_link = jQuery(".control-panel-software-link").remove();
  15 +
  16 + if( software_link.size() > 0 ) {
  17 + control_panel.prepend(software_link);
  18 + }
  19 + }
  20 +
  21 + function add_institution_on_control_panel(control_panel) {
  22 + var institution_link = jQuery(".control-panel-instituton-link").remove();
  23 +
  24 + if( institution_link.size() > 0 ) {
  25 + control_panel.prepend(institution_link);
  26 + }
  27 + }
  28 +
  29 + function add_itens_on_controla_panel() {
  30 + var control_panel = jQuery(".control-panel");
  31 +
  32 + if( control_panel.size() > 0 ) {
  33 + add_software_on_control_panel(control_panel);
  34 + add_institution_on_control_panel(control_panel);
17 35 }
18 36 }
19 37  
20 38 jQuery(document).ready(function(){
21   - add_software_on_control_panel();
  39 + add_itens_on_controla_panel();
22 40 hide_infos();
23 41 });
24 42 })();
25 43 \ No newline at end of file
... ...