Commit db20687826650adc205ae21712c4976273f70a8c
Committed by
Álvaro Fernando Matos de Souza
1 parent
8c6e1dba
Exists in
master
and in
5 other branches
Add radio_buttons for search type of software
Showing
4 changed files
with
21 additions
and
21 deletions
Show diff stats
lib/ext/search_controller.rb
... | ... | @@ -80,7 +80,7 @@ class SearchController |
80 | 80 | def get_communities_list software_list |
81 | 81 | filtered_community_list = [] |
82 | 82 | software_list.each do |software| |
83 | - if @include_non_public || software.public_software? | |
83 | + if @all_selected || software.public_software? | |
84 | 84 | filtered_community_list << software.community unless software.community.nil? |
85 | 85 | end |
86 | 86 | end |
... | ... | @@ -110,7 +110,8 @@ class SearchController |
110 | 110 | @selected_categories_id = params[:selected_categories_id] |
111 | 111 | @selected_categories_id ||= [] |
112 | 112 | @selected_categories_id = @selected_categories_id.map(&:to_i) |
113 | - @include_non_public = params[:include_non_public] == "true" | |
113 | + @all_selected = params[:software_type] == "all" | |
114 | + @public_software_selected = !@all_selected | |
114 | 115 | @per_page = prepare_per_page |
115 | 116 | end |
116 | 117 | ... | ... |
public/views/search-software-catalog.js
... | ... | @@ -39,7 +39,11 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat |
39 | 39 | params.software_display = $("#software_display").val(); |
40 | 40 | params.sort = $("#sort").val(); |
41 | 41 | |
42 | - params.include_non_public = $("#include_non_public").is(":checked"); | |
42 | + if($("#all_radio_button").is(":checked")) { | |
43 | + params.software_type = $("#all_radio_button").val(); | |
44 | + } else { | |
45 | + params.software_type = $("#public_software_radio_button").val(); | |
46 | + } | |
43 | 47 | |
44 | 48 | return params; |
45 | 49 | } | ... | ... |
views/search/_catalog_filter.html.erb
... | ... | @@ -12,14 +12,6 @@ |
12 | 12 | <% end %> |
13 | 13 | </ul> |
14 | 14 | </div> |
15 | - | |
16 | - <div class="project-software"> <%= _("Software Projects:") %> | |
17 | - <label> | |
18 | - <%= check_box_tag("include_non_public", true, @include_non_public) %> | |
19 | - <%= _("Include in results") %> | |
20 | - </label> | |
21 | - <span class="doubts-catalog-software" title="<%= _('Include software development projects that are not yet officially Brazilian Public Software.') %>">?</span> | |
22 | - </div> | |
23 | 15 | </div> |
24 | 16 | <div id="filter-option-catalog-software"><%= _("More options") %></div> |
25 | 17 | <div id="filter-option-catalog-close"> | ... | ... |
views/search/_software_search_form.html.erb
... | ... | @@ -5,19 +5,22 @@ |
5 | 5 | <%= form_tag( { :controller => 'search', :action => @asset ? @asset : 'index', :asset => nil, :category_path => ( @category ? @category.path : nil ) }, |
6 | 6 | :method => 'get') do %> |
7 | 7 | |
8 | - <div style="margin:0;padding:0;display:inline"> | |
9 | - <input name="utf8" type="hidden" value="✓" /> | |
10 | - </div> | |
11 | - <%= hidden_field_tag :display, params[:display] %> | |
12 | - <%= hidden_field_tag :filter, params[:filter] %> | |
8 | + <div style="margin:0;padding:0;display:inline"> | |
9 | + <input name="utf8" type="hidden" value="✓" /></div> | |
10 | + | |
11 | + <%= hidden_field_tag :display, params[:display] %> | |
12 | + <%= hidden_field_tag :filter, params[:filter] %> | |
13 | + | |
14 | + <%= labelled_radio_button _('Public Software'), :software_type, 'public_software', @public_software_selected, :id => "public_software_radio_button", :class => "project-software" %> | |
15 | + <%= labelled_radio_button _('All'), :software_type, 'all', @all_selected, :id => "all_radio_button", :class => "project-software" %> | |
13 | 16 | |
14 | - <div class="search-field"> | |
15 | - <span class="formfield"> | |
16 | - <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software you're looking for (the search begins after 3 characters)") %> | |
17 | - </span> | |
17 | + <div class="search-field"> | |
18 | + <span class="formfield"> | |
19 | + <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software you're looking for (the search begins after 3 characters)") %> | |
20 | + </span> | |
18 | 21 | |
19 | 22 | <%= submit_button(:search, _('Filter')) %> |
20 | - </div> | |
23 | + </div> | |
21 | 24 | <%= render :partial => 'search_form_extra_fields' %> |
22 | 25 | <%= render :partial => 'catalog_filter' %> |
23 | 26 | <% end %> | ... | ... |