Commit 58e8d6c27ebd62689c0856a4a10c6beb4114abd9

Authored by Fabio Teixeira
Committed by Luciano Prestes
1 parent 3a7aa686

Place software wall js code into its correct module

public/views/edit-software.js
... ... @@ -98,61 +98,7 @@ modulejs.define('EditSoftware', ['jquery', 'NoosferoRoot', 'AutoComplete', 'NewS
98 98 });
99 99  
100 100  
101   - $(".language-button-hide").click(function(event){
102   - event.preventDefault();
103   - $(".language-info").hide();
104   - $(".language-button-show").show();
105   - $(".language-button-hide").hide();
106   - });
107   -
108   - $(".language-button-show").click(function(event){
109   - event.preventDefault();
110   - $(".language-info").show();
111   - $(".language-button-show").hide();
112   - $(".language-button-hide").show();
113   - });
114   -
115   - $(".operating-system-button-hide").click(function(event){
116   - event.preventDefault();
117   - $(".operating-system-info").hide();
118   - $(".operating-system-button-show").show();
119   - $(".operating-system-button-hide").hide();
120   - });
121   -
122   - $(".operating-system-button-show").click(function(event){
123   - event.preventDefault();
124   - $(".operating-system-info").show();
125   - $(".operating-system-button-show").hide();
126   - $(".operating-system-button-hide").show();
127   - });
128 101  
129   - $(".database-button-hide").click(function(event){
130   - event.preventDefault();
131   - $(".database-info").hide();
132   - $(".database-button-show").show();
133   - $(".database-button-hide").hide();
134   - });
135   -
136   - $(".database-button-show").click(function(event){
137   - event.preventDefault();
138   - $(".database-info").show();
139   - $(".database-button-show").hide();
140   - $(".database-button-hide").show();
141   - });
142   -
143   - $(".libraries-button-hide").click(function(event){
144   - event.preventDefault();
145   - $(".libraries-info").hide();
146   - $(".libraries-button-show").show();
147   - $(".libraries-button-hide").hide();
148   - });
149   -
150   - $(".libraries-button-show").click(function(event){
151   - event.preventDefault();
152   - $(".libraries-info").show();
153   - $(".libraries-button-show").hide();
154   - $(".libraries-button-hide").show();
155   - });
156 102  
157 103 hide_show_public_software_fields();
158 104 $("#software_public_software").click(hide_show_public_software_fields);
... ...
public/views/profile-tabs-software.js
1   -modulejs.define("ProfileTabsSoftware", ["jquery", "EditSoftware"], function($, EditSoftware) {
  1 +modulejs.define("ProfileTabsSoftware", ["jquery"], function($) {
2 2 "use strict";
3 3  
4 4 function hide_infos(){
... ... @@ -13,6 +13,65 @@ modulejs.define("ProfileTabsSoftware", ["jquery", "EditSoftware"], function($, E
13 13 }
14 14  
15 15  
  16 + function set_show_hide_dynamic_table_events() {
  17 + $(".language-button-hide").click(function(event){
  18 + event.preventDefault();
  19 + $(".language-info").hide();
  20 + $(".language-button-show").show();
  21 + $(".language-button-hide").hide();
  22 + });
  23 +
  24 + $(".language-button-show").click(function(event){
  25 + event.preventDefault();
  26 + $(".language-info").show();
  27 + $(".language-button-show").hide();
  28 + $(".language-button-hide").show();
  29 + });
  30 +
  31 + $(".operating-system-button-hide").click(function(event){
  32 + event.preventDefault();
  33 + $(".operating-system-info").hide();
  34 + $(".operating-system-button-show").show();
  35 + $(".operating-system-button-hide").hide();
  36 + });
  37 +
  38 + $(".operating-system-button-show").click(function(event){
  39 + event.preventDefault();
  40 + $(".operating-system-info").show();
  41 + $(".operating-system-button-show").hide();
  42 + $(".operating-system-button-hide").show();
  43 + });
  44 +
  45 + $(".database-button-hide").click(function(event){
  46 + event.preventDefault();
  47 + $(".database-info").hide();
  48 + $(".database-button-show").show();
  49 + $(".database-button-hide").hide();
  50 + });
  51 +
  52 + $(".database-button-show").click(function(event){
  53 + event.preventDefault();
  54 + $(".database-info").show();
  55 + $(".database-button-show").hide();
  56 + $(".database-button-hide").show();
  57 + });
  58 +
  59 + $(".libraries-button-hide").click(function(event){
  60 + event.preventDefault();
  61 + $(".libraries-info").hide();
  62 + $(".libraries-button-show").show();
  63 + $(".libraries-button-hide").hide();
  64 + });
  65 +
  66 + $(".libraries-button-show").click(function(event){
  67 + event.preventDefault();
  68 + $(".libraries-info").show();
  69 + $(".libraries-button-show").hide();
  70 + $(".libraries-button-hide").show();
  71 + });
  72 + }
  73 +
  74 +
16 75 return {
17 76 isCurrentPage: function() {
18 77 return $("#software-fields").length === 1;
... ... @@ -21,8 +80,7 @@ modulejs.define("ProfileTabsSoftware", ["jquery", "EditSoftware"], function($, E
21 80  
22 81 init: function() {
23 82 hide_infos();
24   -
25   - EditSoftware.init();
  83 + set_show_hide_dynamic_table_events();
26 84 }
27 85 }
28 86 });
... ...
views/profile/_software_tab.html.erb
1   -<%= javascript_include_tag "mpog-validations" %>
2 1 <table>
3 2 <tr>
4 3 <th colspan='2'><%= _('Software Information')%></th>
... ...