diff --git a/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake b/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake index 15ec96c..7c70dc7 100755 --- a/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake +++ b/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake @@ -3,16 +3,24 @@ namespace :software do desc "Creates SISP software template" task :create_sisp_template => :environment do - env = Environment.find_by_name("sisp") + env = Environment.default if env.present? template = Community.where(identifier: "sisp-software", environment_id: env).last - template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) + template.destroy if template + template = Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) - template.boxes.find_by_position(1).blocks = [] - template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new - template.boxes.find_by_position(1).blocks << SispTabDataBlock.new - template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new + template.update_layout_template("leftbar") + + template.boxes.find_by_position(2).blocks.destroy_all + + main_block = template.boxes.first.blocks.find_by_type("MainBlock") + main_block.display = "except_home_page" + main_block.save + + template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new(:display => "home_page_only") + template.boxes.find_by_position(1).blocks << SispTabDataBlock.new(:display => "home_page_only") + template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new(:display => "home_page_only") template.save! env.community_default_template = template -- libgit2 0.21.2