Commit 72762e81c5f45bf7e941858575401e74014b93a5

Authored by LeandroNunes
1 parent fdb22713

ActionItem0: refactoring block plugins

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@138 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/application.rb
... ... @@ -9,7 +9,10 @@ class ApplicationController < ActionController::Base
9 9 before_filter :detect_stuff_by_domain
10 10 attr_reader :virtual_community
11 11  
12   - uses_manage_template :edit => false
  12 + uses_flexible_template
  13 +
  14 + def flexible_template_owner
  15 + end
13 16  
14 17 before_filter :load_template
15 18 # Load the template belongs to a Profile and set it at @chosen_template variable.
... ...
app/controllers/edit_template_controller.rb
1 1 class EditTemplateController < ApplicationController
2 2  
3   - uses_manage_template :edit => true
  3 + uses_flexible_template :edit => true
  4 +
  5 + def flexible_template_owner
  6 + Profile.find(1)
  7 + end
4 8  
5 9 end
... ...
app/models/profile.rb
... ... @@ -3,6 +3,8 @@
3 3 # which by default is the one returned by VirtualCommunity:default.
4 4 class Profile < ActiveRecord::Base
5 5  
  6 + act_as_flexible_template
  7 +
6 8 # Valid identifiers must match this format.
7 9 IDENTIFIER_FORMAT = /^[a-z][a-z0-9_]+[a-z0-9]$/
8 10  
... ... @@ -16,7 +18,6 @@ class Profile &lt; ActiveRecord::Base
16 18 ]
17 19  
18 20 has_many :domains, :as => :owner
19   - has_many :boxes, :as => :owner
20 21 belongs_to :virtual_community
21 22 belongs_to :user
22 23  
... ...
app/views/home/index.rhtml
1 1 <%= flash[:notice] %>
2 2 Start page of Virtual Community <%= @virtual_community.name %>
  3 +
  4 +Teste:
  5 +<%= @bla %>
  6 +<%= @bli.inspect %>
  7 +caralho
  8 +
... ...