Commit c9cdb24a515adc52982e5aa178ef66011e603fae
1 parent
6a3d8d37
Exists in
master
and in
5 other branches
reformulacao_software: Enable Programming languages and Databases do removed
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Luiz Matos <luizff.matos@gmail.com>
Showing
4 changed files
with
141 additions
and
147 deletions
Show diff stats
lib/database_helper.rb
... | ... | @@ -27,7 +27,7 @@ module DatabaseHelper |
27 | 27 | true |
28 | 28 | end |
29 | 29 | |
30 | - def self.database_as_tables(list_databases, have_delete_button = nil) | |
30 | + def self.database_as_tables(list_databases) | |
31 | 31 | extend( |
32 | 32 | ActionView::Helpers::TagHelper, |
33 | 33 | ActionView::Helpers::FormTagHelper, |
... | ... | @@ -36,18 +36,18 @@ module DatabaseHelper |
36 | 36 | ApplicationHelper |
37 | 37 | ) |
38 | 38 | |
39 | - return database_html_structure({:database_description_id => 1, :version => "", :operating_system => ""}, have_delete_button) if list_databases.nil? | |
39 | + return database_html_structure({:database_description_id => 1, :version => "", :operating_system => ""}) if list_databases.nil? | |
40 | 40 | |
41 | 41 | lambdas_list = [] |
42 | - | |
42 | + | |
43 | 43 | list_databases.each do |database| |
44 | - lambdas_list << database_html_structure(database, have_delete_button) | |
44 | + lambdas_list << database_html_structure(database) | |
45 | 45 | end |
46 | 46 | |
47 | 47 | lambdas_list |
48 | 48 | end |
49 | 49 | |
50 | - def self.database_html_structure(database_data, have_delete_button = nil) | |
50 | + def self.database_html_structure(database_data) | |
51 | 51 | Proc::new do |
52 | 52 | content_tag('table', |
53 | 53 | content_tag('tr', |
... | ... | @@ -65,15 +65,7 @@ module DatabaseHelper |
65 | 65 | content_tag('tr', |
66 | 66 | content_tag('td', label_tag(_("Operating System")))+ |
67 | 67 | content_tag('td', text_field_tag("database[][operating_system]", database_data[:operating_system]))+ |
68 | - | |
69 | - if have_delete_button.nil? | |
70 | - content_tag('td', | |
71 | - button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), | |
72 | - :align => 'right' | |
73 | - ) | |
74 | - else | |
75 | - content_tag('td') | |
76 | - end | |
68 | + content_tag('td', button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), :align => 'right') | |
77 | 69 | ), :class => 'dynamic-table database-table' |
78 | 70 | ) |
79 | 71 | end | ... | ... |
lib/software_language_helper.rb
... | ... | @@ -27,7 +27,7 @@ module SoftwareLanguageHelper |
27 | 27 | true |
28 | 28 | end |
29 | 29 | |
30 | - def self.language_as_tables(list_languages, have_delete_button = true, show_information = false) | |
30 | + def self.language_as_tables(list_languages, show_information = false) | |
31 | 31 | extend( |
32 | 32 | ActionView::Helpers::TagHelper, |
33 | 33 | ActionView::Helpers::FormTagHelper, |
... | ... | @@ -39,10 +39,10 @@ module SoftwareLanguageHelper |
39 | 39 | lambdas_list = [] |
40 | 40 | |
41 | 41 | if not show_information |
42 | - return language_html_structure({:programming_language_id => 1, :version => "", :operating_system => ""}, have_delete_button) if list_languages.nil? | |
42 | + return language_html_structure({:programming_language_id => 1, :version => "", :operating_system => ""}) if list_languages.nil? | |
43 | 43 | |
44 | 44 | list_languages.each do |language| |
45 | - lambdas_list << language_html_structure(language, have_delete_button) | |
45 | + lambdas_list << language_html_structure(language) | |
46 | 46 | end |
47 | 47 | |
48 | 48 | else |
... | ... | @@ -56,7 +56,7 @@ module SoftwareLanguageHelper |
56 | 56 | lambdas_list |
57 | 57 | end |
58 | 58 | |
59 | - def self.language_html_structure(language_data, have_delete_button = true) | |
59 | + def self.language_html_structure(language_data) | |
60 | 60 | Proc::new do |
61 | 61 | content_tag('table', |
62 | 62 | content_tag('tr', |
... | ... | @@ -74,15 +74,7 @@ module SoftwareLanguageHelper |
74 | 74 | content_tag('tr', |
75 | 75 | content_tag('td', label_tag(_("Operating System")))+ |
76 | 76 | content_tag('td', text_field_tag("language[][operating_system]", language_data[:operating_system]))+ |
77 | - | |
78 | - if have_delete_button | |
79 | - content_tag('td', | |
80 | - button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), | |
81 | - :align => 'right' | |
82 | - ) | |
83 | - else | |
84 | - content_tag('td', "") | |
85 | - end | |
77 | + content_tag('td', button_without_text(:delete, _('Delete'), "#" , :class=>"delete-dynamic-table"), :align => 'right') | |
86 | 78 | ), :class => 'dynamic-table software-language-table' |
87 | 79 | ) |
88 | 80 | end | ... | ... |
public/mpog-software-validations.js
1 | -function delete_dynamic_table() { | |
2 | - var button = jQuery(".delete-dynamic-table"); | |
1 | +(function(){ | |
2 | + function delete_dynamic_table() { | |
3 | + var button = jQuery(".delete-dynamic-table"); | |
3 | 4 | |
4 | - button.each(function(){ | |
5 | - var table = jQuery(this).parent().parent().parent().parent(); | |
6 | - var color = table.css("background-color"); | |
5 | + button.each(function(){ | |
6 | + var table = jQuery(this).parent().parent().parent().parent(); | |
7 | + var color = table.css("background-color"); | |
7 | 8 | |
8 | - jQuery(this).click(function(){ | |
9 | - if( table.hasClass("software-language-table") && has_more_than_one("software-language-table")) | |
10 | - table.remove(); | |
11 | - | |
12 | - if( table.hasClass("database-table") && has_more_than_one("database-table")) | |
9 | + jQuery(this).click(function(){ | |
13 | 10 | table.remove(); |
11 | + return false; | |
12 | + }).mouseover(function(){ | |
13 | + table.css("background-color", "#eee"); | |
14 | + }).mouseout(function(){ | |
15 | + table.css("background-color", color); | |
16 | + }); | |
17 | + }); | |
18 | + } | |
14 | 19 | |
15 | - if( !table.hasClass("software-language-table") && !table.hasClass("database-table") ) | |
16 | - table.remove(); | |
20 | + function has_more_than_one(table_class) { | |
21 | + return (jQuery("."+table_class).length > 2); // One is always added by defaul and its hidden | |
22 | + } | |
17 | 23 | |
18 | - return false; | |
19 | - }).mouseover(function(){ | |
20 | - table.css("background-color", "#eee"); | |
21 | - }).mouseout(function(){ | |
22 | - table.css("background-color", color); | |
23 | - }); | |
24 | - }); | |
25 | -} | |
26 | - | |
27 | -function has_more_than_one(table_class) { | |
28 | - return (jQuery("."+table_class).length > 2); // One is always added by defaul and its hidden | |
29 | -} | |
30 | - | |
31 | -function add_dynamic_table(element_id, content) { | |
32 | - Element.insert(element_id, {bottom: content}); | |
33 | -} | |
34 | - | |
35 | -function get_license_link(select_id){ | |
36 | - var selected = jQuery('#'+select_id).selected().val(); | |
37 | - var link = jQuery("#version_" + selected).val(); | |
38 | - | |
39 | - jQuery("#version_link") | |
40 | - .attr("href", link) | |
41 | - .text(link); | |
42 | -} | |
43 | - | |
44 | -function hide_infos(){ | |
45 | - jQuery(".language-info").hide(); | |
46 | - jQuery(".database-info").hide(); | |
47 | - jQuery(".libraries-info").hide(); | |
48 | - jQuery(".operating-system-info").hide(); | |
49 | - jQuery(".language-button-hide").hide(); | |
50 | - jQuery(".database-button-hide").hide(); | |
51 | - jQuery(".libraries-button-hide").hide(); | |
52 | - jQuery(".operating-system-button-hide").hide(); | |
53 | -} | |
54 | - | |
55 | -jQuery(document).ready(function(){ | |
56 | - var dynamic_tables = ["dynamic-databases", "dynamic-languages", "dynamic-libraries","dynamic-operating_systems"]; | |
57 | - | |
58 | - delete_dynamic_table(); | |
59 | - | |
60 | - jQuery(".new-dynamic-table").click(function(){ | |
61 | - var link = jQuery(this); | |
62 | - | |
63 | - dynamic_tables.each(function(value){ | |
64 | - if( link.hasClass(value) ) { | |
65 | - var table_id = value.split("-")[1]; | |
66 | - | |
67 | - var table_html = jQuery("#table_structure_"+table_id).html(); | |
68 | - add_dynamic_table(table_id, table_html); | |
69 | - } | |
70 | - }); | |
24 | + function add_dynamic_table(element_id, content) { | |
25 | + Element.insert(element_id, {bottom: content}); | |
26 | + } | |
71 | 27 | |
72 | - delete_dynamic_table(); | |
73 | - return false; | |
74 | - }); | |
28 | + function get_license_link(select_id){ | |
29 | + var selected = jQuery('#'+select_id).selected().val(); | |
30 | + var link = jQuery("#version_" + selected).val(); | |
75 | 31 | |
76 | - hide_infos(); | |
32 | + jQuery("#version_link") | |
33 | + .attr("href", link) | |
34 | + .text(link); | |
35 | + } | |
77 | 36 | |
78 | - jQuery(".language-button-hide").click(function(event){ | |
79 | - event.preventDefault(); | |
37 | + function hide_infos(){ | |
80 | 38 | jQuery(".language-info").hide(); |
81 | - jQuery(".language-button-show").show(); | |
39 | + jQuery(".database-info").hide(); | |
40 | + jQuery(".libraries-info").hide(); | |
41 | + jQuery(".operating-system-info").hide(); | |
82 | 42 | jQuery(".language-button-hide").hide(); |
83 | - }); | |
43 | + jQuery(".database-button-hide").hide(); | |
44 | + jQuery(".libraries-button-hide").hide(); | |
45 | + jQuery(".operating-system-button-hide").hide(); | |
46 | + } | |
84 | 47 | |
85 | - jQuery(".language-button-show").click(function(event){ | |
86 | - event.preventDefault(); | |
87 | - jQuery(".language-info").show(); | |
88 | - jQuery(".language-button-show").hide(); | |
89 | - jQuery(".language-button-hide").show(); | |
90 | - }); | |
48 | + jQuery(document).ready(function(){ | |
49 | + var dynamic_tables = ["dynamic-databases", "dynamic-languages", "dynamic-libraries","dynamic-operating_systems"]; | |
91 | 50 | |
92 | - jQuery(".operating-system-button-hide").click(function(event){ | |
93 | - event.preventDefault(); | |
94 | - jQuery(".operating-system-info").hide(); | |
95 | - jQuery(".operating-system-button-show").show(); | |
96 | - jQuery(".operating-system-button-hide").hide(); | |
97 | - }); | |
51 | + delete_dynamic_table(); | |
98 | 52 | |
99 | - jQuery(".operating-system-button-show").click(function(event){ | |
100 | - event.preventDefault(); | |
101 | - jQuery(".operating-system-info").show(); | |
102 | - jQuery(".operating-system-button-show").hide(); | |
103 | - jQuery(".operating-system-button-hide").show(); | |
104 | - }); | |
53 | + jQuery(".new-dynamic-table").click(function(){ | |
54 | + var link = jQuery(this); | |
105 | 55 | |
106 | - jQuery(".database-button-hide").click(function(event){ | |
107 | - event.preventDefault(); | |
108 | - jQuery(".database-info").hide(); | |
109 | - jQuery(".database-button-show").show(); | |
110 | - jQuery(".database-button-hide").hide(); | |
111 | - }); | |
56 | + dynamic_tables.each(function(value){ | |
57 | + if( link.hasClass(value) ) { | |
58 | + var table_id = value.split("-")[1]; | |
112 | 59 | |
113 | - jQuery(".database-button-show").click(function(event){ | |
114 | - event.preventDefault(); | |
115 | - jQuery(".database-info").show(); | |
116 | - jQuery(".database-button-show").hide(); | |
117 | - jQuery(".database-button-hide").show(); | |
118 | - }); | |
60 | + var table_html = jQuery("#table_structure_"+table_id).html(); | |
61 | + add_dynamic_table(table_id, table_html); | |
62 | + } | |
63 | + }); | |
119 | 64 | |
120 | - jQuery(".libraries-button-hide").click(function(event){ | |
121 | - event.preventDefault(); | |
122 | - jQuery(".libraries-info").hide(); | |
123 | - jQuery(".libraries-button-show").show(); | |
124 | - jQuery(".libraries-button-hide").hide(); | |
125 | - }); | |
65 | + delete_dynamic_table(); | |
66 | + return false; | |
67 | + }); | |
68 | + | |
69 | + jQuery(".language-button-hide").click(function(event){ | |
70 | + event.preventDefault(); | |
71 | + jQuery(".language-info").hide(); | |
72 | + jQuery(".language-button-show").show(); | |
73 | + jQuery(".language-button-hide").hide(); | |
74 | + }); | |
75 | + | |
76 | + jQuery(".language-button-show").click(function(event){ | |
77 | + event.preventDefault(); | |
78 | + jQuery(".language-info").show(); | |
79 | + jQuery(".language-button-show").hide(); | |
80 | + jQuery(".language-button-hide").show(); | |
81 | + }); | |
126 | 82 | |
127 | - jQuery(".libraries-button-show").click(function(event){ | |
128 | - event.preventDefault(); | |
129 | - jQuery(".libraries-info").show(); | |
130 | - jQuery(".libraries-button-show").hide(); | |
131 | - jQuery(".libraries-button-hide").show(); | |
83 | + jQuery(".operating-system-button-hide").click(function(event){ | |
84 | + event.preventDefault(); | |
85 | + jQuery(".operating-system-info").hide(); | |
86 | + jQuery(".operating-system-button-show").show(); | |
87 | + jQuery(".operating-system-button-hide").hide(); | |
88 | + }); | |
89 | + | |
90 | + jQuery(".operating-system-button-show").click(function(event){ | |
91 | + event.preventDefault(); | |
92 | + jQuery(".operating-system-info").show(); | |
93 | + jQuery(".operating-system-button-show").hide(); | |
94 | + jQuery(".operating-system-button-hide").show(); | |
95 | + }); | |
96 | + | |
97 | + jQuery(".database-button-hide").click(function(event){ | |
98 | + event.preventDefault(); | |
99 | + jQuery(".database-info").hide(); | |
100 | + jQuery(".database-button-show").show(); | |
101 | + jQuery(".database-button-hide").hide(); | |
102 | + }); | |
103 | + | |
104 | + jQuery(".database-button-show").click(function(event){ | |
105 | + event.preventDefault(); | |
106 | + jQuery(".database-info").show(); | |
107 | + jQuery(".database-button-show").hide(); | |
108 | + jQuery(".database-button-hide").show(); | |
109 | + }); | |
110 | + | |
111 | + jQuery(".libraries-button-hide").click(function(event){ | |
112 | + event.preventDefault(); | |
113 | + jQuery(".libraries-info").hide(); | |
114 | + jQuery(".libraries-button-show").show(); | |
115 | + jQuery(".libraries-button-hide").hide(); | |
116 | + }); | |
117 | + | |
118 | + jQuery(".libraries-button-show").click(function(event){ | |
119 | + event.preventDefault(); | |
120 | + jQuery(".libraries-info").show(); | |
121 | + jQuery(".libraries-button-show").hide(); | |
122 | + jQuery(".libraries-button-hide").show(); | |
123 | + }); | |
132 | 124 | }); |
133 | -}); | |
125 | +})(); | ... | ... |
public/mpog-software.js
1 | -jQuery(document).ready(function(){ | |
2 | - if(jQuery(".control-panel").size() > 0 && jQuery(".control-panel-edit-profile-group:contains('Software')").size() > 0 ) { | |
3 | - jQuery(".control-panel")[0].innerHTML = jQuery(".control-panel-edit-profile-group:contains('Software')")[0].outerHTML + jQuery(".control-panel")[0].innerHTML | |
4 | - jQuery(".control-panel-edit-profile-group:contains('Software')")[1].remove() | |
1 | +(function(){ | |
2 | + function hide_infos(){ | |
3 | + jQuery(".language-info").hide(); | |
4 | + jQuery(".database-info").hide(); | |
5 | + jQuery(".libraries-info").hide(); | |
6 | + jQuery(".operating-system-info").hide(); | |
7 | + jQuery(".language-button-hide").hide(); | |
8 | + jQuery(".database-button-hide").hide(); | |
9 | + jQuery(".libraries-button-hide").hide(); | |
10 | + jQuery(".operating-system-button-hide").hide(); | |
5 | 11 | } |
6 | -}); | |
7 | 12 | \ No newline at end of file |
13 | + | |
14 | + function add_software_on_control_panel() { | |
15 | + if(jQuery(".control-panel").size() > 0 && jQuery(".control-panel-edit-profile-group:contains('Software')").size() > 0 ) { | |
16 | + jQuery(".control-panel")[0].innerHTML = jQuery(".control-panel-edit-profile-group:contains('Software')")[0].outerHTML + jQuery(".control-panel")[0].innerHTML | |
17 | + jQuery(".control-panel-edit-profile-group:contains('Software')")[1].remove(); | |
18 | + } | |
19 | + } | |
20 | + | |
21 | + jQuery(document).ready(function(){ | |
22 | + add_software_on_control_panel(); | |
23 | + hide_infos(); | |
24 | + }); | |
25 | +})(); | |
8 | 26 | \ No newline at end of file | ... | ... |