Commit da4e538596a42dc0c6d9682eff37cd1060e28029
Committed by
Gabriela Navarro
1 parent
897eb62e
Exists in
master
and in
5 other branches
Refactor javascript of catalog
Signed-off-by: Hebert Douglas <hebertdougl@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
3 changed files
with
55 additions
and
60 deletions
Show diff stats
lib/mpog_software_plugin.rb
public/catalog-filter.js
| ... | ... | @@ -1,59 +0,0 @@ |
| 1 | -jQuery(function(){ | |
| 2 | - function show_head_message() { | |
| 3 | - if (jQuery("#filter-categories-select-catalog").text().blank()){ | |
| 4 | - jQuery("#filter-categories-select-catalog").hide(); | |
| 5 | - jQuery("#filter-option-catalog-software").show(); | |
| 6 | - }else{ | |
| 7 | - jQuery("#filter-categories-select-catalog").show(); | |
| 8 | - jQuery("#filter-option-catalog-software").hide(); | |
| 9 | - } | |
| 10 | - } | |
| 11 | - | |
| 12 | - show_head_message(); | |
| 13 | - | |
| 14 | - jQuery("#filter-categories-option").hide(); | |
| 15 | - jQuery("#filter-option-catalog-software").click(function(){ | |
| 16 | - jQuery("#filter-categories-option").slideDown(); | |
| 17 | - jQuery("#filter-option-catalog-software").hide(); | |
| 18 | - }); | |
| 19 | - | |
| 20 | - jQuery("#filter-categories-option").hide(); | |
| 21 | - jQuery("#filter-categories-select-catalog").click(function(){ | |
| 22 | - jQuery("#filter-categories-option").slideDown(); | |
| 23 | - jQuery("#filter-categories-select-catalog").hide(); | |
| 24 | - }); | |
| 25 | - | |
| 26 | - jQuery("#close-filter-catalog").click(function(){ | |
| 27 | - jQuery("#filter-categories-option").slideUp(); | |
| 28 | - show_head_message(); | |
| 29 | - }); | |
| 30 | - | |
| 31 | - jQuery("#cleanup-filter-catalg").click(function(){ | |
| 32 | - jQuery("#filter-categories-option").slideUp(); | |
| 33 | - jQuery("#filter-option-catalog-software").show(); | |
| 34 | - jQuery("#group-categories input:checked").each(function() { | |
| 35 | - jQuery(this).prop('checked', false); | |
| 36 | - }); | |
| 37 | - }); | |
| 38 | - | |
| 39 | - jQuery(".categories-catalog").click(function(){ | |
| 40 | - jQuery("#filter-categories-option").slideUp(); | |
| 41 | - jQuery("#filter-categories-select-catalog").show(); | |
| 42 | - jQuery("#filter-option-catalog-software").hide(); | |
| 43 | - }); | |
| 44 | - | |
| 45 | - jQuery(".project-software").click(function(){ | |
| 46 | - jQuery("#filter-categories-option").slideUp(); | |
| 47 | - jQuery("#filter-categories-select-catalog").show(); | |
| 48 | - jQuery("#filter-option-catalog-software").hide(); | |
| 49 | - }); | |
| 50 | - | |
| 51 | - function clear_categories_filter(e) { | |
| 52 | - e.preventDefault(); | |
| 53 | - jQuery("#categories-filter input:checked").each(function() { | |
| 54 | - jQuery(this).prop('checked', false); | |
| 55 | - }); | |
| 56 | - } | |
| 57 | -}); | |
| 58 | - | |
| 59 | - |
public/software-catalog.js
| ... | ... | @@ -55,6 +55,51 @@ |
| 55 | 55 | jQuery(this).parent().remove(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + function show_head_message() { | |
| 59 | + if (jQuery("#filter-categories-select-catalog").text().blank()){ | |
| 60 | + jQuery("#filter-categories-select-catalog").hide(); | |
| 61 | + jQuery("#filter-option-catalog-software").show(); | |
| 62 | + }else{ | |
| 63 | + jQuery("#filter-categories-select-catalog").show(); | |
| 64 | + jQuery("#filter-option-catalog-software").hide(); | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + function slideDowsCategoriesOptionAndHideOptionCatalog() { | |
| 69 | + jQuery("#filter-categories-option").slideDown(); | |
| 70 | + jQuery("#filter-option-catalog-software").hide(); | |
| 71 | + } | |
| 72 | + | |
| 73 | + function slideDownCategoriesOptionAndHideCategoriesSelect() { | |
| 74 | + jQuery("#filter-categories-option").slideDown(); | |
| 75 | + jQuery("#filter-categories-select-catalog").hide(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + function slideUpCategoriesAndShowHeadMessage() { | |
| 79 | + jQuery("#filter-categories-option").slideUp(); | |
| 80 | + show_head_message(); | |
| 81 | + } | |
| 82 | + | |
| 83 | + function clearCatalogCheckbox(){ | |
| 84 | + jQuery("#filter-categories-option").slideUp(); | |
| 85 | + jQuery("#filter-option-catalog-software").show(); | |
| 86 | + jQuery("#group-categories input:checked").each(function() { | |
| 87 | + jQuery(this).prop('checked', false); | |
| 88 | + }); | |
| 89 | + } | |
| 90 | + | |
| 91 | + function selectCheckboxCategory() { | |
| 92 | + jQuery("#filter-categories-option").slideUp(); | |
| 93 | + jQuery("#filter-categories-select-catalog").show(); | |
| 94 | + jQuery("#filter-option-catalog-software").hide(); | |
| 95 | + } | |
| 96 | + | |
| 97 | + function selectProjectSoftwareCheckbox() { | |
| 98 | + jQuery("#filter-categories-option").slideUp(); | |
| 99 | + jQuery("#filter-categories-select-catalog").show(); | |
| 100 | + jQuery("#filter-option-catalog-software").hide(); | |
| 101 | + } | |
| 102 | + | |
| 58 | 103 | function set_autocomplate() { |
| 59 | 104 | jQuery("#software-catalog").autocomplete({ |
| 60 | 105 | source : function(request, response){ |
| ... | ... | @@ -84,10 +129,20 @@ |
| 84 | 129 | |
| 85 | 130 | function set_events() { |
| 86 | 131 | jQuery(".catalog-remove-item").click(remote_catalog_item); |
| 132 | + jQuery("#filter-option-catalog-software").click(slideDowsCategoriesOptionAndHideOptionCatalog); | |
| 133 | + jQuery("#filter-categories-select-catalog").click(slideDownCategoriesOptionAndHideCategoriesSelect); | |
| 134 | + jQuery("#close-filter-catalog").click(slideUpCategoriesAndShowHeadMessage); | |
| 135 | + jQuery("#cleanup-filter-catalg").click(clearCatalogCheckbox); | |
| 136 | + jQuery(".categories-catalog").click(selectCheckboxCategory); | |
| 137 | + jQuery(".project-software").click(selectProjectSoftwareCheckbox); | |
| 87 | 138 | } |
| 88 | 139 | |
| 140 | + | |
| 89 | 141 | jQuery(document).ready(function(){ |
| 90 | 142 | set_autocomplate(); |
| 91 | 143 | set_events(); |
| 144 | + show_head_message(); | |
| 145 | + jQuery("#filter-categories-option").hide(); | |
| 92 | 146 | }); |
| 147 | + | |
| 93 | 148 | })(); | ... | ... |