Changesets can be listed by changeset number.
The Git repository is here.
Changeset 43
Use of PATH_PREFIX to make the configuration more easy to relocate.
Prompted by Ticket #33, where Radiant URLs were being served relative
to the document root; this is fixed in app/models/behavior.rb though
it is not a very clean solution.
- Comitted by: adh
- Date: Tuesday August 01 12:23:10 2006 (over 18 years ago)
Affected files:
- rool/rails/radiant/trunk/app/models/behavior.rb (diff)
- rool/rails/radiant/trunk/config/environment.rb (diff)
- rool/rails/radiant/trunk/config/routes.rb (diff)
rool/rails/radiant/trunk/app/models/behavior.rb:
prev. | current | |
end | ||
end | ||
156 | # Modifications to clean_url() | |
157 | # ---------------------------- | |
158 | # | |
159 | # The model can't get at helper or controller methods so it cannot | |
160 | # see if the application is running from somewhere other than document | |
161 | # root. This implies that the code inside the model is in the wrong | |
162 | # place, but in lieu of completely restructuring Radiant (or finding a | |
163 | # better solution if the model is indeed the correct place to put code | |
164 | # like this after all), a simple hack gets things moving for now. | |
165 | ||
166 | @@url_prefix = "#{PATH_PREFIX}/" | |
167 | @@url_regexp = Regexp.compile("^#{@@url_prefix}.*") | |
168 | ||
def clean_url(url) | ||
157 | | |
170 | url = @@url_prefix + url unless (url =~ @@url_regexp ) | |
171 | "/#{ url.strip }/".gsub(%r{//+}, '/') | |
end | ||
def parse_object(object) |
rool/rails/radiant/trunk/config/environment.rb:
prev. | current | |
# Bootstrap the Rails environment, frameworks, and default configuration | ||
require File.join(File.dirname(__FILE__), 'boot') | ||
13 | # Location of application relative to document root in terms of | |
14 | # URLs (i.e. according to the web server configuration, not the | |
15 | # filesystem location). | |
16 | ||
17 | PATH_PREFIX = '/rails/radiant' | |
18 | ||
require 'radius' | ||
Rails::Initializer.run do |config| | ||
# We don't run in the document root, so images etc. must come from | ||
# a non-root location too. Hijack the 'asset host' facility to get | ||
# helper-based links pointing in the right place. | ||
19 | | |
25 | config.action_controller.asset_host = PATH_PREFIX | |
# Settings in config/environments/* take precedence those specified here | ||
rool/rails/radiant/trunk/config/routes.rb:
prev. | current | |
# Admin Routes | ||
map.with_options(:controller => 'admin/welcome') do |welcome| | ||
5 | | |
6 | | |
7 | | |
8 | | |
5 | welcome.admin PATH_PREFIX + '/admin', :action => 'index' | |
6 | welcome.welcome PATH_PREFIX + '/admin/welcome', :action => 'index' | |
7 | welcome.login PATH_PREFIX + '/admin/login', :action => 'login' | |
8 | welcome.logout PATH_PREFIX + '/admin/logout', :action => 'logout' | |
end | ||
# Export Routes | ||
map.with_options(:controller => 'admin/export') do |export| | ||
13 | | |
14 | | |
13 | export.export PATH_PREFIX + '/admin/export', :action => 'yaml' | |
14 | export.export_yaml PATH_PREFIX + '/admin/export/yaml', :action => 'yaml' | |
end | ||
# Page Routes | ||
map.with_options(:controller => 'admin/page') do |page| | ||
19 | | |
20 | | |
21 | | |
22 | | |
23 | | |
24 | | |
25 | | |
26 | | |
19 | page.page_index PATH_PREFIX + '/admin/pages', :action => 'index' | |
20 | page.page_edit PATH_PREFIX + '/admin/pages/edit/:id', :action => 'edit' | |
21 | page.page_new PATH_PREFIX + '/admin/pages/:parent_id/child/new', :action => 'new' | |
22 | page.homepage_new PATH_PREFIX + '/admin/pages/new/homepage', :action => 'new', :slug => '/', :breadcrumb => 'Home' | |
23 | page.page_remove PATH_PREFIX + '/admin/pages/remove/:id', :action => 'remove' | |
24 | page.page_add_part PATH_PREFIX + '/admin/ui/pages/part/add', :action => 'add_part' | |
25 | page.page_children PATH_PREFIX + '/admin/ui/pages/children/:id/:level', :action => 'children', :level => '1' | |
26 | page.clear_cache PATH_PREFIX + '/admin/pages/cache/clear', :action => 'clear_cache' | |
end | ||
# Layouts Routes | ||
map.with_options(:controller => 'admin/layout') do |layout| | ||
31 | | |
32 | | |
33 | | |
34 | | |
31 | layout.layout_index PATH_PREFIX + '/admin/layouts', :action => 'index' | |
32 | layout.layout_edit PATH_PREFIX + '/admin/layouts/edit/:id', :action => 'edit' | |
33 | layout.layout_new PATH_PREFIX + '/admin/layouts/new', :action => 'new' | |
34 | layout.layout_remove PATH_PREFIX + '/admin/layouts/remove/:id', :action => 'remove' | |
end | ||
# Snippets Routes | ||
map.with_options(:controller => 'admin/snippet') do |snippet| | ||
39 | | |
40 | | |
41 | | |
42 | | |
39 | snippet.snippet_index PATH_PREFIX + '/admin/snippets', :action => 'index' | |
40 | snippet.snippet_edit PATH_PREFIX + '/admin/snippets/edit/:id', :action => 'edit' | |
41 | snippet.snippet_new PATH_PREFIX + '/admin/snippets/new', :action => 'new' | |
42 | snippet.snippet_remove PATH_PREFIX + '/admin/snippets/remove/:id', :action => 'remove' | |
end | ||
# Users Routes | ||
map.with_options(:controller => 'admin/user') do |user| | ||
47 | | |
48 | | |
49 | | |
50 | | |
51 | | |
47 | user.user_index PATH_PREFIX + '/admin/users', :action => 'index' | |
48 | user.user_edit PATH_PREFIX + '/admin/users/edit/:id', :action => 'edit' | |
49 | user.user_new PATH_PREFIX + '/admin/users/new', :action => 'new' | |
50 | user.user_remove PATH_PREFIX + '/admin/users/remove/:id', :action => 'remove' | |
51 | user.user_preferences PATH_PREFIX + '/admin/preferences', :action => 'preferences' | |
end | ||
# Site URLs | ||
map.with_options(:controller => 'site') do |site| | ||
56 | | |
57 | | |
58 | | |
56 | site.homepage PATH_PREFIX + '/', :action => 'show_page', :url => '/' | |
57 | site.not_found PATH_PREFIX + '/error/404', :action => 'not_found' | |
58 | site.error PATH_PREFIX + '/error/500', :action => 'error' | |
# Everything else | ||
61 | | |
61 | site.connect PATH_PREFIX + '/*url', :action => 'show_page' | |
end | ||
end | ||