Commit 9de9f4581189acf14028a2b9521d2bfe9de1cb69

Authored by LeandroNunes
1 parent 1dca4928

ActionItem0: adding link to edit layout and adding name in fixtures block and box

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@64 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/link_block.rb
1 class LinkBlock < Block 1 class LinkBlock < Block
2 def to_html 2 def to_html
3 - users = User.find(:all).map do |u|  
4 - content_tag("a href='http://www.google.com.br'", u.name) 3 + profiles = Profile.find(:all).map do |p|
  4 + content_tag("a href='http://www.google.com.br'", p.name)
5 end 5 end
6 - users.join(',') 6 + profiles.join(',')
7 end 7 end
8 end 8 end
app/models/list_block.rb
1 class ListBlock < Block 1 class ListBlock < Block
2 2
3 def to_html 3 def to_html
4 - content_tag(:ul, User.find(:all).map{|u| content_tag( :li, u.name ) }) 4 + content_tag(:ul, Profile.find(:all).map{|p| content_tag( :li, p.name ) })
5 end 5 end
6 end 6 end
app/views/layouts/application.rhtml
@@ -7,9 +7,8 @@ @@ -7,9 +7,8 @@
7 <body> 7 <body>
8 <%= image_tag 'loading.gif', :id=>'spinner', :style=>"display:none; float:right;" %> 8 <%= image_tag 'loading.gif', :id=>'spinner', :style=>"display:none; float:right;" %>
9 9
10 - <%= link_to _('edit layout'), params.merge({:edit_layout => true}) %>  
11 - <%= link_to _('show layout'), params.merge({:edit_layout => false}) %>  
12 - <%= link_to _('acao diferente'), :action => 'teste' %> 10 + <%= link_to _('Show Layout'), :controller => 'home' %>
  11 + <%= link_to _('Edit Layout'), :controller => 'edit_template' %>
13 12
14 <%= display_boxes(@boxes, yield) %> 13 <%= display_boxes(@boxes, yield) %>
15 14
app/views/layouts/application.rhtml.wrong
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -<html>  
2 - <head>  
3 - <%= javascript_include_tag :defaults %>  
4 - <%= stylesheet_link_tag 'default' %>  
5 -  
6 - </head>  
7 - <body>  
8 - <%= image_tag 'loading.gif', :id=>'spinner', :style=>"display:none; float:right;" %>  
9 -  
10 - <%= link_to _('edit layout'), params.merge({:edit_layout => true}) %>  
11 - <%= link_to _('show layout'), params.merge({:edit_layout => false}) %>  
12 - <%= link_to _('acao diferente'), :action => 'teste' %>  
13 -  
14 - <div id="box_1" >  
15 - <%= show_block(@owner, 1)%>  
16 - </div>  
17 -<%= update_page_tag{|page|  
18 -#TODO this is to test  
19 -#page.alert('leo')  
20 -#@box_number=1  
21 -#page.replace_html "box_1", {:partial => 'leo'};  
22 -#page.replace_html "box_1", {:partial => 'layouts/box_template'};  
23 -#page.sortable "leo_1", :url => {:action => 'sort_box', :box_number => 1};  
24 -#)page.show  
25 -}  
26 -%>  
27 -  
28 -  
29 - <div id="box_2" >  
30 - <%= show_block(@owner, 2)%>  
31 - <%= yield %>  
32 - </div>  
33 - <div id="box_3" >  
34 - <%= show_block(@owner, 3)%>  
35 - </div>  
36 -  
37 - </body>  
38 -  
39 -</html>  
test/fixtures/blocks.yml
@@ -5,30 +5,36 @@ one: @@ -5,30 +5,36 @@ one:
5 box_id: 2 5 box_id: 2
6 position: 1 6 position: 1
7 type: 'MainBlock' 7 type: 'MainBlock'
  8 + name: 'Main Content'
8 # Link Blocks 9 # Link Blocks
9 two: 10 two:
10 id: 2 11 id: 2
11 box_id: 1 12 box_id: 1
12 position: 2 13 position: 2
13 type: 'LinkBlock' 14 type: 'LinkBlock'
  15 + name: 'List of Links 1'
14 three: 16 three:
15 id: 3 17 id: 3
16 box_id: 1 18 box_id: 1
17 position: 3 19 position: 3
18 type: 'LinkBlock' 20 type: 'LinkBlock'
  21 + name: 'List of Link 2'
19 #List Blocks 22 #List Blocks
20 four: 23 four:
21 id: 4 24 id: 4
22 box_id: 1 25 box_id: 1
23 position: 1 26 position: 1
24 type: 'ListBlock' 27 type: 'ListBlock'
  28 + name: 'List of Names 1'
25 five: 29 five:
26 id: 5 30 id: 5
27 box_id: 3 31 box_id: 3
28 position: 1 32 position: 1
29 type: 'ListBlock' 33 type: 'ListBlock'
  34 + name: 'List of Names 2'
30 six: 35 six:
31 id: 6 36 id: 6
32 box_id: 3 37 box_id: 3
33 position: 2 38 position: 2
34 type: 'ListBlock' 39 type: 'ListBlock'
  40 + name: 'List of Names 3'
test/fixtures/boxes.yml
@@ -4,13 +4,16 @@ one: @@ -4,13 +4,16 @@ one:
4 number: 1 4 number: 1
5 owner_type: 'Profile' 5 owner_type: 'Profile'
6 owner_id: 1 6 owner_id: 1
  7 + name: 'Box One'
7 two: 8 two:
8 id: 2 9 id: 2
9 number: 2 10 number: 2
10 owner_type: 'Profile' 11 owner_type: 'Profile'
11 owner_id: 1 12 owner_id: 1
  13 + name: 'Box Two'
12 three: 14 three:
13 id: 3 15 id: 3
14 number: 3 16 number: 3
15 owner_type: 'Profile' 17 owner_type: 'Profile'
16 owner_id: 1 18 owner_id: 1
  19 + name: 'Box Three'