Commit b5a7adfd00b15ad4c2fc0be716001305d5604608
1 parent
003bfdd8
Exists in
sisp_simple_version
Update template of sisp software into import_sisp_software task
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Showing
1 changed file
with
14 additions
and
6 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
| ... | ... | @@ -3,16 +3,24 @@ |
| 3 | 3 | namespace :software do |
| 4 | 4 | desc "Creates SISP software template" |
| 5 | 5 | task :create_sisp_template => :environment do |
| 6 | - env = Environment.find_by_name("sisp") | |
| 6 | + env = Environment.default | |
| 7 | 7 | |
| 8 | 8 | if env.present? |
| 9 | 9 | template = Community.where(identifier: "sisp-software", environment_id: env).last |
| 10 | - template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) | |
| 10 | + template.destroy if template | |
| 11 | + template = Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) | |
| 11 | 12 | |
| 12 | - template.boxes.find_by_position(1).blocks = [] | |
| 13 | - template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new | |
| 14 | - template.boxes.find_by_position(1).blocks << SispTabDataBlock.new | |
| 15 | - template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new | |
| 13 | + template.update_layout_template("leftbar") | |
| 14 | + | |
| 15 | + template.boxes.find_by_position(2).blocks.destroy_all | |
| 16 | + | |
| 17 | + main_block = template.boxes.first.blocks.find_by_type("MainBlock") | |
| 18 | + main_block.display = "except_home_page" | |
| 19 | + main_block.save | |
| 20 | + | |
| 21 | + template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new(:display => "home_page_only") | |
| 22 | + template.boxes.find_by_position(1).blocks << SispTabDataBlock.new(:display => "home_page_only") | |
| 23 | + template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new(:display => "home_page_only") | |
| 16 | 24 | template.save! |
| 17 | 25 | |
| 18 | 26 | env.community_default_template = template | ... | ... |