Commit 1bf51dc16c9659312be5778e20ab3fd176e499af

Authored by AntonioTerceiro
1 parent 2a99ae14

ActionItem8: making stuff wotk



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@42 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/application.rb
@@ -3,20 +3,25 @@ @@ -3,20 +3,25 @@
3 class ApplicationController < ActionController::Base 3 class ApplicationController < ActionController::Base
4 4
5 before_filter :detect_stuff_by_domain 5 before_filter :detect_stuff_by_domain
  6 + attr_reader :virtual_community
6 7
  8 +
  9 + # TODO: this methods don't belong here
7 #TODO See a better way to do this. The layout need a owner to work 10 #TODO See a better way to do this. The layout need a owner to work
8 before_filter :load_owner 11 before_filter :load_owner
9 def load_owner 12 def load_owner
10 @owner = User.find(1) 13 @owner = User.find(1)
11 end 14 end
12 15
13 - #TODO See a better way to do this. We need that something say to us when is the time to edit the layout. 16 + # TODO: this methods don't belong here
  17 + # TODO See a better way to do this. We need that something say to us when is the time to edit the layout.
14 #I think the better way is set a different render class to the visualization and to edit a layout. 18 #I think the better way is set a different render class to the visualization and to edit a layout.
15 before_filter :detect_edit_layout 19 before_filter :detect_edit_layout
16 def detect_edit_layout 20 def detect_edit_layout
17 @edit_layout = true unless params[:edit_layout].nil? 21 @edit_layout = true unless params[:edit_layout].nil?
18 end 22 end
19 23
  24 + # TODO: this methods don't belong here
20 # This method changes a block content to a different box place and 25 # This method changes a block content to a different box place and
21 # updates all boxes at the ends 26 # updates all boxes at the ends
22 def change_box 27 def change_box
@@ -32,6 +37,7 @@ class ApplicationController &lt; ActionController::Base @@ -32,6 +37,7 @@ class ApplicationController &lt; ActionController::Base
32 end 37 end
33 end 38 end
34 39
  40 + # TODO: this methods don't belong here
35 def sort_box 41 def sort_box
36 blocks = Array.new 42 blocks = Array.new
37 box_number = params[:box_number] 43 box_number = params[:box_number]
app/views/layouts/application.rhtml
@@ -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>  
app/views/layouts/application.rhtml.wrong 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  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>