From 4b8a522c1a6494ee921d6ae25d14bf4c7d0027d8 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Thu, 5 Mar 2015 13:33:42 +0000 Subject: [PATCH] Fix software profile tab javascript to show information from the software. --- lib/software_communities_plugin.rb | 13 +++++++------ public/initializer.js | 3 ++- public/views/control-panel.js | 13 ------------- public/views/profile-tabs-software.js | 28 ++++++++++++++++++++++++++++ views/profile/_software_tab.html.erb | 2 +- 5 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 public/views/profile-tabs-software.js diff --git a/lib/software_communities_plugin.rb b/lib/software_communities_plugin.rb index 8a8cb8c..c2d2c39 100644 --- a/lib/software_communities_plugin.rb +++ b/lib/software_communities_plugin.rb @@ -78,8 +78,8 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin def profile_tabs if context.profile.community? - profile_tabs_software if context.profile.software? - profile_tabs_institution if context.profile.institution? + return profile_tabs_software if context.profile.software? + return profile_tabs_institution if context.profile.institution? end end @@ -126,6 +126,7 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin views/create-institution.js views/complete-registration.js views/search-software-catalog.js + views/profile-tabs-software.js blocks/software-download.js initializer.js app.js @@ -341,15 +342,15 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin def profile_tabs_software { :title => _('Software'), - :id => 'mpog-fields', - :content => proc do render :partial => 'software_tab' end, + :id => 'software-fields', + :content => Proc::new do render :partial => 'profile/software_tab' end, :start => true } end def profile_tabs_institution { :title => _('Institution'), - :id => 'mpog-fields', - :content => Proc::new do render :partial => 'institution_tab' end, + :id => 'intitution-fields', + :content => Proc::new do render :partial => 'profile/institution_tab' end, :start => true } end diff --git a/public/initializer.js b/public/initializer.js index 8662c27..3365f85 100644 --- a/public/initializer.js +++ b/public/initializer.js @@ -9,7 +9,8 @@ 'CreateInstitution', 'CompleteRegistration', 'SearchSoftwareCatalog', - 'SoftwareDownload' + 'SoftwareDownload', + "ProfileTabsSoftware" ]; diff --git a/public/views/control-panel.js b/public/views/control-panel.js index 6fe50ad..52ac8d6 100644 --- a/public/views/control-panel.js +++ b/public/views/control-panel.js @@ -1,18 +1,6 @@ modulejs.define('ControlPanel', ['jquery'], function($) { 'use strict'; - function hide_infos(){ - $(".language-info").hide(); - $(".database-info").hide(); - $(".libraries-info").hide(); - $(".operating-system-info").hide(); - $(".language-button-hide").hide(); - $(".database-button-hide").hide(); - $(".libraries-button-hide").hide(); - $(".operating-system-button-hide").hide(); - } - - function add_software_on_control_panel(control_panel) { var software_link = $(".control-panel-software-link").remove(); @@ -49,7 +37,6 @@ modulejs.define('ControlPanel', ['jquery'], function($) { init: function() { add_itens_on_controla_panel(); - hide_infos(); } } }); diff --git a/public/views/profile-tabs-software.js b/public/views/profile-tabs-software.js new file mode 100644 index 0000000..1d80825 --- /dev/null +++ b/public/views/profile-tabs-software.js @@ -0,0 +1,28 @@ +modulejs.define("ProfileTabsSoftware", ["jquery", "EditSoftware"], function($, EditSoftware) { + "use strict"; + + function hide_infos(){ + $(".language-info").hide(); + $(".database-info").hide(); + $(".libraries-info").hide(); + $(".operating-system-info").hide(); + $(".language-button-hide").hide(); + $(".database-button-hide").hide(); + $(".libraries-button-hide").hide(); + $(".operating-system-button-hide").hide(); + } + + + return { + isCurrentPage: function() { + return $("#software-fields").length === 1; + }, + + + init: function() { + hide_infos(); + + EditSoftware.init(); + } + } +}); diff --git a/views/profile/_software_tab.html.erb b/views/profile/_software_tab.html.erb index 1bb3739..a3b303f 100644 --- a/views/profile/_software_tab.html.erb +++ b/views/profile/_software_tab.html.erb @@ -136,4 +136,4 @@ - \ No newline at end of file + -- libgit2 0.21.2