Commit 9df326c8dcab6cfa8149eb1d8faebbba25d6f581

Authored by LeandroNunes
1 parent b706b378

ActionItem0: Refactoring pluginm

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@165 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/account_controller.rb
1 class AccountController < ApplicationController 1 class AccountController < ApplicationController
2 2
3 - uses_flexible_template :owner => 'owner'  
4 -  
5 # say something nice, you goof! something sweet. 3 # say something nice, you goof! something sweet.
6 def index 4 def index
7 unless logged_in? 5 unless logged_in?
app/controllers/edit_template_controller.rb
@@ -2,11 +2,7 @@ class EditTemplateController &lt; ApplicationController @@ -2,11 +2,7 @@ class EditTemplateController &lt; ApplicationController
2 2
3 uses_flexible_template :edit => true, :owner => 'owner' 3 uses_flexible_template :edit => true, :owner => 'owner'
4 4
5 - def flexible_template_owner  
6 - Profile.find(1)  
7 - end  
8 -  
9 - def flexible_template_dict(str) 5 + def flexible_template_block_dict(str)
10 { 6 {
11 'MainBlock' => _("Main Block"), 7 'MainBlock' => _("Main Block"),
12 'ListBlock' => _("List Block"), 8 'ListBlock' => _("List Block"),
@@ -14,5 +10,4 @@ class EditTemplateController &lt; ApplicationController @@ -14,5 +10,4 @@ class EditTemplateController &lt; ApplicationController
14 }[str] || str 10 }[str] || str
15 end 11 end
16 12
17 -  
18 end 13 end
app/helpers/edit_template_helper.rb
1 # Methods added to this helper will be available to all templates in the application. 1 # Methods added to this helper will be available to all templates in the application.
2 module EditTemplateHelper 2 module EditTemplateHelper
  3 + def flexible_template_block_dict(str)
  4 + {
  5 + 'MainBlock' => _("Main Block"),
  6 + 'ListBlock' => _("List Block"),
  7 + 'LinkBlock' => _("Link Block")
  8 + }[str] || str
  9 + end
3 10
4 end 11 end
app/views/edit_template/index.rhtml
1 -<%= link_to _('Show Layout'), :controller => 'home' %>  
2 -<%= link_to _('Edit Layout'), :controller => 'edit_template' %> 1 +mxendo o contedudo para ver como fica a parada toda
  2 +mxendo o contedudo para ver como fica a parada toda
  3 +mxendo o contedudo para ver como fica a parada toda
  4 +mxendo o contedudo para ver como fica a parada toda
  5 +mxendo o contedudo para ver como fica a parada toda
  6 +mxendo o contedudo para ver como fica a parada toda
  7 +mxendo o contedudo para ver como fica a parada toda
  8 +mxendo o contedudo para ver como fica a parada toda
  9 +mxendo o contedudo para ver como fica a parada toda
  10 +mxendo o contedudo para ver como fica a parada toda
  11 +mxendo o contedudo para ver como fica a parada toda
  12 +mxendo o contedudo para ver como fica a parada toda
  13 +mxendo o contedudo para ver como fica a parada toda
3 14
4 -<%= select_template %>  
5 -<%= select_theme %>  
6 -<%= select_icons_theme %>  
7 -<%= display_icon('back')%>  
app/views/layouts/application.rhtml
1 <html> 1 <html>
2 <head> 2 <head>
3 <%= javascript_include_tag :defaults %> 3 <%= javascript_include_tag :defaults %>
4 - <%= javascript_include_tag_template %>  
5 - <%= stylesheet_link_tag_template %>  
6 - <%= stylesheet_link_tag_theme %> 4 + <%= javascript_include_tag_for_template %>
  5 + <%= stylesheet_link_tag_for_template %>
  6 + <%= stylesheet_link_tag_for_theme %>
7 7
8 </head> 8 </head>
9 9
@@ -26,13 +26,13 @@ @@ -26,13 +26,13 @@
26 <div id='notice'> 26 <div id='notice'>
27 <%= flash[:notice] %> 27 <%= flash[:notice] %>
28 </div> 28 </div>
29 -  
30 <a name='main_content'/> 29 <a name='main_content'/>
31 <%= display_boxes(yield) %> 30 <%= display_boxes(yield) %>
32 31
33 <div id="footer"> 32 <div id="footer">
34 <a name='footer'/> 33 <a name='footer'/>
35 <%= footer %> 34 <%= footer %>
  35 + <%= display_icon('back')%>
36 </div> 36 </div>
37 </div> 37 </div>
38 </div> 38 </div>
db/migrate/002_create_profiles.rb
@@ -7,7 +7,7 @@ class CreateProfiles &lt; ActiveRecord::Migration @@ -7,7 +7,7 @@ class CreateProfiles &lt; ActiveRecord::Migration
7 t.column :user_id, :integer 7 t.column :user_id, :integer
8 t.column :template, :string, :default => "default" 8 t.column :template, :string, :default => "default"
9 t.column :theme, :string, :default => "default" 9 t.column :theme, :string, :default => "default"
10 - t.column :icons_theme, :string, :default => "default" 10 + t.column :icon_theme, :string, :default => "default"
11 end 11 end
12 end 12 end
13 13
lib/extended_tag.rb
@@ -13,7 +13,7 @@ class Tag @@ -13,7 +13,7 @@ class Tag
13 end 13 end
14 end 14 end
15 15
16 - acts_as_ferret :fields => [:name] 16 +# acts_as_ferret :fields => [:name]
17 17
18 18
19 # Return all the tags that were suggested but not yet approved 19 # Return all the tags that were suggested but not yet approved
public/templates/default/stylesheets/style.css
@@ -26,7 +26,7 @@ body { @@ -26,7 +26,7 @@ body {
26 } 26 }
27 27
28 /* the container */ 28 /* the container */
29 -#box { 29 +#frame {
30 background-color: #FFFFFF; 30 background-color: #FFFFFF;
31 margin-left: auto; 31 margin-left: auto;
32 margin-right: auto; 32 margin-right: auto;
public/themes/default/default.css
1 -#box { 1 +#frame {
2 background-color: white; 2 background-color: white;
3 } 3 }
public/themes/pink/pink.css
1 1
2 -#box { 2 +#frame {
3 background-color: pink; 3 background-color: pink;
4 } 4 }
test/fixtures/profiles.yml
@@ -6,7 +6,7 @@ johndoe: @@ -6,7 +6,7 @@ johndoe:
6 virtual_community_id: 1 6 virtual_community_id: 1
7 user_id: 1 7 user_id: 1
8 template: 'default' 8 template: 'default'
9 - icons_theme: 'default' 9 + icon_theme: 'default'
10 theme: 'default' 10 theme: 'default'
11 joerandomhacker: 11 joerandomhacker:
12 id: 2 12 id: 2
@@ -15,7 +15,7 @@ joerandomhacker: @@ -15,7 +15,7 @@ joerandomhacker:
15 virtual_community_id: 1 15 virtual_community_id: 1
16 user_id: 2 16 user_id: 2
17 template: 'simple' 17 template: 'simple'
18 - icons_theme: 'simple' 18 + icon_theme: 'simple'
19 theme: 'simple' 19 theme: 'simple'
20 john_and_joe: 20 john_and_joe:
21 id: 3 21 id: 3
@@ -23,7 +23,7 @@ john_and_joe: @@ -23,7 +23,7 @@ john_and_joe:
23 identifier: john_and_joe 23 identifier: john_and_joe
24 virtual_community_id: 1 24 virtual_community_id: 1
25 template: 'simple' 25 template: 'simple'
26 - icons_theme: 'simple' 26 + icon_theme: 'simple'
27 theme: 'simple' 27 theme: 'simple'
28 ze: 28 ze:
29 id: 4 29 id: 4
@@ -31,5 +31,5 @@ ze: @@ -31,5 +31,5 @@ ze:
31 identifier: ze 31 identifier: ze
32 virtual_community_id: 1 32 virtual_community_id: 1
33 template: 'default' 33 template: 'default'
34 - icons_theme: 'default' 34 + icon_theme: 'default'
35 theme: 'default' 35 theme: 'default'