Commit 4735b1577f6f7fa69ea4743fa614c6d98a7d43e0

Authored by AntonioTerceiro
1 parent b2764fd6

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
app/helpers/application_helper.rb
@@ -11,6 +11,8 @@ module ApplicationHelper @@ -11,6 +11,8 @@ module ApplicationHelper
11 include FormsHelper 11 include FormsHelper
12 12
13 include AssetsHelper 13 include AssetsHelper
  14 +
  15 + include BlockHelper
14 16
15 # Displays context help. You can pass the content of the help message as the 17 # Displays context help. You can pass the content of the help message as the
16 # first parameter or using template code inside a block passed to this 18 # first parameter or using template code inside a block passed to this
app/models/block.rb
@@ -4,6 +4,9 @@ class Block < ActiveRecord::Base @@ -4,6 +4,9 @@ class Block < ActiveRecord::Base
4 include ActionView::Helpers::UrlHelper 4 include ActionView::Helpers::UrlHelper
5 include ActionView::Helpers::TagHelper 5 include ActionView::Helpers::TagHelper
6 6
  7 + # Block-specific stuff
  8 + include BlockHelper
  9 +
7 acts_as_list :scope => :box 10 acts_as_list :scope => :box
8 belongs_to :box 11 belongs_to :box
9 12
app/models/environment_statistics_block.rb
@@ -15,7 +15,7 @@ class EnvironmentStatisticsBlock < Block @@ -15,7 +15,7 @@ class EnvironmentStatisticsBlock < Block
15 n_('One community', '%{num} communities', communities) % { :num => communities }, 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 end 19 end
20 20
21 end 21 end
app/models/recent_documents_block.rb
@@ -14,7 +14,7 @@ class RecentDocumentsBlock < Block @@ -14,7 +14,7 @@ class RecentDocumentsBlock < Block
14 owner.recent_documents(self.limit) 14 owner.recent_documents(self.limit)
15 end 15 end
16 16
17 - content_tag('h3', _('Recent content'), :class => 'block-title') + 17 + block_title(_('Recent content')) +
18 content_tag('ul', docs.map {|item| content_tag('li', link_to(item.title, item.url))}.join("\n")) 18 content_tag('ul', docs.map {|item| content_tag('li', link_to(item.title, item.url))}.join("\n"))
19 19
20 end 20 end
app/models/tags_block.rb
@@ -8,7 +8,7 @@ class TagsBlock < Block @@ -8,7 +8,7 @@ class TagsBlock < Block
8 end 8 end
9 9
10 def content 10 def content
11 - content_tag('h3', _('Tags'), :class => 'block-title') + 11 + block_title(_('Tags')) +
12 help_textile( 12 help_textile(
13 _('The tag is created when you add some one to your article. 13 _('The tag is created when you add some one to your article.
14 Try to add some tags to some articles and see your tag cloud to grow.'), 14 Try to add some tags to some articles and see your tag cloud to grow.'),