Commit cce16a6b2e0dbb8072488cf1cf42810b9d507a90
1 parent
823ea691
Exists in
sisp_simple_version
Minor changes o search catalog block to work with SISP
Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
7 changed files
with
19 additions
and
4 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/categories_software_block.rb
1 | class CategoriesSoftwareBlock < Block | 1 | class CategoriesSoftwareBlock < Block |
2 | 2 | ||
3 | attr_accessible :show_name | 3 | attr_accessible :show_name |
4 | + attr_accessible :search_catalog | ||
4 | 5 | ||
5 | settings_items :show_name, :type => :boolean, :default => false | 6 | settings_items :show_name, :type => :boolean, :default => false |
7 | + settings_items :search_catalog, :type => :string, :default => SearchController.catalog_list[:public_software].last | ||
6 | 8 | ||
7 | def self.description | 9 | def self.description |
8 | _('Categories Softwares') | 10 | _('Categories Softwares') |
src/noosfero-spb/software_communities/lib/ext/search_controller.rb
@@ -2,6 +2,11 @@ require_dependency 'search_controller' | @@ -2,6 +2,11 @@ require_dependency 'search_controller' | ||
2 | 2 | ||
3 | class SearchController | 3 | class SearchController |
4 | 4 | ||
5 | + def self.catalog_list | ||
6 | + { :public_software => ["Software Público", "software_infos"], | ||
7 | + :sisp_software => ["SISP", "sisp"] } | ||
8 | + end | ||
9 | + | ||
5 | def communities | 10 | def communities |
6 | delete_communities = [] | 11 | delete_communities = [] |
7 | valid_communities_string = Community.get_valid_communities_string | 12 | valid_communities_string = Community.get_valid_communities_string |
src/noosfero-spb/software_communities/lib/search_catalog_block.rb
1 | class SearchCatalogBlock < Block | 1 | class SearchCatalogBlock < Block |
2 | 2 | ||
3 | attr_accessible :show_name | 3 | attr_accessible :show_name |
4 | + attr_accessible :search_catalog | ||
4 | 5 | ||
5 | settings_items :show_name, :type => :boolean, :default => false | 6 | settings_items :show_name, :type => :boolean, :default => false |
7 | + settings_items :search_catalog, :type => :string, :default => SearchController.catalog_list[:public_software].last | ||
6 | 8 | ||
7 | def self.description | 9 | def self.description |
8 | _('Search Softwares catalog') | 10 | _('Search Softwares catalog') |
src/noosfero-spb/software_communities/views/blocks/categories_software.html.erb
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | 10 | ||
11 | <% categories.each do |category| %> | 11 | <% categories.each do |category| %> |
12 | <% unless category.software_infos.count < 1 %> | 12 | <% unless category.software_infos.count < 1 %> |
13 | - <li><%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => :software_infos, :selected_categories_id => [category.id]} %></li> | 13 | + <li><%= link_to _("#{category.name}") + " (#{category.software_infos.count})", {:controller => :search, :action => block.search_catalog, :selected_categories_id => [category.id]} %></li> |
14 | <% end %> | 14 | <% end %> |
15 | <% end %> | 15 | <% end %> |
16 | </ul> | 16 | </ul> |
src/noosfero-spb/software_communities/views/blocks/search_catalog.html.erb
1 | <div id="catalogo-software-search"> | 1 | <div id="catalogo-software-search"> |
2 | <h1><%= _("Catalog of Software") %></h1> | 2 | <h1><%= _("Catalog of Software") %></h1> |
3 | - <%= form_tag(controller: "search", action: "software_infos", method: "get") do %> | 3 | + <%= form_tag(controller: "search", action: block.search_catalog, method: "get") do %> |
4 | <%= text_field_tag(:query, nil, :placeholder => "e.g: cacic, e-cidade, gsan, etc", :class=>"searchField", :id=>"search-Gadget") %> | 4 | <%= text_field_tag(:query, nil, :placeholder => "e.g: cacic, e-cidade, gsan, etc", :class=>"searchField", :id=>"search-Gadget") %> |
5 | <%= submit_tag(_("Search"), {:class=>"searchButton-catalog"})%> | 5 | <%= submit_tag(_("Search"), {:class=>"searchButton-catalog"})%> |
6 | <% end %> | 6 | <% end %> |
7 | 7 | ||
8 | <div id="search-catalog-footer"> | 8 | <div id="search-catalog-footer"> |
9 | - <p><%= link_to _("Access the complete catalog"), {controller: "search", action: "software_infos"} , {:id => "bt_catalog-search"}%></p> | 9 | + <p><%= link_to _("Access the complete catalog"), {controller: "search", action: block.search_catalog} , {:id => "bt_catalog-search"}%></p> |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
src/noosfero-spb/software_communities/views/box_organizer/_categories_software_block.html.erb
0 → 100644
src/noosfero-spb/software_communities/views/box_organizer/_search_catalog_block.html.erb
@@ -2,5 +2,5 @@ | @@ -2,5 +2,5 @@ | ||
2 | <% catalog_list = SearchController.catalog_list.collect{|i,v| v} %> | 2 | <% catalog_list = SearchController.catalog_list.collect{|i,v| v} %> |
3 | 3 | ||
4 | <label class="formlabel"><%= _("Catalog: ") %></label> | 4 | <label class="formlabel"><%= _("Catalog: ") %></label> |
5 | - <%= select 'block', 'search_action', catalog_list %> | 5 | + <%= select 'block', 'search_catalog', catalog_list %> |
6 | </div> | 6 | </div> |