Merge Request #16
Divergência da informação do filtro de categorias
Issue no repositório softwarepublico/noosfero: https://softwarepublico.gov.br/gitlab/softwarepublico/noosfero/issues/387
Issue no repositório softwarepublico/softwarepublico: https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/issues/227
-
Remove disabled communities from catalog See merge request !15
-
- This commit does not add the po file translations since the translations are now made on branch stable, which solves problems on po files. Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com>
-
This reverts commit 8f80f666d6a0b008deb79d9477fcaeddba96d48a.
-
Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com>
-
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
-
Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com>
@@ -89,7 +89,7 @@ class SearchController | @@ -89,7 +89,7 @@ class SearchController | ||
89 | def get_communities_list software_list | 89 | def get_communities_list software_list |
90 | filtered_community_list = [] | 90 | filtered_community_list = [] |
91 | software_list.each do |software| | 91 | software_list.each do |software| |
92 | - if @all_selected || software.public_software? | 92 | + if !@public_software_selected || software.public_software? |
93 | filtered_community_list << software.community unless software.community.nil? | 93 | filtered_community_list << software.community unless software.community.nil? |
94 | end | 94 | end |
95 | end | 95 | end |
@@ -13,15 +13,15 @@ class SoftwareInfo < ActiveRecord::Base | @@ -13,15 +13,15 @@ class SoftwareInfo < ActiveRecord::Base | ||
13 | DatabaseDescription | 13 | DatabaseDescription |
14 | ] | 14 | ] |
15 | 15 | ||
16 | - scope :search_by_query, lambda {|query = ""| | 16 | + scope :search_by_query, lambda { |query = ""| |
17 | filtered_query = query.gsub(/[\|\(\)\\\/\s\[\]'"*%&!:]/,' ').split.map{|w| w += ":*"}.join('|') | 17 | filtered_query = query.gsub(/[\|\(\)\\\/\s\[\]'"*%&!:]/,' ').split.map{|w| w += ":*"}.join('|') |
18 | search_fields = SoftwareInfo.pg_search_plugin_fields | 18 | search_fields = SoftwareInfo.pg_search_plugin_fields |
19 | 19 | ||
20 | if query.empty? | 20 | if query.empty? |
21 | - SoftwareInfo.all | 21 | + SoftwareInfo.joins(:community).where("profiles.visible = ?", true) |
22 | else | 22 | else |
23 | searchable_software_objects = SoftwareInfo.transform_list_in_methods_list(SEARCHABLE_SOFTWARE_CLASSES) | 23 | searchable_software_objects = SoftwareInfo.transform_list_in_methods_list(SEARCHABLE_SOFTWARE_CLASSES) |
24 | - includes(searchable_software_objects).where("to_tsvector('simple', #{search_fields}) @@ to_tsquery('#{filtered_query}')") | 24 | + includes(searchable_software_objects).where("to_tsvector('simple', #{search_fields}) @@ to_tsquery('#{filtered_query}')").where("profiles.visible = ?", true) |
25 | end | 25 | end |
26 | } | 26 | } |
27 | 27 |
@@ -214,6 +214,31 @@ class SearchControllerTest < ActionController::TestCase | @@ -214,6 +214,31 @@ class SearchControllerTest < ActionController::TestCase | ||
214 | assert_not_includes assigns(:searches)[:software_infos][:results], software_one.community | 214 | assert_not_includes assigns(:searches)[:software_infos][:results], software_one.community |
215 | end | 215 | end |
216 | 216 | ||
217 | + should "software_infos search return only enabled softwares" do | ||
218 | + s1 = SoftwareInfo.first | ||
219 | + s2 = SoftwareInfo.last | ||
220 | + | ||
221 | + # First get them all normally | ||
222 | + get( | ||
223 | + :software_infos, | ||
224 | + :query => "software" | ||
225 | + ) | ||
226 | + | ||
227 | + assert_includes assigns(:searches)[:software_infos][:results], s1.community | ||
228 | + assert_includes assigns(:searches)[:software_infos][:results], s2.community | ||
229 | + | ||
230 | + s2.community.disable | ||
231 | + | ||
232 | + # Now it should not contain the disabled community | ||
233 | + get( | ||
234 | + :software_infos, | ||
235 | + :query => "software" | ||
236 | + ) | ||
237 | + | ||
238 | + assert_includes assigns(:searches)[:software_infos][:results], s1.community | ||
239 | + assert_not_includes assigns(:searches)[:software_infos][:results], s2.community | ||
240 | + end | ||
241 | + | ||
217 | private | 242 | private |
218 | 243 | ||
219 | def create_software_categories | 244 | def create_software_categories |
1 | <% if block.owner.categories.count > 0 %> | 1 | <% if block.owner.categories.count > 0 %> |
2 | - <h3 class="block-title"><span><%= _("Categories") %></span></h3> | 2 | + <h3 class="block-title"><span><%= _("Categories:") %></span></h3> |
3 | 3 | ||
4 | <div class="category_cloud"> | 4 | <div class="category_cloud"> |
5 | <% block.owner.categories.each do |category| %> | 5 | <% block.owner.categories.each do |category| %> |
1 | <div class="software-metrics-block"> | 1 | <div class="software-metrics-block"> |
2 | <ul class="metrics-list"> | 2 | <ul class="metrics-list"> |
3 | - <li><span class="arrow-globe-icon"></span><%= pluralize(profile.hits, 'visita', 'visitas') %></li> | ||
4 | - <li><span class="downloads-icon"></span><%= pluralize(total_downloads, 'download', 'downloads') %></li> | ||
5 | - <li><span class="face-icon"></span><%= block.benefited_people.to_s + _(' benefited people*') %></li> | ||
6 | - <li><span class="pig-safe-icon"></span><strong class="saved-money"><%= number_to_currency(block.saved_resources, unit: 'R$ ', separator: ',', delimiter: '.') %></strong> <%= _(' saved resources*') %></li> | 3 | + <li> |
4 | + <span class="arrow-globe-icon"></span> | ||
5 | + <span id="visit-count"> | ||
6 | + <%= pluralize(profile.hits, 'visita', 'visitas') %> | ||
7 | + </span> | ||
8 | + </li> | ||
9 | + <li> | ||
10 | + <span class="downloads-icon"></span> | ||
11 | + <span id="downloads-count"> | ||
12 | + <%= pluralize(total_downloads, 'download', 'downloads') %> | ||
13 | + </span> | ||
14 | + </li> | ||
15 | + <li> | ||
16 | + <span class="face-icon"></span> | ||
17 | + <span id="benefited-people"> | ||
18 | + <%= block.benefited_people.to_s + _(' benefited people*') %> | ||
19 | + </span> | ||
20 | + </li> | ||
21 | + <li> | ||
22 | + <span class="pig-safe-icon"></span> | ||
23 | + <span id="saved-resources"> | ||
24 | + <strong class="saved-money"> | ||
25 | + <%= number_to_currency(block.saved_resources, unit: 'R$ ', | ||
26 | + separator: ',', delimiter: '.') %> | ||
27 | + </strong> | ||
28 | + <%= _(' saved resources*') %> | ||
29 | + </span> | ||
30 | + </li> | ||
7 | </ul> | 31 | </ul> |
8 | 32 | ||
9 | - <div class="admin-estimation">* <%= _("Data estimated by the software administrator.") %></div> | 33 | + <div class="admin-estimation"> |
34 | + * <%= _("Data estimated by the software administrator.") %> | ||
35 | + </div> | ||
10 | </div> | 36 | </div> |
1 | <div class="aditional-informations"> | 1 | <div class="aditional-informations"> |
2 | <div class="comments-people-benefited"> | 2 | <div class="comments-people-benefited"> |
3 | - <span>People benefited :</span> <%= user_rating.people_benefited unless user_rating.nil? %> | 3 | + <span><%=_("Benefited People")%> :</span> <%= user_rating.people_benefited unless user_rating.nil? %> |
4 | </div> | 4 | </div> |
5 | 5 | ||
6 | <div class="comments-saved-value"> | 6 | <div class="comments-saved-value"> |
7 | - <span>Saved Value :</span> <%= user_rating.saved_value unless user_rating.nil? %> | 7 | + <span><%=_("Saved Resources")%> :</span> <%= user_rating.saved_value unless user_rating.nil? %> |
8 | </div> | 8 | </div> |
9 | </div> | 9 | </div> |
10 | 10 |
-
@simiaosimis @thiago por questões de conflito eu desfiz esse commit e refiz sem a parte das traduções e já está na master e na stable... porém eu não consegui identificar quais traduções vocês fazem, se é apenas essas do beneficiarios e recursos economizados, se for está OK, se não for tem que regerar a tradução na stable e traduzir o que foi feito nesse commit. me pinguem plx pra resolver isso
-
mentioned in commit e89047ef388db6174b8afcda6c6a95fc68d6874a
-
@tallysmartins Eram só esse dois lugares mesmo (Benefited People, Saved Resources), então tudo certo.
-
em relação ao %d em ver todos é problema de traduçao, logo quando gerar as traduções certas deve resolver.
-
Status changed to closed
-
Status changed to reopened
-
mentioned in commit b9d88f8825c3015bff31e6b70f7c0f26c9d6d567