Commit 6cc31ce6b554e278dbfe2ccc1df4cced5d37c1e1
1 parent
82426f9f
Exists in
master
and in
29 other branches
ActionItem154: adding a optional footer for blocks
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1345 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
14 additions
and
1 deletions
Show diff stats
app/helpers/boxes_helper.rb
... | ... | @@ -42,10 +42,11 @@ module BoxesHelper |
42 | 42 | def display_block(block, main_content = nil) |
43 | 43 | content = block.main? ? main_content : block.content |
44 | 44 | result = extract_block_content(content) |
45 | + footer = extract_block_content(footer) | |
45 | 46 | |
46 | 47 | classes = ['block', block.css_class_name ].uniq.join(' ') |
47 | 48 | |
48 | - box_decorator.block_target(block.box, block) + content_tag('div', result + box_decorator.block_edit_buttons(block), :class => classes, :id => "block-#{block.id}") + box_decorator.block_handle(block) | |
49 | + box_decorator.block_target(block.box, block) + content_tag('div', result + footer + box_decorator.block_edit_buttons(block), :class => classes, :id => "block-#{block.id}") + box_decorator.block_handle(block) | |
49 | 50 | end |
50 | 51 | |
51 | 52 | def extract_block_content(content) | ... | ... |
app/models/block.rb
... | ... | @@ -49,4 +49,12 @@ class Block < ActiveRecord::Base |
49 | 49 | self.class.name.underscore.gsub('_', '-') |
50 | 50 | end |
51 | 51 | |
52 | + # A footer to be appended to the end of the block. Returns an empty string. | |
53 | + # | |
54 | + # Override in your subclasses. You can return the same types supported by | |
55 | + # #content. | |
56 | + def footer | |
57 | + '' | |
58 | + end | |
59 | + | |
52 | 60 | end | ... | ... |
test/unit/block_test.rb