Commit 4735b1577f6f7fa69ea4743fa614c6d98a7d43e0
1 parent
b2764fd6
Exists in
master
and in
23 other branches
ActionItem154: refactoring: extracted block title to its own method
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1334 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
8 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
| ... | ... | @@ -11,6 +11,8 @@ module ApplicationHelper |
| 11 | 11 | include FormsHelper |
| 12 | 12 | |
| 13 | 13 | include AssetsHelper |
| 14 | + | |
| 15 | + include BlockHelper | |
| 14 | 16 | |
| 15 | 17 | # Displays context help. You can pass the content of the help message as the |
| 16 | 18 | # first parameter or using template code inside a block passed to this | ... | ... |
app/models/block.rb
app/models/environment_statistics_block.rb
| ... | ... | @@ -15,7 +15,7 @@ class EnvironmentStatisticsBlock < Block |
| 15 | 15 | n_('One community', '%{num} communities', communities) % { :num => communities }, |
| 16 | 16 | ] |
| 17 | 17 | |
| 18 | - content_tag('h3', _('Statistics for %s') % owner.name, :class => 'block-title' ) + content_tag('ul', info.map {|item| content_tag('li', item) }.join("\n")) | |
| 18 | + block_title(('Statistics for %s') % owner.name) + content_tag('ul', info.map {|item| content_tag('li', item) }.join("\n")) | |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | end | ... | ... |
app/models/recent_documents_block.rb
| ... | ... | @@ -14,7 +14,7 @@ class RecentDocumentsBlock < Block |
| 14 | 14 | owner.recent_documents(self.limit) |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | - content_tag('h3', _('Recent content'), :class => 'block-title') + | |
| 17 | + block_title(_('Recent content')) + | |
| 18 | 18 | content_tag('ul', docs.map {|item| content_tag('li', link_to(item.title, item.url))}.join("\n")) |
| 19 | 19 | |
| 20 | 20 | end | ... | ... |
app/models/tags_block.rb
| ... | ... | @@ -8,7 +8,7 @@ class TagsBlock < Block |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | def content |
| 11 | - content_tag('h3', _('Tags'), :class => 'block-title') + | |
| 11 | + block_title(_('Tags')) + | |
| 12 | 12 | help_textile( |
| 13 | 13 | _('The tag is created when you add some one to your article. |
| 14 | 14 | Try to add some tags to some articles and see your tag cloud to grow.'), | ... | ... |