Commit 003bfdd8c1f1798997b0d8585694cdfe6a13d126
1 parent
e8fdb715
Exists in
sisp_simple_version
Finishing SISP software template
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Showing
1 changed file
with
9 additions
and
7 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
... | ... | @@ -3,18 +3,20 @@ |
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") | |
7 | - env = Environment.default #TODO change this to correct environment | |
6 | + env = Environment.find_by_name("sisp") | |
8 | 7 | |
9 | 8 | if env.present? |
10 | 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) | |
11 | 11 | |
12 | - unless template | |
13 | - template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) | |
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 | |
16 | + template.save! | |
14 | 17 | |
15 | - template.boxes.find_by_position(1).blocks << StatisticBlock.new | |
16 | - template.save! | |
17 | - end | |
18 | + env.community_default_template = template | |
19 | + env.save! | |
18 | 20 | end |
19 | 21 | end |
20 | 22 | ... | ... |