Commit bc8a2881ada30a9faee136a619a140407c0cc675
1 parent
15e383f6
Exists in
master
and in
5 other branches
Change the messages of the catalog when any software is found.
TODO: Add link to the categories that the user already selected. Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
2 changed files
with
25 additions
and
3 deletions
Show diff stats
public/software-catalog.js
| ... | ... | @@ -93,6 +93,23 @@ |
| 93 | 93 | return params; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | + function get_result_div_core(message){ | |
| 97 | + var div_result = $(".search-results-type-empty"); | |
| 98 | + var html = '<div class="search-results-innerbox search-results-type-empty"> <div>'+message+' </div></div>' | |
| 99 | + | |
| 100 | + div_result.replaceWith('<div class="search-results-innerbox search-results-type-empty"> <div>Nenhum software encontrado</div> '+message+'</div>') | |
| 101 | + } | |
| 102 | + | |
| 103 | + function catalog_message(){ | |
| 104 | + var result_list = $("#search-results").find('.search-results-empty').html(); | |
| 105 | + var selected_categories_field = $("#filter-categories-select-catalog"); | |
| 106 | + | |
| 107 | + if(result_list.length > 1 && selected_categories_field.html().length < 1){ | |
| 108 | + get_result_div_core("Tente filtros mais abrangentes"); | |
| 109 | + }else if (result_list.length > 1 && selected_categories_field.html().length >= 1) { | |
| 110 | + get_result_div_core("Tente filtros mais abrangentes ou confira os <mudar>softwares das categorias individualmente</mudar>"); | |
| 111 | + } | |
| 112 | + } | |
| 96 | 113 | |
| 97 | 114 | function update_search_page_on_ajax(response) { |
| 98 | 115 | response = $(response); |
| ... | ... | @@ -106,6 +123,8 @@ |
| 106 | 123 | var result_pagination = response.find("#software-pagination").html(); |
| 107 | 124 | var result_software_count = response.find("#software-count").html(); |
| 108 | 125 | |
| 126 | + catalog_message() | |
| 127 | + | |
| 109 | 128 | search_list.html(result_list); |
| 110 | 129 | selected_categories_field.html(result_categories); |
| 111 | 130 | pagination.html(result_pagination); |
| ... | ... | @@ -188,10 +207,13 @@ |
| 188 | 207 | search_input_keyup(); |
| 189 | 208 | } |
| 190 | 209 | |
| 191 | - | |
| 192 | 210 | $(document).ready(function(){ |
| 193 | 211 | set_events(); |
| 212 | + catalog_message(); | |
| 194 | 213 | show_head_message(); |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 195 | 217 | $("#filter-categories-option").hide(); |
| 196 | 218 | }); |
| 197 | 219 | })(jQuery); | ... | ... |
views/search/_catalog_filter.html.erb
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | <div id="filter-option-catalog-software"><%= _("More options") %></div> |
| 6 | 6 | <!--Quando tiver filtros(categorias)selecionados mostrar esta opção: Opções selecionadas--> |
| 7 | 7 | |
| 8 | - <div id="filter-categories-select-catalog"> <%= @message_selected_options %> </div> | |
| 8 | + <div id="filter-categories-select-catalog"><%= @message_selected_options %></div> | |
| 9 | 9 | |
| 10 | 10 | <div id="filter-categories-option"> |
| 11 | 11 | |
| ... | ... | @@ -42,4 +42,4 @@ |
| 42 | 42 | <%= button_tag _("Close"), :id => "close-filter-catalog", :type => "button" %> |
| 43 | 43 | </div> |
| 44 | 44 | </div> |
| 45 | -</div> | |
| 46 | 45 | \ No newline at end of file |
| 46 | +</div> | ... | ... |