Commit d5c76ada8c88e6d0a8f99d432e907f2b7cd34e2a
1 parent
1c8c8adb
Exists in
sisp_dev
Fix categories search for multi environments
Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Showing
6 changed files
with
9 additions
and
9 deletions
Show diff stats
src/noosfero-spb/gov_user/lib/public_institution.rb
@@ -2,8 +2,6 @@ class PublicInstitution < Institution | @@ -2,8 +2,6 @@ class PublicInstitution < Institution | ||
2 | validates :governmental_power, :governmental_sphere, :juridical_nature, | 2 | validates :governmental_power, :governmental_sphere, :juridical_nature, |
3 | :presence=>true | 3 | :presence=>true |
4 | 4 | ||
5 | - validates :acronym, :allow_blank => true, :allow_nil => true | ||
6 | - | ||
7 | validates :cnpj, | 5 | validates :cnpj, |
8 | :format => {with: CNPJ_FORMAT}, | 6 | :format => {with: CNPJ_FORMAT}, |
9 | :unless => 'cnpj.blank?' | 7 | :unless => 'cnpj.blank?' |
src/noosfero-spb/noosfero-spb-theme/css/software-catalog-page.css
@@ -628,9 +628,9 @@ | @@ -628,9 +628,9 @@ | ||
628 | .action-search-sisp #filter-catalog-software #filter-categories-option { | 628 | .action-search-sisp #filter-catalog-software #filter-categories-option { |
629 | border: none; | 629 | border: none; |
630 | height: 0; | 630 | height: 0; |
631 | - max-height: 620px; | 631 | + max-height: auto; |
632 | position: relative; | 632 | position: relative; |
633 | - overflow: hidden; | 633 | + overflow: auto; |
634 | padding: 0 15px; | 634 | padding: 0 15px; |
635 | } | 635 | } |
636 | 636 |
src/noosfero-spb/software_communities/lib/categories_software_block.rb
@@ -19,7 +19,7 @@ class CategoriesSoftwareBlock < Block | @@ -19,7 +19,7 @@ class CategoriesSoftwareBlock < Block | ||
19 | block = self | 19 | block = self |
20 | s = show_name | 20 | s = show_name |
21 | 21 | ||
22 | - software_category = Category.find_by_name("Software") | 22 | + software_category = environment.categories.find_by_name("Software") |
23 | categories = [] | 23 | categories = [] |
24 | categories = software_category.children.sort if software_category | 24 | categories = software_category.children.sort if software_category |
25 | 25 |
src/noosfero-spb/software_communities/lib/ext/search_controller.rb
@@ -177,7 +177,9 @@ class SearchController | @@ -177,7 +177,9 @@ class SearchController | ||
177 | end | 177 | end |
178 | 178 | ||
179 | def prepare_software_infos_category_groups &software_condition_block | 179 | def prepare_software_infos_category_groups &software_condition_block |
180 | - @categories = Category.software_categories | 180 | + @categories = [] |
181 | + software_category = environment.categories.find_by_name("Software") | ||
182 | + @categories = software_category.children.sort if software_category | ||
181 | @categories = @categories.select{|category| category.software_infos.any?{|software| software_condition_block.call(software)}} | 183 | @categories = @categories.select{|category| category.software_infos.any?{|software| software_condition_block.call(software)}} |
182 | @categories.sort!{|a, b| a.name <=> b.name} | 184 | @categories.sort!{|a, b| a.name <=> b.name} |
183 | end | 185 | end |
src/noosfero-spb/software_communities/lib/tasks/create_categories.rake
@@ -4,9 +4,9 @@ namespace :software do | @@ -4,9 +4,9 @@ namespace :software do | ||
4 | Environment.all.each do |env| | 4 | Environment.all.each do |env| |
5 | if env.plugin_enabled?("SoftwareCommunitiesPlugin") or env.plugin_enabled?("SoftwareCommunities") | 5 | if env.plugin_enabled?("SoftwareCommunitiesPlugin") or env.plugin_enabled?("SoftwareCommunities") |
6 | print 'Creating categories: ' | 6 | print 'Creating categories: ' |
7 | - software = Category.create(:name => _("Software"), :environment => env) | 7 | + software = env.categories.find_or_create_by_name(_("Software")) |
8 | Category::SOFTWARE_CATEGORIES.each do |category_name| | 8 | Category::SOFTWARE_CATEGORIES.each do |category_name| |
9 | - unless Category.find_by_name(category_name) | 9 | + unless env.categories.find_by_name(category_name) |
10 | print '.' | 10 | print '.' |
11 | Category.create(:name => category_name, :environment => env, :parent => software) | 11 | Category.create(:name => category_name, :environment => env, :parent => software) |
12 | else | 12 | else |
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
@@ -86,7 +86,7 @@ namespace :sisp do | @@ -86,7 +86,7 @@ namespace :sisp do | ||
86 | $imported_data = YAML.load_file('plugins/software_communities/public/static/sisp-catalog.yml') | 86 | $imported_data = YAML.load_file('plugins/software_communities/public/static/sisp-catalog.yml') |
87 | $env = Environment.find_by_name("SISP") | 87 | $env = Environment.find_by_name("SISP") |
88 | 88 | ||
89 | - $software_category = Category.find_or_create_by_name("Software") | 89 | + $software_category = $env.categories.find_or_create_by_name("Software") |
90 | $software_category.environment = $env | 90 | $software_category.environment = $env |
91 | $software_category.save! | 91 | $software_category.save! |
92 | 92 |