trusty-cms 2.0.2.pre.beta → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +2 -0
  3. data/CONTRIBUTORS.md +3 -1
  4. data/Gemfile +6 -1
  5. data/Gemfile.lock +100 -80
  6. data/INSTALL.md +7 -6
  7. data/README.md +3 -1
  8. data/Rakefile +24 -4
  9. data/app/assets/javascripts/admin/jquery-ui.js +3787 -2339
  10. data/app/assets/javascripts/admin/page-edit.js +3 -3
  11. data/app/assets/javascripts/admin/tabcontrol.js.erb +16 -16
  12. data/app/assets/javascripts/admin/treetable.js +4 -2
  13. data/app/assets/stylesheets/admin/_base.scss +4 -4
  14. data/app/assets/stylesheets/admin/modules/_links.scss +1 -1
  15. data/app/assets/stylesheets/admin/partials/_content.scss +9 -2
  16. data/app/assets/stylesheets/admin/partials/_forms.scss +97 -29
  17. data/app/assets/stylesheets/admin/partials/_header.scss +2 -3
  18. data/app/assets/stylesheets/admin/partials/_index.scss +9 -6
  19. data/app/assets/stylesheets/admin/partials/_layout.scss +1 -2
  20. data/app/assets/stylesheets/admin/partials/_popup.scss +0 -11
  21. data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +4 -4
  22. data/app/assets/stylesheets/admin/partials/_typography.scss +4 -0
  23. data/app/controllers/admin/pages_controller.rb +9 -1
  24. data/app/controllers/admin/references_controller.rb +8 -1
  25. data/app/controllers/admin/users_controller.rb +1 -1
  26. data/app/controllers/admin/welcome_controller.rb +3 -3
  27. data/app/controllers/site_controller.rb +1 -1
  28. data/app/helpers/admin/node_helper.rb +4 -4
  29. data/app/models/trusty_cms/config.rb +2 -1
  30. data/app/views/admin/configuration/edit.html.haml +2 -2
  31. data/app/views/admin/configuration/show.html.haml +1 -1
  32. data/app/views/admin/layouts/_form.html.haml +1 -1
  33. data/app/views/admin/layouts/remove.html.haml +1 -1
  34. data/app/views/admin/pages/_fields.html.haml +1 -1
  35. data/app/views/admin/pages/_node.html.haml +2 -2
  36. data/app/views/admin/pages/edit.html.haml +1 -1
  37. data/app/views/admin/pages/remove.html.haml +2 -2
  38. data/app/views/admin/preferences/edit.html.haml +36 -36
  39. data/app/views/admin/users/_form.html.haml +1 -1
  40. data/app/views/admin/users/_password_fields.html.haml +1 -1
  41. data/app/views/admin/users/remove.html.haml +1 -1
  42. data/app/views/admin/welcome/login.html.haml +1 -1
  43. data/app/views/layouts/application.html.haml +18 -16
  44. data/config/application.rb +2 -1
  45. data/config/boot.rb +0 -1
  46. data/config/database.mysql.yml +3 -3
  47. data/config/environments/development.rb +1 -0
  48. data/config/environments/test.rb +2 -4
  49. data/config/initializers/trusty_cms_config.rb +1 -0
  50. data/config/routes.rb +1 -0
  51. data/db/migrate/001_create_radiant_tables.rb +2 -1
  52. data/db/migrate/20100805155020_convert_page_metas.rb +0 -13
  53. data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +0 -4
  54. data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +0 -1
  55. data/lib/generators/instance/templates/databases/mysql.yml +3 -3
  56. data/lib/generators/instance/templates/instance_gemfile +2 -2
  57. data/lib/generators/trusty_cms/templates/database.yml.erb +4 -4
  58. data/lib/generators/trusty_cms/templates/routes.rb.erb +0 -1
  59. data/lib/login_system.rb +1 -1
  60. data/lib/tasks/database.rake +1 -3
  61. data/lib/tasks/framework.rake +1 -1
  62. data/lib/trusty_cms.rb +1 -1
  63. data/lib/trusty_cms/admin_ui.rb +2 -0
  64. data/lib/trusty_cms/extension_migrator.rb +1 -2
  65. data/lib/trusty_cms/initializer.rb +1 -1
  66. data/lib/trusty_cms/setup.rb +1 -1
  67. data/spec/ci/database.mysql.yml +1 -1
  68. data/spec/dummy/README.rdoc +28 -0
  69. data/spec/dummy/Rakefile +5 -0
  70. data/spec/dummy/bin/bundle +3 -0
  71. data/spec/dummy/bin/rails +4 -0
  72. data/spec/dummy/bin/rake +4 -0
  73. data/spec/dummy/bin/setup +29 -0
  74. data/spec/dummy/config.ru +4 -0
  75. data/spec/dummy/config/application.rb +152 -0
  76. data/spec/dummy/config/boot.rb +6 -0
  77. data/spec/dummy/config/database.yml +28 -0
  78. data/spec/dummy/config/environment.rb +5 -0
  79. data/spec/dummy/config/environments/development.rb +49 -0
  80. data/spec/dummy/config/environments/production.rb +79 -0
  81. data/spec/dummy/config/environments/test.rb +42 -0
  82. data/spec/dummy/config/initializers/assets.rb +11 -0
  83. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  84. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  85. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  86. data/spec/dummy/config/initializers/inflections.rb +16 -0
  87. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  88. data/spec/dummy/config/initializers/session_store.rb +3 -0
  89. data/spec/dummy/config/initializers/trusty_cms_config.rb +20 -0
  90. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  91. data/spec/dummy/config/locales/en.yml +23 -0
  92. data/spec/dummy/config/routes.rb +0 -0
  93. data/spec/dummy/config/secrets.yml +22 -0
  94. data/spec/dummy/db/schema.rb +122 -0
  95. data/spec/dummy/public/404.html +67 -0
  96. data/spec/dummy/public/422.html +67 -0
  97. data/spec/dummy/public/500.html +66 -0
  98. data/spec/dummy/public/favicon.ico +0 -0
  99. data/spec/features/pages_spec.rb +2 -2
  100. data/spec/rails_helper.rb +3 -4
  101. data/spec/spec_helper.rb +13 -77
  102. data/spec/support/custom_actions.rb +1 -0
  103. data/trusty_cms.gemspec +4 -2
  104. metadata +171 -182
  105. data/db/migrate/003_rename_behavior_column.rb +0 -9
  106. data/db/migrate/010_merge_behaviors_and_pages.rb +0 -57
  107. data/db/migrate/011_rename_type_column_on_page_to_class_name.rb +0 -9
  108. data/db/migrate/019_add_salt_to_users.rb +0 -11
  109. data/spec/helpers/regions_helper_spec.rb +0 -16
data/config/boot.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  # Don't change this file!
3
2
  # Configure your app in config/environment.rb and config/environments/*.rb
4
3
 
@@ -4,19 +4,19 @@
4
4
  #
5
5
 
6
6
  development:
7
- adapter: mysql
7
+ adapter: mysql2
8
8
  database: trusty_cms_dev
9
9
  username: root
10
10
  password:
11
11
 
12
12
  test: &TEST
13
- adapter: mysql
13
+ adapter: mysql2
14
14
  database: trusty_cms_test
15
15
  username: root
16
16
  password:
17
17
 
18
18
  production:
19
- adapter: mysql
19
+ adapter: mysql2
20
20
  database: trusty_cms_live
21
21
  username: root
22
22
  password:
@@ -5,6 +5,7 @@ TrustyCms::Application.configure do
5
5
  # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the webserver when you make code changes.
7
7
  config.cache_classes = false
8
+ config.eager_load = false
8
9
 
9
10
  # Log error messages when you accidentally call methods on nil.
10
11
  config.whiny_nils = true
@@ -6,6 +6,7 @@ TrustyCms::Application.configure do
6
6
  # your test database is "scratch space" for the test suite and is wiped
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
+ config.eager_load = false
9
10
 
10
11
  # ensure test extensions are loaded
11
12
  # test_extension_dir = File.join(File.expand_path(TRUSTY_CMS_ROOT), 'test', 'fixtures', 'extensions')
@@ -23,9 +24,6 @@ TrustyCms::Application.configure do
23
24
  config.consider_all_requests_local = true
24
25
  config.action_controller.perform_caching = false
25
26
 
26
- # Quiet rack cache logging in test mode
27
- Rails.application.middleware.delete Rack::Cache
28
- Rails.application.middleware.insert 0, Rack::Cache, { verbose: false }
29
27
 
30
28
  # Raise an ActiveModel::MassAssignmentSecurity::Error any time
31
29
  # something is mass-assigned that shouldn't be for ease in debugging.
@@ -40,7 +38,7 @@ TrustyCms::Application.configure do
40
38
  config.action_mailer.delivery_method = :test
41
39
 
42
40
  # Configure static asset server for tests with Cache-Control for performance
43
- config.serve_static_assets = true
41
+ config.serve_static_files = true
44
42
  config.static_cache_control = "public, max-age=3600"
45
43
 
46
44
  # Raise exceptions instead of rendering exception templates
@@ -13,4 +13,5 @@ TrustyCms.config do |config|
13
13
  config.define 'site.title', :default => "Your site title", :allow_blank => false
14
14
  config.define 'site.host', :default => "www.example.com", :allow_blank => false
15
15
  config.define 'user.allow_password_reset?', :default => true
16
+ config.define 'session_timeout', :default => 2.weeks
16
17
  end
data/config/routes.rb CHANGED
@@ -35,4 +35,5 @@ TrustyCms::Application.routes.draw do
35
35
  get 'error/404' => 'site#not_found', :as => :not_found
36
36
  get 'error/500' => 'site#error', :as => :error
37
37
  get '*url' => 'site#show_page'
38
+
38
39
  end
@@ -10,7 +10,7 @@ class CreateRadiantTables < ActiveRecord::Migration
10
10
  t.column "title", :string
11
11
  t.column "slug", :string, :limit => 100
12
12
  t.column "breadcrumb", :string, :limit => 160
13
- t.column "behavior", :string, :limit => 25
13
+ t.column "class_name", :string, :limit => 25
14
14
  t.column "status_id", :integer, :default => 1, :null => false
15
15
  t.column "parent_id", :integer
16
16
  t.column "layout_id", :integer
@@ -59,6 +59,7 @@ class CreateRadiantTables < ActiveRecord::Migration
59
59
  t.column "updated_at", :datetime
60
60
  t.column "created_by", :integer
61
61
  t.column "updated_by", :integer
62
+ t.column "salt", :string
62
63
  end
63
64
  add_index "users", ["login"], :name => "login", :unique => true
64
65
 
@@ -1,24 +1,11 @@
1
1
  class ConvertPageMetas < ActiveRecord::Migration
2
2
  def self.up
3
- # following add and remove column enables running this migration
4
- # when upgrading radiant with allowed_children_cache added to Page model
5
- add_column :pages, :allowed_children_cache, :text
6
- Page.all.each do |page|
7
- page.fields.create(:name => 'Keywords', :content => page.keywords)
8
- page.fields.create(:name => 'Description', :content => page.description)
9
- end
10
3
  remove_column :pages, :keywords
11
4
  remove_column :pages, :description
12
- remove_column :pages, :allowed_children_cache
13
5
  end
14
6
 
15
7
  def self.down
16
8
  add_column :pages, :description, :string
17
9
  add_column :pages, :keywords, :string
18
- Page.all.each do |page|
19
- page.description = page.field('description').content
20
- page.keywords = page.field('keywords').content
21
- page.save
22
- end
23
10
  end
24
11
  end
@@ -1,10 +1,6 @@
1
1
  class AddAllowedChildrenCacheToPages < ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :pages, :allowed_children_cache, :text
4
- Page.reset_column_information
5
- Page.find_each do |page|
6
- page.save # update the allowed_children_cache
7
- end
8
4
  end
9
5
 
10
6
  def self.down
@@ -1,6 +1,5 @@
1
1
  class ChangePagesAllowedChildrenCacheToText < ActiveRecord::Migration
2
2
  def self.up
3
- Page.reset_column_information
4
3
  change_column :pages, :allowed_children_cache, :text
5
4
  end
6
5
 
@@ -11,7 +11,7 @@
11
11
  # And be sure to use new-style password hashing:
12
12
  # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
13
13
  development:
14
- adapter: mysql
14
+ adapter: mysql2
15
15
  database: <%= app_name %>_development
16
16
  username: root
17
17
  password:
@@ -25,7 +25,7 @@ development:
25
25
  # re-generated from your development database when you run 'rake'.
26
26
  # Do not set this db to the same as development or production.
27
27
  test:
28
- adapter: mysql
28
+ adapter: mysql2
29
29
  database: <%= app_name %>_test
30
30
  username: root
31
31
  password:
@@ -36,7 +36,7 @@ test:
36
36
  <% end -%>
37
37
 
38
38
  production:
39
- adapter: mysql
39
+ adapter: mysql2
40
40
  database: <%= app_name %>_production
41
41
  username: root
42
42
  password:
@@ -20,8 +20,8 @@ gem "compass-rails", "~> 1.0.3"
20
20
  # SQLite is the default database connection but only suitable for local use
21
21
  <%= '# ' unless db == 'sqlite3' %>gem "sqlite3", "~> 1.3.5"
22
22
 
23
- # To use MySQL
24
- <%= '# ' unless db == 'mysql' %>gem "mysql", "~> 2.8.1"
23
+ # To use MySQL2
24
+ <%= '# ' unless db == 'mysql2' %>"mysql2", "~> 0.4.2"
25
25
 
26
26
  # Postgres
27
27
  <%= '# ' unless db == 'postgresql' %>gem "pg", "~> 0.11.0"
@@ -4,25 +4,25 @@
4
4
  #
5
5
 
6
6
  development:
7
- adapter: mysql
7
+ adapter: mysql2
8
8
  database: <%= project_name%>_blank_dev
9
9
  username:
10
10
  password:
11
11
  host: localhost
12
12
 
13
13
  test: &TEST
14
- adapter: mysql
14
+ adapter: mysql2
15
15
  database: <%= project_name%>_blank_test
16
16
  username:
17
17
  password:
18
18
  host:
19
19
 
20
20
  production:
21
- adapter: mysql
21
+ adapter: mysql2
22
22
  database: <%= project_name%>_blank_live
23
23
  username:
24
24
  password:
25
25
  socket: /tmp/mysql.sock
26
26
 
27
27
  cucumber:
28
- <<: *TEST
28
+ <<: *TEST
@@ -1 +0,0 @@
1
- load File.join(TRUSTY_CMS_ROOT, "config", "routes.rb")
data/lib/login_system.rb CHANGED
@@ -81,7 +81,7 @@ module LoginSystem
81
81
  end
82
82
 
83
83
  def set_session_cookie(user = current_user)
84
- cookies[:session_token] = { :value => user.session_token , :expires => TrustyCms::Config['session_timeout'].to_i.from_now.utc }
84
+ cookies[:session_token] = { :value => user.session_token , :expires => (Time.now + ((TrustyCms::Config['session_timeout'].to_i)/86400).days).utc }
85
85
  end
86
86
 
87
87
  module ClassMethods
@@ -63,9 +63,7 @@ To add more extensions just add them to your Gemfile and run `bundle install`.
63
63
  end
64
64
 
65
65
  desc "Migrate the database through all available migration scripts (looks for db/migrate/* in trusty-cms, in extensions and in your site) and update db/schema.rb by invoking db:schema:dump. Turn off output with VERBOSE=false."
66
- task :migrate => :environment do
67
- Rake::Task['db:migrate:trusty_cms'].invoke
68
- Rake::Task['db:migrate:extensions'].invoke
66
+ task :migrate => [:environment, 'db:migrate:trusty_cms', 'db:migrate:extensions'] do
69
67
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
70
68
  ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
71
69
  Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
@@ -120,7 +120,7 @@ unless File.directory? "#{Rails.root}/app"
120
120
 
121
121
  db_gems = {
122
122
  'sqlite3' => 'sqlite3',
123
- 'mysql' => 'mysql',
123
+ 'mysql2' => 'mysql2',
124
124
  'pg' => 'postgresql',
125
125
  'db2' => 'db2',
126
126
  'activerecord-sqlserver-adapter' => 'sqlserver'
data/lib/trusty_cms.rb CHANGED
@@ -2,6 +2,6 @@ TRUSTY_CMS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")) unle
2
2
 
3
3
  unless defined? TrustyCms::VERSION
4
4
  module TrustyCms
5
- VERSION = "2.0.2-beta"
5
+ VERSION = "2.0.2"
6
6
  end
7
7
  end
@@ -198,6 +198,7 @@ module TrustyCms
198
198
  index.bottom.concat %w{new_button}
199
199
  end
200
200
  user.new = user.edit
201
+ user.remove = user.edit
201
202
  end
202
203
  end
203
204
 
@@ -215,6 +216,7 @@ module TrustyCms
215
216
  index.bottom.concat %w{new_button}
216
217
  end
217
218
  layout.new = layout.edit
219
+ layout.remove = layout.edit
218
220
  end
219
221
  end
220
222
 
@@ -84,13 +84,12 @@ module TrustyCms
84
84
 
85
85
  def record_version_state_after_migrating(version)
86
86
  sm_table = self.class.schema_migrations_table_name
87
-
88
87
  @migrated_versions ||= []
89
88
  if down?
90
89
  @migrated_versions.delete(version.to_i)
91
90
  ActiveRecord::Base.connection.update("DELETE FROM #{sm_table} WHERE version = #{quote(version_string(version))}")
92
91
  else
93
- @migrated_versions.push(version.to_i).sort!
92
+ @migrated_versions.add(version.to_i)
94
93
  ActiveRecord::Base.connection.insert("INSERT INTO #{sm_table} (version) VALUES (#{quote(version_string(version))})")
95
94
  end
96
95
  end
@@ -3,7 +3,7 @@ require 'rails'
3
3
  require 'jquery-rails'
4
4
  require 'haml-rails'
5
5
  require 'haml'
6
- require 'mysql'
6
+ require 'mysql2'
7
7
 
8
8
  require 'trusty_cms/admin_ui'
9
9
  require 'trusty_cms/extension_loader'
@@ -36,7 +36,7 @@ module TrustyCms
36
36
  :password => password,
37
37
  :password_confirmation => password
38
38
  }
39
- admin = User.find_by_login(username)
39
+ admin = User.find_by(login: username)
40
40
  admin = User.new unless admin
41
41
  admin.update_attributes(attributes)
42
42
  admin.admin = true
@@ -1,4 +1,4 @@
1
1
  test: &TEST
2
- adapter: mysql
2
+ adapter: mysql2
3
3
  database: radiant_test
4
4
  username:
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,5 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ TrustyCms::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,152 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+ require 'acts_as_tree'
5
+ require "trusty_cms"
6
+ require 'ckeditor'
7
+ require 'radius'
8
+ require 'trusty_cms/extension_loader'
9
+ require 'trusty_cms/initializer'
10
+ require 'string_extensions/string_extensions'
11
+ require 'active_record_extensions/active_record_extensions'
12
+ require 'configuration_extensions/configuration_extensions'
13
+ require 'compass'
14
+ require 'rack/cache'
15
+ require "sass-rails"
16
+
17
+ if defined?(Bundler)
18
+ # If you precompile assets before deploying to production, use this line
19
+ require 'rake'
20
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
21
+ # If you want your assets lazily compiled in production, use this line
22
+ # Bundler.require(:default, :assets, Rails.env)
23
+ end
24
+
25
+ module TrustyCms
26
+ class Application < Rails::Application
27
+ include TrustyCms::Initializer
28
+
29
+ config.autoload_paths += %W(#{TRUSTY_CMS_ROOT}/lib)
30
+ config.autoload_paths += %W(#{config.root}/lib)
31
+ config.autoload_paths += %W(#{config.root}/app/helpers)
32
+
33
+ Sass.load_paths << Compass::Frameworks['compass'].stylesheets_directory
34
+
35
+ # Initialize extension paths
36
+ config.initialize_extension_paths
37
+ extension_loader = ExtensionLoader.instance {|l| l.initializer = self }
38
+ extension_loader.paths(:load).reverse_each do |path, value|
39
+ config.autoload_paths.unshift path
40
+ $LOAD_PATH.unshift path
41
+ end
42
+ # config.add_plugin_paths(extension_loader.paths(:plugin))
43
+ # TODO: Come back and look at this.
44
+ radiant_locale_paths = Dir[File.join(TRUSTY_CMS_ROOT, 'config', 'locales', '*.{rb,yml}')]
45
+ config.i18n.load_path = radiant_locale_paths + extension_loader.paths(:locale)
46
+
47
+ config.encoding = 'utf-8'
48
+ # Skip frameworks you're not going to use (only works if using vendor/rails).
49
+ # To use Rails without a database, you must remove the Active Record framework
50
+ # config.frameworks -= [ :action_mailer ]
51
+
52
+ # Only load the extensions named here, in the order given. By default all
53
+ # extensions in vendor/extensions are loaded, in alphabetical order. :all
54
+ # can be used as a placeholder for all extensions not explicitly named.
55
+
56
+ # An example of how to add extensions:
57
+ # config.extensions = [ :snippets, :clipped, :layouts, :reorder, :multi_site, :rad_social]
58
+
59
+ config.extensions = []
60
+ config.extensions_migration_order = []
61
+
62
+ # By default, only English translations are loaded. Remove any of these from
63
+ # the list below if you'd like to provide any of the additional options
64
+ # config.ignore_extensions []
65
+
66
+ # Your secret key for verifying cookie session data integrity.
67
+ # If you change this key, all old sessions will become invalid!
68
+ # Make sure the secret is at least 30 characters and all random,
69
+ # no regular words or you'll be exposed to dictionary attacks.
70
+
71
+ # Comment out this line if you want to turn off all caching, or
72
+ # add options to modify the behavior. In the majority of deployment
73
+ # scenarios it is desirable to leave TrustyCms's cache enabled and in
74
+ # the default configuration.
75
+ #
76
+ # Additional options:
77
+ # :use_x_sendfile => true
78
+ # Turns on X-Sendfile support for Apache with mod_xsendfile or lighttpd.
79
+ # :use_x_accel_redirect => '/some/virtual/path'
80
+ # Turns on X-Accel-Redirect support for nginx. You have to provide
81
+ # a path that corresponds to a virtual location in your webserver
82
+ # configuration.
83
+ # :entitystore => "radiant:tmp/cache/entity"
84
+ # Sets the entity store type (preceding the colon) and storage
85
+ # location (following the colon, relative to Rails.root).
86
+ # We recommend you use radiant: since this will enable manual expiration.
87
+ # :metastore => "radiant:tmp/cache/meta"
88
+ # Sets the meta store type and storage location. We recommend you use
89
+ # radiant: since this will enable manual expiration and acceleration headers.
90
+
91
+ # TODO: We're not sure this is actually working, but we can't really test this until the app initializes.
92
+ config.middleware.use Rack::Cache,
93
+ :private_headers => ['Authorization'],
94
+ :entitystore => "radiant:tmp/cache/entity",
95
+ :metastore => "radiant:tmp/cache/meta",
96
+ :verbose => false,
97
+ :allow_reload => false,
98
+ :allow_revalidate => false
99
+ # TODO: There's got to be a better place for this, but in order for assets to work fornow, we need ConditionalGet
100
+ # TODO: Workaround from: https://github.com/rtomayko/rack-cache/issues/80
101
+ config.middleware.insert_before(Rack::ConditionalGet, Rack::Cache)
102
+ config.assets.enabled = true
103
+
104
+
105
+
106
+ config.filter_parameters += [:password, :password_confirmation]
107
+
108
+ # Use the database for sessions instead of the cookie-based default,
109
+ # which shouldn't be used to store highly confidential information
110
+ # (create the session table with 'rake db:sessions:create')
111
+ # config.action_controller.session_store = :cookie_store DEPRECATED
112
+
113
+ # Activate observers that should always be running
114
+ #config.active_record.observers = :user_action_observer
115
+
116
+ # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
117
+ # All files from config/locales/*.rb,yml are added automatically.
118
+ # config.i18n.load_path << Dir[File.join(Rails.root, 'my', 'locales', '*.{rb,yml}')]
119
+ # config.i18n.default_locale = :'en'
120
+
121
+ # Make Active Record use UTC-base instead of local time
122
+ config.time_zone = 'UTC'
123
+
124
+ # Set the default field error proc
125
+ config.action_view.field_error_proc = Proc.new do |html, instance|
126
+ if html !~ /label/
127
+ %{<span class="error-with-fieldxxxx">#{html} <span class="error">#{[instance.error_message].flatten.first}</span></span>}.html_safe
128
+ else
129
+ html
130
+ end
131
+ end
132
+
133
+ config.after_initialize do
134
+ extension_loader.load_extensions
135
+ extension_loader.load_extension_initalizers
136
+
137
+ #Dir["#{TRUSTY_CMS_ROOT}/config/initializers/**/*.rb"].sort.each do |initializer|
138
+ # load(initializer)
139
+ #end
140
+
141
+ extension_loader.activate_extensions # also calls initialize_views
142
+ #config.add_controller_paths(extension_loader.paths(:controller))
143
+ #config.add_eager_load_paths(extension_loader.paths(:eager_load))
144
+
145
+ # Add new inflection rules using the following format:
146
+ ActiveSupport::Inflector.inflections do |inflect|
147
+ inflect.uncountable 'config'
148
+ end
149
+
150
+ end
151
+ end
152
+ end