Commit bca9640c35539b0539e4d9d8f4fb24db24f66dbf

Authored by LeandroNunes
1 parent 2429ca31

ActionItem0: redefining show blocks

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@128 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
... ... @@ -11,7 +11,6 @@ module ApplicationHelper
11 11  
12 12 ICONS_DIR_PATH = "#{RAILS_ROOT}/public/icons"
13 13 THEME_DIR_PATH = "#{RAILS_ROOT}/public/themes"
14   -
15 14  
16 15 # Generate a select option to choose one of the available themes.
17 16 # The available themes are those in 'public/themes'
... ...
app/models/link_block.rb
1 1 class LinkBlock < Block
2 2  
3   - # Redefinition of to_html Block method that show a list of links showing the Profile name.
4   - #
5   - # Ex:
6   - #
7   - # <a href="http://www.colivre.coop.br"> Colivre </a>
8   - #
9   - # <a href="http://www.ba.softwarelivre.org"> PSL-BA </a>
10   - def to_html
11   - profiles = Profile.find(:all).map do |p|
12   - content_tag("a href='http://www.google.com.br'", p.name)
13   - end
14   - profiles.join(',')
15   - end
16   -
17 3 def content
18   - profiles = Profile.find(:all)
  4 + Profile.find(:all).map{|p| p.name}
19 5 end
20 6  
21 7 end
... ...
app/models/list_block.rb
1 1 class ListBlock < Block
2 2  
3   - def to_html
4   - content_tag(:ul, Profile.find(:all).map{|p| content_tag( :li, p.name ) })
  3 + def content
  4 + Profile.find(:all).map{|p|p.name}
5 5 end
6 6 end
... ...
db/migrate/005_manage_template_migration.rb
... ... @@ -12,6 +12,7 @@ class ManageTemplateMigration &lt; ActiveRecord::Migration
12 12 t.column :box_id, :integer
13 13 t.column :position, :integer
14 14 t.column :type, :string
  15 + t.column :helper, :string
15 16 end
16 17  
17 18 end
... ...
test/fixtures/blocks.yml
... ... @@ -5,6 +5,7 @@ one:
5 5 box_id: 2
6 6 position: 1
7 7 type: 'MainBlock'
  8 + helper: 'plain_content'
8 9 name: 'Main Content'
9 10 # Link Blocks
10 11 two:
... ... @@ -12,12 +13,14 @@ two:
12 13 box_id: 1
13 14 position: 2
14 15 type: 'LinkBlock'
  16 + helper: 'list_content'
15 17 name: 'List of Links 1'
16 18 three:
17 19 id: 3
18 20 box_id: 1
19 21 position: 3
20 22 type: 'LinkBlock'
  23 + helper: 'plain_content'
21 24 name: 'List of Link 2'
22 25 #List Blocks
23 26 four:
... ... @@ -25,16 +28,19 @@ four:
25 28 box_id: 1
26 29 position: 1
27 30 type: 'ListBlock'
  31 + helper: 'list_content'
28 32 name: 'List of Names 1'
29 33 five:
30 34 id: 5
31 35 box_id: 3
32 36 position: 1
33 37 type: 'ListBlock'
  38 + helper: 'list_content'
34 39 name: 'List of Names 2'
35 40 six:
36 41 id: 6
37 42 box_id: 3
38 43 position: 2
39 44 type: 'ListBlock'
  45 + helper: 'list_content'
40 46 name: 'List of Names 3'
... ...