Commit 7513eb463106beaae763e72305f2da6bc7eb3893
1 parent
ac6da245
Exists in
master
and in
28 other branches
Add alias to profile at context content block
Showing
2 changed files
with
9 additions
and
1 deletions
Show diff stats
plugins/context_content/lib/context_content_block.rb
@@ -4,9 +4,10 @@ class ContextContentBlock < Block | @@ -4,9 +4,10 @@ class ContextContentBlock < Block | ||
4 | settings_items :show_image, :type => :boolean, :default => true | 4 | settings_items :show_image, :type => :boolean, :default => true |
5 | settings_items :show_parent_content, :type => :boolean, :default => true | 5 | settings_items :show_parent_content, :type => :boolean, :default => true |
6 | settings_items :types, :type => Array, :default => ['UploadedFile'] | 6 | settings_items :types, :type => Array, :default => ['UploadedFile'] |
7 | - | ||
8 | settings_items :limit, :type => :integer, :default => 6 | 7 | settings_items :limit, :type => :integer, :default => 6 |
9 | 8 | ||
9 | + alias :profile :owner | ||
10 | + | ||
10 | include Noosfero::Plugin::HotSpot | 11 | include Noosfero::Plugin::HotSpot |
11 | 12 | ||
12 | def self.description | 13 | def self.description |
plugins/context_content/test/unit/context_content_block_test.rb
@@ -164,4 +164,11 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -164,4 +164,11 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
164 | instance_eval(&@block.footer) | 164 | instance_eval(&@block.footer) |
165 | end | 165 | end |
166 | 166 | ||
167 | + should 'return box owner on profile method call' do | ||
168 | + profile = fast_create(Community) | ||
169 | + box = Box.create(:owner_type => 'Profile', :owner_id => profile.id) | ||
170 | + block = ContextContentBlock.create!(:box => box) | ||
171 | + assert_equal profile, block.profile | ||
172 | + end | ||
173 | + | ||
167 | end | 174 | end |