Commit 9132007fbce532088642542dad1a61cefd767ea4
Committed by
Rodrigo Souto
1 parent
59c6019c
Exists in
master
and in
29 other branches
Applying merge request revisions
Signed-off-by: André Bernardes <andrebsguedes@gmail.com> Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Showing
5 changed files
with
22 additions
and
18 deletions
Show diff stats
app/models/environment.rb
... | ... | @@ -19,6 +19,8 @@ class Environment < ActiveRecord::Base |
19 | 19 | filename |
20 | 20 | end |
21 | 21 | |
22 | + NUMBER_OF_BOXES = 4 | |
23 | + | |
22 | 24 | PERMISSIONS['Environment'] = { |
23 | 25 | 'view_environment_admin_panel' => N_('View environment admin panel'), |
24 | 26 | 'edit_environment_features' => N_('Edit environment features'), |
... | ... | @@ -172,7 +174,7 @@ class Environment < ActiveRecord::Base |
172 | 174 | acts_as_having_boxes |
173 | 175 | |
174 | 176 | after_create do |env| |
175 | - 4.times do | |
177 | + NUMBER_OF_BOXES.times do | |
176 | 178 | env.boxes << Box.new |
177 | 179 | end |
178 | 180 | ... | ... |
app/models/profile.rb
... | ... | @@ -22,6 +22,8 @@ class Profile < ActiveRecord::Base |
22 | 22 | :display => %w[compact] |
23 | 23 | } |
24 | 24 | |
25 | + NUMBER_OF_BOXES = 4 | |
26 | + | |
25 | 27 | def self.default_search_display |
26 | 28 | 'compact' |
27 | 29 | end |
... | ... | @@ -362,7 +364,7 @@ class Profile < ActiveRecord::Base |
362 | 364 | if template |
363 | 365 | apply_template(template, :copy_articles => false) |
364 | 366 | else |
365 | - 4.times do | |
367 | + NUMBER_OF_BOXES.times do | |
366 | 368 | self.boxes << Box.new |
367 | 369 | end |
368 | 370 | ... | ... |
db/migrate/20150423144533_add_block_to_environment_and_profile.rb
... | ... | @@ -1,15 +0,0 @@ |
1 | -class AddBlockToEnvironmentAndProfile < ActiveRecord::Migration | |
2 | - def up | |
3 | - Environment.all.each do |env| | |
4 | - env.boxes << Box.new if env.boxes.count < 4 | |
5 | - end | |
6 | - | |
7 | - Profile.all.each do |profile| | |
8 | - profile.boxes << Box.new if profile.boxes.count < 4 | |
9 | - end | |
10 | - end | |
11 | - | |
12 | - def down | |
13 | - say "this migration can't be reverted" | |
14 | - end | |
15 | -end |
db/migrate/20150423144533_add_new_box_to_every_environment_and_profile.rb
0 → 100644
... | ... | @@ -0,0 +1,15 @@ |
1 | +class AddNewBoxToEveryEnvironmentAndProfile < ActiveRecord::Migration | |
2 | + def up | |
3 | + Environment.find_each do |env| | |
4 | + env.boxes << Box.new if env.boxes.count < 4 | |
5 | + end | |
6 | + | |
7 | + Profile.find_each do |profile| | |
8 | + profile.boxes << Box.new if profile.boxes.count < 4 | |
9 | + end | |
10 | + end | |
11 | + | |
12 | + def down | |
13 | + say "this migration can't be reverted" | |
14 | + end | |
15 | +end | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -94,7 +94,7 @@ Given /^the following blocks$/ do |table| |
94 | 94 | owner.boxes<< Box.new |
95 | 95 | owner.boxes.first.blocks << MainBlock.new |
96 | 96 | end |
97 | - box_id = owner.boxes[-2].id | |
97 | + box_id = owner.boxes.where(:position => [3]) | |
98 | 98 | klass.constantize.create!(item.merge(:box_id => box_id)) |
99 | 99 | end |
100 | 100 | end | ... | ... |