Commit 1d4060c5d98e72d629ffab4837a456eaf31d87ef
1 parent
b5c8dcd6
Exists in
master
and in
29 other branches
ActionItem18: better organization for Comatose integration code
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@372 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
34 additions
and
32 deletions
Show diff stats
config/environment.rb
... | ... | @@ -55,36 +55,5 @@ end |
55 | 55 | require 'gettext/rails' |
56 | 56 | Tag.hierarchical = true |
57 | 57 | |
58 | -Comatose.configure do |config| | |
59 | - config.admin_get_root_page do | |
60 | - Comatose::Page.find_by_path(request.parameters[:profile]) | |
61 | - end | |
62 | - config.admin_authorization do |config| | |
63 | - Profile.exists?(:identifier => request.parameters[:profile]) | |
64 | - # FIXME: also check permissions | |
65 | - end | |
66 | - config.admin_includes << :authenticated_system | |
67 | - config.admin_helpers << :application_helper | |
68 | -end | |
69 | -Comatose::AdminController.design :holder => 'virtual_community' | |
70 | -Comatose::AdminController.before_filter do |controller| | |
71 | - # TODO: copy/paste; extract this into a method (see | |
72 | - # app/controllers/application.rb) | |
73 | - domain = Domain.find_by_name(controller.request.host) | |
74 | - if domain.nil? | |
75 | - virtual_community = VirtualCommunity.default | |
76 | - else | |
77 | - virtual_community = domain.virtual_community | |
78 | - profile = domain.profile | |
79 | - end | |
80 | - controller.instance_variable_set('@virtual_community', virtual_community) | |
81 | -end | |
58 | +require 'comatose_integration' | |
82 | 59 | |
83 | -# taken from http://blog.spotstory.com/2007/04/19/upgrading-to-rails-12/ | |
84 | -# Array of plugins with Application model dependencies. | |
85 | -reloadable_plugins = ["design"] | |
86 | -# Force these plugins to reload, avoiding stale object references. | |
87 | -reloadable_plugins.each do |plugin_name| | |
88 | - reloadable_path = RAILS_ROOT + "/vendor/plugins/#{plugin_name}/lib" | |
89 | - Dependencies.load_once_paths.delete(reloadable_path) | |
90 | -end | ... | ... |
... | ... | @@ -0,0 +1,33 @@ |
1 | +require 'comatose' | |
2 | + | |
3 | +class Comatose::Page | |
4 | + def self.icon | |
5 | + 'text-x-generic' | |
6 | + end | |
7 | +end | |
8 | + | |
9 | +Comatose.configure do |config| | |
10 | + config.admin_get_root_page do | |
11 | + Comatose::Page.find_by_path(request.parameters[:profile]) | |
12 | + end | |
13 | + config.admin_authorization do |config| | |
14 | + Profile.exists?(:identifier => request.parameters[:profile]) | |
15 | + # FIXME: also check permissions | |
16 | + end | |
17 | + config.admin_includes << :authenticated_system | |
18 | + config.admin_helpers << :application_helper | |
19 | + config.admin_helpers << :document | |
20 | +end | |
21 | +Comatose::AdminController.design :holder => 'virtual_community' | |
22 | +Comatose::AdminController.before_filter do |controller| | |
23 | + # TODO: copy/paste; extract this into a method (see | |
24 | + # app/controllers/application.rb) | |
25 | + domain = Domain.find_by_name(controller.request.host) | |
26 | + if domain.nil? | |
27 | + virtual_community = VirtualCommunity.default | |
28 | + else | |
29 | + virtual_community = domain.virtual_community | |
30 | + profile = domain.profile | |
31 | + end | |
32 | + controller.instance_variable_set('@virtual_community', virtual_community) | |
33 | +end | ... | ... |