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 1 class LinkBlock < Block
2 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 5 end
6   - users.join(',')
  6 + profiles.join(',')
7 7 end
8 8 end
... ...
app/models/list_block.rb
1 1 class ListBlock < Block
2 2  
3 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 5 end
6 6 end
... ...
app/views/layouts/application.rhtml
... ... @@ -7,9 +7,8 @@
7 7 <body>
8 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 13 <%= display_boxes(@boxes, yield) %>
15 14  
... ...
app/views/layouts/application.rhtml.wrong
... ... @@ -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 5 box_id: 2
6 6 position: 1
7 7 type: 'MainBlock'
  8 + name: 'Main Content'
8 9 # Link Blocks
9 10 two:
10 11 id: 2
11 12 box_id: 1
12 13 position: 2
13 14 type: 'LinkBlock'
  15 + name: 'List of Links 1'
14 16 three:
15 17 id: 3
16 18 box_id: 1
17 19 position: 3
18 20 type: 'LinkBlock'
  21 + name: 'List of Link 2'
19 22 #List Blocks
20 23 four:
21 24 id: 4
22 25 box_id: 1
23 26 position: 1
24 27 type: 'ListBlock'
  28 + name: 'List of Names 1'
25 29 five:
26 30 id: 5
27 31 box_id: 3
28 32 position: 1
29 33 type: 'ListBlock'
  34 + name: 'List of Names 2'
30 35 six:
31 36 id: 6
32 37 box_id: 3
33 38 position: 2
34 39 type: 'ListBlock'
  40 + name: 'List of Names 3'
... ...
test/fixtures/boxes.yml
... ... @@ -4,13 +4,16 @@ one:
4 4 number: 1
5 5 owner_type: 'Profile'
6 6 owner_id: 1
  7 + name: 'Box One'
7 8 two:
8 9 id: 2
9 10 number: 2
10 11 owner_type: 'Profile'
11 12 owner_id: 1
  13 + name: 'Box Two'
12 14 three:
13 15 id: 3
14 16 number: 3
15 17 owner_type: 'Profile'
16 18 owner_id: 1
  19 + name: 'Box Three'
... ...