radiant 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of radiant might be problematic. Click here for more details.

Files changed (205) hide show
  1. data/CHANGELOG +1 -0
  2. data/CONTRIBUTORS +12 -0
  3. data/LICENSE +9 -0
  4. data/README +91 -0
  5. data/Rakefile +10 -0
  6. data/app/behaviors/archive_behavior.rb +42 -0
  7. data/app/behaviors/archive_day_index_behavior.rb +30 -0
  8. data/app/behaviors/archive_month_index_behavior.rb +30 -0
  9. data/app/behaviors/archive_year_index_behavior.rb +30 -0
  10. data/app/behaviors/env_behavior.rb +18 -0
  11. data/app/behaviors/page_missing_behavior.rb +31 -0
  12. data/app/controllers/admin/export_controller.rb +8 -0
  13. data/app/controllers/admin/layout_controller.rb +23 -0
  14. data/app/controllers/admin/model_controller.rb +119 -0
  15. data/app/controllers/admin/page_controller.rb +119 -0
  16. data/app/controllers/admin/snippet_controller.rb +6 -0
  17. data/app/controllers/admin/user_controller.rb +45 -0
  18. data/app/controllers/admin/welcome_controller.rb +39 -0
  19. data/app/controllers/application.rb +32 -0
  20. data/app/controllers/site_controller.rb +54 -0
  21. data/app/filters/markdown_filter.rb +9 -0
  22. data/app/filters/textile_filter.rb +9 -0
  23. data/app/helpers/admin/export_helper.rb +2 -0
  24. data/app/helpers/admin/layout_helper.rb +2 -0
  25. data/app/helpers/admin/page_helper.rb +10 -0
  26. data/app/helpers/admin/snippet_helper.rb +2 -0
  27. data/app/helpers/admin/user_helper.rb +2 -0
  28. data/app/helpers/admin/welcome_helper.rb +2 -0
  29. data/app/helpers/application_helper.rb +141 -0
  30. data/app/helpers/site_helper.rb +2 -0
  31. data/app/models/archive_finder.rb +66 -0
  32. data/app/models/behavior.rb +194 -0
  33. data/app/models/layout.rb +13 -0
  34. data/app/models/page.rb +91 -0
  35. data/app/models/page_context.rb +526 -0
  36. data/app/models/page_part.rb +13 -0
  37. data/app/models/radiant/config.rb +53 -0
  38. data/app/models/radiant/exporter.rb +11 -0
  39. data/app/models/response_cache.rb +112 -0
  40. data/app/models/snippet.rb +16 -0
  41. data/app/models/status.rb +31 -0
  42. data/app/models/text_filter.rb +11 -0
  43. data/app/models/user.rb +70 -0
  44. data/app/models/user_action_observer.rb +13 -0
  45. data/app/views/admin/layout/index.rhtml +38 -0
  46. data/app/views/admin/layout/new.rhtml +37 -0
  47. data/app/views/admin/layout/remove.rhtml +17 -0
  48. data/app/views/admin/page/_node.rhtml +51 -0
  49. data/app/views/admin/page/_part.rhtml +17 -0
  50. data/app/views/admin/page/children.rhtml +4 -0
  51. data/app/views/admin/page/index.rhtml +172 -0
  52. data/app/views/admin/page/new.rhtml +164 -0
  53. data/app/views/admin/page/remove.rhtml +14 -0
  54. data/app/views/admin/snippet/index.rhtml +36 -0
  55. data/app/views/admin/snippet/new.rhtml +28 -0
  56. data/app/views/admin/snippet/remove.rhtml +16 -0
  57. data/app/views/admin/user/index.rhtml +43 -0
  58. data/app/views/admin/user/new.rhtml +48 -0
  59. data/app/views/admin/user/preferences.rhtml +29 -0
  60. data/app/views/admin/user/remove.rhtml +16 -0
  61. data/app/views/admin/welcome/login.rhtml +51 -0
  62. data/app/views/layouts/application.rhtml +75 -0
  63. data/app/views/site/not_found.rhtml +3 -0
  64. data/bin/radiant +305 -0
  65. data/config/boot.rb +80 -0
  66. data/config/database.mysql.yml +20 -0
  67. data/config/database.postgresql.yml +20 -0
  68. data/config/database.sqlite.yml +20 -0
  69. data/config/environment.rb +76 -0
  70. data/config/environments/development.rb +20 -0
  71. data/config/environments/production.rb +22 -0
  72. data/config/environments/test.rb +20 -0
  73. data/config/locomotive.yml +6 -0
  74. data/config/routes.rb +64 -0
  75. data/db/development_structure.sql +80 -0
  76. data/db/migrate/001_create_radiant_tables.rb +73 -0
  77. data/db/migrate/002_insert_initial_data.rb +45 -0
  78. data/db/migrate/003_rename_behavior_column.rb +9 -0
  79. data/db/migrate/004_rename_filter_column.rb +11 -0
  80. data/db/migrate/005_add_virtual_column_to_page.rb +9 -0
  81. data/db/migrate/006_integer_columns_to_boolean.rb +11 -0
  82. data/db/migrate/007_remove_virtual_column_from_page.rb +9 -0
  83. data/db/migrate/008_add_virtual_column_to_page_again.rb +9 -0
  84. data/db/migrate/009_add_content_type_field_to_layout.rb +9 -0
  85. data/db/schema.rb +74 -0
  86. data/db/templates/empty.yml +2 -0
  87. data/db/templates/simple-blog.yml +197 -0
  88. data/db/templates/styled-blog.yml +472 -0
  89. data/lib/advanced_delegation.rb +21 -0
  90. data/lib/archive_index_behavior_tags_and_methods.rb +48 -0
  91. data/lib/generators/behavior/USAGE +16 -0
  92. data/lib/generators/behavior/behavior_generator.rb +22 -0
  93. data/lib/generators/behavior/templates/model.rb.template +9 -0
  94. data/lib/generators/behavior/templates/unit_test.rb.template +16 -0
  95. data/lib/generators/filter/USAGE +16 -0
  96. data/lib/generators/filter/filter_generator.rb +22 -0
  97. data/lib/generators/filter/templates/model.rb.template +8 -0
  98. data/lib/generators/filter/templates/unit_test.rb.template +7 -0
  99. data/lib/inheritable_class_attributes.rb +65 -0
  100. data/lib/login_system.rb +80 -0
  101. data/lib/plugins/index_quoting_fix/init.rb +32 -0
  102. data/lib/plugins/string_io/init.rb +2 -0
  103. data/lib/radiant.rb +5 -0
  104. data/lib/registerable.rb +70 -0
  105. data/lib/tasks/release.rake +84 -0
  106. data/public/404.html +8 -0
  107. data/public/500.html +8 -0
  108. data/public/dispatch.cgi +10 -0
  109. data/public/dispatch.fcgi +24 -0
  110. data/public/dispatch.rb +10 -0
  111. data/public/favicon.ico +0 -0
  112. data/public/images/add-child.png +0 -0
  113. data/public/images/brown-bottom-line.gif +0 -0
  114. data/public/images/clear-page-cache.png +0 -0
  115. data/public/images/collapse.png +0 -0
  116. data/public/images/expand.png +0 -0
  117. data/public/images/minus.png +0 -0
  118. data/public/images/new-homepage.png +0 -0
  119. data/public/images/new-layout.png +0 -0
  120. data/public/images/new-snippet.png +0 -0
  121. data/public/images/new-user.png +0 -0
  122. data/public/images/page.png +0 -0
  123. data/public/images/plus.png +0 -0
  124. data/public/images/remove-disabled.png +0 -0
  125. data/public/images/remove.png +0 -0
  126. data/public/images/snippet.png +0 -0
  127. data/public/images/spinner.gif +0 -0
  128. data/public/images/view-site.gif +0 -0
  129. data/public/images/virtual-page.png +0 -0
  130. data/public/javascripts/application.js +2 -0
  131. data/public/javascripts/controls.js +815 -0
  132. data/public/javascripts/dragdrop.js +913 -0
  133. data/public/javascripts/effects.js +958 -0
  134. data/public/javascripts/pngfix.js +78 -0
  135. data/public/javascripts/prototype.js +2006 -0
  136. data/public/javascripts/ruledtable.js +28 -0
  137. data/public/javascripts/string.js +23 -0
  138. data/public/javascripts/tabcontrol.js +140 -0
  139. data/public/robots.txt +1 -0
  140. data/public/stylesheets/admin.css +464 -0
  141. data/script/about +3 -0
  142. data/script/breakpointer +3 -0
  143. data/script/console +3 -0
  144. data/script/destroy +3 -0
  145. data/script/generate +3 -0
  146. data/script/performance/benchmarker +3 -0
  147. data/script/performance/profiler +3 -0
  148. data/script/plugin +3 -0
  149. data/script/process/reaper +3 -0
  150. data/script/process/spawner +3 -0
  151. data/script/process/spinner +3 -0
  152. data/script/runner +3 -0
  153. data/script/server +3 -0
  154. data/script/setup_database +297 -0
  155. data/test/fixtures/layouts.yml +26 -0
  156. data/test/fixtures/page_parts.yml +99 -0
  157. data/test/fixtures/pages.yml +359 -0
  158. data/test/fixtures/pages.yml.rej +28 -0
  159. data/test/fixtures/snippets.yml +18 -0
  160. data/test/fixtures/users.yml +30 -0
  161. data/test/functional/admin/export_controller_test.rb +22 -0
  162. data/test/functional/admin/layout_controller_test.rb +40 -0
  163. data/test/functional/admin/model_controller_test.rb +152 -0
  164. data/test/functional/admin/page_controller_test.rb +179 -0
  165. data/test/functional/admin/snippet_controller_test.rb +11 -0
  166. data/test/functional/admin/user_controller_test.rb +71 -0
  167. data/test/functional/admin/welcome_controller_test.rb +48 -0
  168. data/test/functional/application_controller_test.rb +44 -0
  169. data/test/functional/login_system_test.rb +155 -0
  170. data/test/functional/site_controller_test.rb +172 -0
  171. data/test/helpers/archive_index_test_helper.rb +35 -0
  172. data/test/helpers/behavior_render_test_helper.rb +34 -0
  173. data/test/helpers/behavior_test_helper.rb +47 -0
  174. data/test/helpers/caching_test_helper.rb +41 -0
  175. data/test/helpers/layout_test_helper.rb +35 -0
  176. data/test/helpers/page_part_test_helper.rb +49 -0
  177. data/test/helpers/page_test_helper.rb +36 -0
  178. data/test/helpers/snippet_test_helper.rb +32 -0
  179. data/test/helpers/user_test_helper.rb +34 -0
  180. data/test/helpers/validation_test_helper.rb +42 -0
  181. data/test/test_helper.rb +54 -0
  182. data/test/unit/behavior_test.rb +196 -0
  183. data/test/unit/behaviors/archive_behavior_test.rb +33 -0
  184. data/test/unit/behaviors/archive_day_index_behavior_test.rb +21 -0
  185. data/test/unit/behaviors/archive_month_index_behavior_test.rb +21 -0
  186. data/test/unit/behaviors/archive_year_index_behavior_test.rb +21 -0
  187. data/test/unit/behaviors/page_missing_behavior_test.rb +27 -0
  188. data/test/unit/filters/markdown_filter_test.rb +14 -0
  189. data/test/unit/filters/textile_filter_test.rb +14 -0
  190. data/test/unit/inheritable_class_attributes_test.rb +47 -0
  191. data/test/unit/layout_test.rb +29 -0
  192. data/test/unit/page_context_test.rb +375 -0
  193. data/test/unit/page_context_test.rb.rej +26 -0
  194. data/test/unit/page_part_test.rb +44 -0
  195. data/test/unit/page_test.rb +224 -0
  196. data/test/unit/radiant/config_test.rb +46 -0
  197. data/test/unit/radiant/exporter_test.rb +26 -0
  198. data/test/unit/registerable_test.rb +68 -0
  199. data/test/unit/response_cache_test.rb +133 -0
  200. data/test/unit/snippet_test.rb +47 -0
  201. data/test/unit/status_test.rb +43 -0
  202. data/test/unit/text_filter_test.rb +14 -0
  203. data/test/unit/user_action_observer_test.rb +40 -0
  204. data/test/unit/user_test.rb +138 -0
  205. metadata +355 -0
@@ -0,0 +1,80 @@
1
+ # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
2
+
3
+ module BootUtil
4
+ def self.find_gem(name, version)
5
+ Gem.cache.search(name, "=#{version}").first
6
+ end
7
+ end
8
+
9
+ unless defined?(RAILS_ROOT)
10
+ root_path = File.join(File.dirname(__FILE__), '..')
11
+
12
+ unless RUBY_PLATFORM =~ /mswin32/
13
+ require 'pathname'
14
+ root_path = Pathname.new(root_path).cleanpath(true).to_s
15
+ end
16
+
17
+ RAILS_ROOT = root_path
18
+ end
19
+
20
+ unless defined?(RADIANT_ROOT)
21
+ instance_config = File.join(RAILS_ROOT, "config", "instance.yml")
22
+ unless File.file?(instance_config)
23
+ RADIANT_ROOT = RAILS_ROOT
24
+ else
25
+ require 'yaml'
26
+ cfg = YAML.load_file(instance_config)
27
+ if version = cfg['Gem Version']
28
+ require 'rubygems'
29
+ if radiant_gem = BootUtil.find_gem('radiant', version)
30
+ require_gem 'radiant', "= #{version}"
31
+ else
32
+ STDERR.puts %(
33
+ Cannot find gem for Radiant =#{version}:
34
+ Install the missing gem with 'gem install -v=#{version} radiant', or
35
+ change config/instance.yml to define 'Gem Version' with your desired
36
+ version.
37
+ )
38
+ exit 1
39
+ end
40
+ else
41
+ RADIANT_ROOT = cfg['Radiant Root']
42
+ end
43
+ end
44
+ (
45
+ Dir["#{RADIANT_ROOT}/vendor/rails/*/lib"] +
46
+ Dir["#{RADIANT_ROOT}/vendor/*/lib"]
47
+ ).each do |dir|
48
+ $:.unshift dir
49
+ end
50
+ end
51
+
52
+ unless defined?(Rails::Initializer)
53
+ if File.directory?("#{RAILS_ROOT}/vendor/rails")
54
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
55
+ else
56
+ environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
57
+ environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
58
+ rails_gem_version = $1
59
+
60
+ require 'rubygems'
61
+ if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
62
+ if rails_gem = BootUtil.find_gem('rails', version)
63
+ require_gem "rails", "=#{version}"
64
+ require rails_gem.full_gem_path + '/lib/initializer'
65
+ else
66
+ STDERR.puts %(
67
+ Cannot find gem for Rails =#{version}:
68
+ Install the missing gem with 'gem install -v=#{version} rails', or
69
+ change environment.rb to define RAILS_GEM_VERSION with your desired version.
70
+ )
71
+ exit 1
72
+ end
73
+ else
74
+ require_gem "rails"
75
+ require 'initializer'
76
+ end
77
+ end
78
+
79
+ Rails::Initializer.run(:set_load_path)
80
+ end
@@ -0,0 +1,20 @@
1
+ development:
2
+ adapter: mysql
3
+ database: radiant_dev
4
+ username: root
5
+ password:
6
+ socket: /tmp/mysql.sock
7
+
8
+ test:
9
+ adapter: mysql
10
+ database: radiant_test
11
+ username: root
12
+ password:
13
+ socket: /tmp/mysql.sock
14
+
15
+ production:
16
+ adapter: mysql
17
+ database: radiant_live
18
+ username: root
19
+ password:
20
+ socket: /tmp/mysql.sock
@@ -0,0 +1,20 @@
1
+ development:
2
+ adapter: postgresql
3
+ database: radiant_dev
4
+ username: root
5
+ password:
6
+ host: localhost
7
+
8
+ test:
9
+ adapter: postgresql
10
+ database: radiant_test
11
+ username: root
12
+ password:
13
+ host: localhost
14
+
15
+ production:
16
+ adapter: postgresql
17
+ database: radiant_live
18
+ username: root
19
+ password:
20
+ host: localhost
@@ -0,0 +1,20 @@
1
+ development:
2
+ adapter: sqlite
3
+ database: db/radiant_dev.sqlite.db
4
+ username: root
5
+ password:
6
+ host: localhost
7
+
8
+ test:
9
+ adapter: sqlite
10
+ database: db/radiant_test.sqlite.db
11
+ username: root
12
+ password:
13
+ host: localhost
14
+
15
+ production:
16
+ adapter: sqlite
17
+ database: db/radiant_live.sqlite.db
18
+ username: root
19
+ password:
20
+ host: localhost
@@ -0,0 +1,76 @@
1
+ # Be sure to restart your web server when you modify this file.
2
+
3
+ # Rails Gem Version
4
+ RAILS_GEM_VERSION = '1.1.2'
5
+
6
+ # Uncomment below to force Rails into production mode when
7
+ # you don't control web/app server and can't set it the proper way
8
+ # ENV['RAILS_ENV'] ||= 'production'
9
+
10
+ # Bootstrap the Rails environment, frameworks, and default configuration
11
+ require File.join(File.dirname(__FILE__), 'boot')
12
+
13
+ require 'radius'
14
+
15
+ Rails::Initializer.run do |config|
16
+ # Settings in config/environments/* take precedence those specified here
17
+
18
+ # Skip frameworks you're not going to use
19
+ config.frameworks -= [ :action_web_service, :action_mailer ]
20
+
21
+ # Add additional load paths for when Radiant is running in instance mode
22
+ config.load_paths += %w(
23
+ app/controllers
24
+ app/models
25
+ app/helpers
26
+ app/behaviors
27
+ app/filters
28
+ lib
29
+ ).map { |path| File.join(RADIANT_ROOT, path) }
30
+ config.controller_paths << File.join(RADIANT_ROOT, 'app', 'controllers')
31
+ config.view_path = File.join(RADIANT_ROOT, 'app', 'views')
32
+
33
+ # Force all environments to use the same logger level
34
+ # (by default production uses :info, the others :debug)
35
+ # config.log_level = :debug
36
+
37
+ # Use the database for sessions instead of the file system
38
+ # (create the session table with 'rake create_sessions_table')
39
+ # config.action_controller.session_store = :active_record_store
40
+
41
+ # Enable page/fragment caching by setting a file-based store
42
+ # (remember to create the caching directory and make it readable to the application)
43
+ # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/fragment_cache"
44
+ config.action_controller.page_cache_directory = "#{RAILS_ROOT}/cache"
45
+
46
+ # Make Active Record use UTC-base instead of local time
47
+ config.active_record.default_timezone = :utc
48
+
49
+ # Make sure plugins are loaded from lib and vendor
50
+ config.plugin_paths = ["#{RAILS_ROOT}/vendor/plugins", "#{RADIANT_ROOT}/lib/plugins",
51
+ "#{RADIANT_ROOT}/vendor/plugins"]
52
+
53
+ # See Rails::Configuration for more options
54
+ end
55
+
56
+ # Add new inflection rules using the following format:
57
+ Inflector.inflections do |inflect|
58
+ inflect.uncountable 'config'
59
+ end
60
+
61
+ # Auto-require text filters
62
+ Dir["#{RADIANT_ROOT}/app/filters/*_filter.rb"].each do |filter|
63
+ require_dependency filter
64
+ end
65
+
66
+ # Auto-require behaviors
67
+ Dir["#{RADIANT_ROOT}/app/behaviors/*_behavior.rb"].each do |behavior|
68
+ require_dependency behavior
69
+ end
70
+
71
+ # Response Caching Defaults
72
+ ResponseCache.defaults[:directory] = ActionController::Base.page_cache_directory
73
+ ResponseCache.defaults[:logger] = ActionController::Base.logger
74
+
75
+ # Activate observers that should always be running
76
+ ActiveRecord::Base.observers = :user_action_observer
@@ -0,0 +1,20 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Enable the breakpoint server that script/breakpointer connects to
12
+ config.breakpoint_server = true
13
+
14
+ # Show full error reports and caching is turned off, but ResponseCache caching is on
15
+ config.action_controller.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
17
+ ResponseCache.defaults[:perform_caching] = true
18
+
19
+ # Don't care if the mailer can't send
20
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,22 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Use a different logger for distributed setups
8
+ # config.logger = SyslogLogger.new
9
+
10
+
11
+ # Full error reports are disabled and caching is on
12
+ config.action_controller.consider_all_requests_local = false
13
+ config.action_controller.perform_caching = true
14
+ ResponseCache.defaults[:perform_caching] = true
15
+
16
+ # Enable serving of images, stylesheets, and javascripts from an asset server
17
+ # config.action_controller.asset_host = "http://assets.example.com"
18
+
19
+ # Disable delivery errors if you bad email addresses should just be ignored
20
+ # config.action_mailer.raise_delivery_errors = false
21
+
22
+ require RADIANT_ROOT + '/app/models/page'
@@ -0,0 +1,20 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ ResponseCache.defaults[:perform_caching] = false
16
+
17
+ # Tell ActionMailer not to deliver emails to the real world.
18
+ # The :test delivery method accumulates sent emails in the
19
+ # ActionMailer::Base.deliveries array.
20
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,6 @@
1
+ ---
2
+ mode: development
3
+ runs_at_launch: 0
4
+ identifier: radiant
5
+ port: 3000
6
+ bundle: /Applications/Locomotive2/Bundles/rails112.locobundle
@@ -0,0 +1,64 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+ # Admin Routes
4
+ map.with_options(:controller => 'admin/welcome') do |welcome|
5
+ welcome.admin 'admin', :action => 'index'
6
+ welcome.welcome 'admin/welcome', :action => 'index'
7
+ welcome.login 'admin/login', :action => 'login'
8
+ welcome.logout 'admin/logout', :action => 'logout'
9
+ end
10
+
11
+ # Export Routes
12
+ map.with_options(:controller => 'admin/export') do |export|
13
+ export.export 'admin/export', :action => 'yaml'
14
+ export.export_yaml 'admin/export/yaml', :action => 'yaml'
15
+ end
16
+
17
+ # Page Routes
18
+ map.with_options(:controller => 'admin/page') do |page|
19
+ page.page_index 'admin/pages', :action => 'index'
20
+ page.page_edit 'admin/pages/edit/:id', :action => 'edit'
21
+ page.page_new 'admin/pages/:parent_id/child/new', :action => 'new'
22
+ page.homepage_new 'admin/pages/new/homepage', :action => 'new', :slug => '/', :breadcrumb => 'Home'
23
+ page.page_remove 'admin/pages/remove/:id', :action => 'remove'
24
+ page.page_add_part 'admin/ui/pages/part/add', :action => 'add_part'
25
+ page.page_children 'admin/ui/pages/children/:id/:level', :action => 'children', :level => '1'
26
+ page.clear_cache 'admin/pages/cache/clear', :action => 'clear_cache'
27
+ end
28
+
29
+ # Layouts Routes
30
+ map.with_options(:controller => 'admin/layout') do |layout|
31
+ layout.layout_index 'admin/layouts', :action => 'index'
32
+ layout.layout_edit 'admin/layouts/edit/:id', :action => 'edit'
33
+ layout.layout_new 'admin/layouts/new', :action => 'new'
34
+ layout.layout_remove 'admin/layouts/remove/:id', :action => 'remove'
35
+ end
36
+
37
+ # Snippets Routes
38
+ map.with_options(:controller => 'admin/snippet') do |snippet|
39
+ snippet.snippet_index 'admin/snippets', :action => 'index'
40
+ snippet.snippet_edit 'admin/snippets/edit/:id', :action => 'edit'
41
+ snippet.snippet_new 'admin/snippets/new', :action => 'new'
42
+ snippet.snippet_remove 'admin/snippets/remove/:id', :action => 'remove'
43
+ end
44
+
45
+ # Users Routes
46
+ map.with_options(:controller => 'admin/user') do |user|
47
+ user.user_index 'admin/users', :action => 'index'
48
+ user.user_edit 'admin/users/edit/:id', :action => 'edit'
49
+ user.user_new 'admin/users/new', :action => 'new'
50
+ user.user_remove 'admin/users/remove/:id', :action => 'remove'
51
+ user.user_preferences 'admin/preferences', :action => 'preferences'
52
+ end
53
+
54
+ # Site URLs
55
+ map.with_options(:controller => 'site') do |site|
56
+ site.homepage '', :action => 'show_page', :url => '/'
57
+ site.not_found 'error/404', :action => 'not_found'
58
+ site.error 'error/500', :action => 'error'
59
+
60
+ # Everything else
61
+ site.connect '*url', :action => 'show_page'
62
+ end
63
+
64
+ end
@@ -0,0 +1,80 @@
1
+ CREATE TABLE `config` (
2
+ `id` int(11) NOT NULL auto_increment,
3
+ `key` varchar(40) NOT NULL default '',
4
+ `value` varchar(255) default '',
5
+ PRIMARY KEY (`id`),
6
+ UNIQUE KEY `key` (`key`)
7
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
8
+
9
+ CREATE TABLE `layouts` (
10
+ `id` int(11) NOT NULL auto_increment,
11
+ `name` varchar(100) default NULL,
12
+ `content` text,
13
+ `created_at` datetime default NULL,
14
+ `updated_at` datetime default NULL,
15
+ `created_by` int(11) default NULL,
16
+ `updated_by` int(11) default NULL,
17
+ PRIMARY KEY (`id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
19
+
20
+ CREATE TABLE `page_parts` (
21
+ `id` int(11) NOT NULL auto_increment,
22
+ `name` varchar(100) default NULL,
23
+ `filter_id` varchar(25) default NULL,
24
+ `content` text,
25
+ `page_id` int(11) default NULL,
26
+ PRIMARY KEY (`id`)
27
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
28
+
29
+ CREATE TABLE `pages` (
30
+ `id` int(11) NOT NULL auto_increment,
31
+ `title` varchar(255) default NULL,
32
+ `slug` varchar(100) default NULL,
33
+ `breadcrumb` varchar(160) default NULL,
34
+ `parent_id` int(11) default NULL,
35
+ `layout_id` int(11) default NULL,
36
+ `behavior_id` varchar(25) default NULL,
37
+ `status_id` int(11) NOT NULL default '1',
38
+ `created_at` datetime default NULL,
39
+ `updated_at` datetime default NULL,
40
+ `published_at` datetime default NULL,
41
+ `created_by` int(11) default NULL,
42
+ `updated_by` int(11) default NULL,
43
+ `virtual` tinyint(1) NOT NULL default '0',
44
+ PRIMARY KEY (`id`)
45
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
46
+
47
+ CREATE TABLE `schema_info` (
48
+ `version` int(11) default NULL
49
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
50
+
51
+ CREATE TABLE `snippets` (
52
+ `id` int(11) NOT NULL auto_increment,
53
+ `name` varchar(100) NOT NULL default '',
54
+ `filter_id` varchar(25) default NULL,
55
+ `content` text,
56
+ `created_at` datetime default NULL,
57
+ `updated_at` datetime default NULL,
58
+ `created_by` int(11) default NULL,
59
+ `updated_by` int(11) default NULL,
60
+ PRIMARY KEY (`id`),
61
+ UNIQUE KEY `name` (`name`)
62
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
63
+
64
+ CREATE TABLE `users` (
65
+ `id` int(11) NOT NULL auto_increment,
66
+ `name` varchar(100) default NULL,
67
+ `email` varchar(255) default NULL,
68
+ `login` varchar(40) NOT NULL default '',
69
+ `password` varchar(40) default NULL,
70
+ `admin` tinyint(1) NOT NULL default '0',
71
+ `developer` tinyint(1) NOT NULL default '0',
72
+ `created_at` datetime default NULL,
73
+ `updated_at` datetime default NULL,
74
+ `created_by` int(11) default NULL,
75
+ `updated_by` int(11) default NULL,
76
+ PRIMARY KEY (`id`),
77
+ UNIQUE KEY `login` (`login`)
78
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
79
+
80
+ INSERT INTO schema_info (version) VALUES (8)
@@ -0,0 +1,73 @@
1
+ class CreateRadiantTables < ActiveRecord::Migration
2
+ def self.up
3
+ create_table "config" do |t|
4
+ t.column "key", :string, :limit => 40, :default => "", :null => false
5
+ t.column "value", :string, :default => ""
6
+ end
7
+
8
+ create_table "pages" do |t|
9
+ t.column "title", :string
10
+ t.column "slug", :string, :limit => 100
11
+ t.column "breadcrumb", :string, :limit => 160
12
+ t.column "behavior", :string, :limit => 25
13
+ t.column "status_id", :integer, :default => 1, :null => false
14
+ t.column "parent_id", :integer
15
+ t.column "layout_id", :integer
16
+ t.column "created_at", :datetime
17
+ t.column "updated_at", :datetime
18
+ t.column "published_at", :datetime
19
+ t.column "created_by", :integer
20
+ t.column "updated_by", :integer
21
+ end
22
+
23
+ create_table "page_parts" do |t|
24
+ t.column "name", :string, :limit => 100
25
+ t.column "filter", :string, :limit => 25
26
+ t.column "content", :text
27
+ t.column "page_id", :integer
28
+ end
29
+
30
+ create_table "snippets" do |t|
31
+ t.column "name", :string, :limit => 100, :default => "", :null => false
32
+ t.column "filter", :string, :limit => 25
33
+ t.column "content", :text
34
+ t.column "created_at", :datetime
35
+ t.column "updated_at", :datetime
36
+ t.column "created_by", :integer
37
+ t.column "updated_by", :integer
38
+ end
39
+ add_index "snippets", ["name"], :name => "name", :unique => true
40
+
41
+ create_table "layouts" do |t|
42
+ t.column "name", :string, :limit => 100
43
+ t.column "content", :text
44
+ t.column "created_at", :datetime
45
+ t.column "updated_at", :datetime
46
+ t.column "created_by", :integer
47
+ t.column "updated_by", :integer
48
+ end
49
+
50
+ create_table "users" do |t|
51
+ t.column "name", :string, :limit => 100
52
+ t.column "email", :string
53
+ t.column "login", :string, :limit => 40, :default => "", :null => false
54
+ t.column "password", :string, :limit => 40
55
+ t.column "admin", :integer, :limit => 1, :default => 0, :null => false
56
+ t.column "developer", :integer, :limit => 1, :default => 0, :null => false
57
+ t.column "created_at", :datetime
58
+ t.column "updated_at", :datetime
59
+ t.column "created_by", :integer
60
+ t.column "updated_by", :integer
61
+ end
62
+ add_index "users", ["login"], :name => "login", :unique => true
63
+
64
+ end
65
+
66
+ def self.down
67
+ drop_table "pages"
68
+ drop_table "page_parts"
69
+ drop_table "snippets"
70
+ drop_table "layouts"
71
+ drop_table "users"
72
+ end
73
+ end