Commit d3f7fbfea12de4b58e13e5023b0772032e43973e
1 parent
548b315e
Exists in
master
and in
2 other branches
Rename communities_rating to organization_ratings
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Simiao Carvalho <simiaosimis@gmail.com>
Showing
2 changed files
with
53 additions
and
52 deletions
Show diff stats
db/migrate/20150904181508_add_communities_ratings_block_to_all_softwares_communities.rb
@@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
1 | -class AddCommunitiesRatingsBlockToAllSoftwaresCommunities < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - software_template = Community["software"] | ||
4 | - if software_template | ||
5 | - software_area_one = software_template.boxes.find_by_position 1 | ||
6 | - | ||
7 | - template_ratings_block = CommunitiesRatingsBlock.new :mirror => true, :move_modes => "none", :edit_modes => "none" | ||
8 | - template_ratings_block.settings[:fixed] = true | ||
9 | - template_ratings_block.display = "home_page_only" | ||
10 | - template_ratings_block.save! | ||
11 | - print "." | ||
12 | - | ||
13 | - software_area_one.blocks << template_ratings_block | ||
14 | - software_area_one.save! | ||
15 | - print "." | ||
16 | - | ||
17 | - # Puts the ratings block as the last one on area one | ||
18 | - last_block_position = software_area_one.blocks.order(:position).last.position | ||
19 | - template_ratings_block.position = last_block_position + 1 | ||
20 | - template_ratings_block.save! | ||
21 | - print "." | ||
22 | - end | ||
23 | - | ||
24 | - Community.joins(:software_info).each do |software_community| | ||
25 | - software_area_one = software_community.boxes.find_by_position 1 | ||
26 | - print "." | ||
27 | - | ||
28 | - ratings_block = CommunitiesRatingsBlock.new :move_modes => "none", :edit_modes => "none" | ||
29 | - ratings_block.settings[:fixed] = true | ||
30 | - ratings_block.display = "home_page_only" | ||
31 | - ratings_block.mirror_block_id = template_ratings_block.id | ||
32 | - ratings_block.save! | ||
33 | - print "." | ||
34 | - | ||
35 | - software_area_one.blocks << ratings_block | ||
36 | - software_area_one.save! | ||
37 | - print "." | ||
38 | - | ||
39 | - # Puts the ratings block as the last one on area one | ||
40 | - last_block_position = software_area_one.blocks.order(:position).last.position | ||
41 | - ratings_block.position = last_block_position + 1 | ||
42 | - ratings_block.save! | ||
43 | - print "." | ||
44 | - end | ||
45 | - | ||
46 | - puts "" | ||
47 | - end | ||
48 | - | ||
49 | - def down | ||
50 | - say "This can't be reverted" | ||
51 | - end | ||
52 | -end |
db/migrate/20150904181508_add_organization_ratings_block_to_all_softwares_communities.rb
0 → 100644
@@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
1 | +class AddOrganizationRatingsBlockToAllSoftwaresCommunities < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + software_template = Community["software"] | ||
4 | + | ||
5 | + if software_template | ||
6 | + software_area_one = software_template.boxes.find_by_position 1 | ||
7 | + | ||
8 | + template_ratings_block = OrganizationRatingsBlock.new :mirror => true, :move_modes => "none", :edit_modes => "none" | ||
9 | + template_ratings_block.settings[:fixed] = true | ||
10 | + template_ratings_block.display = "home_page_only" | ||
11 | + template_ratings_block.save! | ||
12 | + print "." | ||
13 | + | ||
14 | + software_area_one.blocks << template_ratings_block | ||
15 | + software_area_one.save! | ||
16 | + print "." | ||
17 | + | ||
18 | + # Puts the ratings block as the last one on area one | ||
19 | + last_block_position = software_area_one.blocks.order(:position).last.position | ||
20 | + template_ratings_block.position = last_block_position + 1 | ||
21 | + template_ratings_block.save! | ||
22 | + print "." | ||
23 | + end | ||
24 | + | ||
25 | + Community.joins(:software_info).each do |software_community| | ||
26 | + software_area_one = software_community.boxes.find_by_position 1 | ||
27 | + print "." | ||
28 | + | ||
29 | + ratings_block = OrganizationRatingsBlock.new :move_modes => "none", :edit_modes => "none" | ||
30 | + ratings_block.settings[:fixed] = true | ||
31 | + ratings_block.display = "home_page_only" | ||
32 | + ratings_block.mirror_block_id = template_ratings_block.id | ||
33 | + ratings_block.save! | ||
34 | + print "." | ||
35 | + | ||
36 | + software_area_one.blocks << ratings_block | ||
37 | + software_area_one.save! | ||
38 | + print "." | ||
39 | + | ||
40 | + # Puts the ratings block as the last one on area one | ||
41 | + last_block_position = software_area_one.blocks.order(:position).last.position | ||
42 | + ratings_block.position = last_block_position + 1 | ||
43 | + ratings_block.save! | ||
44 | + print "." | ||
45 | + end | ||
46 | + | ||
47 | + puts "" | ||
48 | + end | ||
49 | + | ||
50 | + def down | ||
51 | + say "This can't be reverted" | ||
52 | + end | ||
53 | +end |