trusty-cms 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +23 -0
- data/CHANGELOG.md +754 -0
- data/CONTRIBUTORS.md +263 -0
- data/Gemfile +40 -0
- data/Gemfile.lock +177 -0
- data/INSTALL.md +10 -0
- data/LICENSE.md +21 -0
- data/README.md +85 -0
- data/Rakefile +7 -0
- data/app/controllers/admin/configuration_controller.rb +50 -0
- data/app/controllers/admin/extensions_controller.rb +11 -0
- data/app/controllers/admin/layouts_controller.rb +8 -0
- data/app/controllers/admin/page_fields_controller.rb +9 -0
- data/app/controllers/admin/page_parts_controller.rb +9 -0
- data/app/controllers/admin/pages_controller.rb +89 -0
- data/app/controllers/admin/preferences_controller.rb +46 -0
- data/app/controllers/admin/references_controller.rb +7 -0
- data/app/controllers/admin/resource_controller.rb +245 -0
- data/app/controllers/admin/users_controller.rb +40 -0
- data/app/controllers/admin/welcome_controller.rb +48 -0
- data/app/controllers/application_controller.rb +114 -0
- data/app/controllers/site_controller.rb +97 -0
- data/app/helpers/admin/configuration_helper.rb +80 -0
- data/app/helpers/admin/export_helper.rb +2 -0
- data/app/helpers/admin/extensions_helper.rb +2 -0
- data/app/helpers/admin/layouts_helper.rb +21 -0
- data/app/helpers/admin/node_helper.rb +96 -0
- data/app/helpers/admin/pages_helper.rb +117 -0
- data/app/helpers/admin/preferences_helper.rb +3 -0
- data/app/helpers/admin/references_helper.rb +46 -0
- data/app/helpers/admin/regions_helper.rb +28 -0
- data/app/helpers/admin/resource_helper.rb +2 -0
- data/app/helpers/admin/users_helper.rb +8 -0
- data/app/helpers/admin/welcome_helper.rb +2 -0
- data/app/helpers/application_helper.rb +241 -0
- data/app/helpers/site_helper.rb +2 -0
- data/app/models/deprecated_tags.rb +42 -0
- data/app/models/file_not_found_page.rb +32 -0
- data/app/models/layout.rb +15 -0
- data/app/models/menu_renderer.rb +140 -0
- data/app/models/page.rb +377 -0
- data/app/models/page_context.rb +53 -0
- data/app/models/page_field.rb +3 -0
- data/app/models/page_part.rb +20 -0
- data/app/models/standard_tags.rb +1318 -0
- data/app/models/status.rb +41 -0
- data/app/models/text_filter.rb +36 -0
- data/app/models/trusty_cms/config.rb +313 -0
- data/app/models/trusty_cms/page_response_cache_director.rb +43 -0
- data/app/models/user.rb +96 -0
- data/app/models/user_action_observer.rb +25 -0
- data/app/views/admin/configuration/edit.html.haml +38 -0
- data/app/views/admin/configuration/show.html.haml +58 -0
- data/app/views/admin/extensions/index.html.haml +41 -0
- data/app/views/admin/layouts/_form.html.haml +39 -0
- data/app/views/admin/layouts/edit.html.haml +9 -0
- data/app/views/admin/layouts/index.html.haml +35 -0
- data/app/views/admin/layouts/new.html.haml +7 -0
- data/app/views/admin/layouts/remove.html.haml +16 -0
- data/app/views/admin/page_fields/_page_field.html.haml +12 -0
- data/app/views/admin/page_parts/_page_part.html.haml +18 -0
- data/app/views/admin/pages/_fields.html.haml +71 -0
- data/app/views/admin/pages/_meta_row.html.haml +8 -0
- data/app/views/admin/pages/_node.html.haml +26 -0
- data/app/views/admin/pages/_popups.html.haml +27 -0
- data/app/views/admin/pages/children.html.haml +2 -0
- data/app/views/admin/pages/edit.html.haml +12 -0
- data/app/views/admin/pages/index.html.haml +26 -0
- data/app/views/admin/pages/new.html.haml +10 -0
- data/app/views/admin/pages/remove.html.haml +18 -0
- data/app/views/admin/preferences/edit.html.haml +44 -0
- data/app/views/admin/references/_tag_reference.haml +3 -0
- data/app/views/admin/references/filters.haml +6 -0
- data/app/views/admin/references/tags.haml +30 -0
- data/app/views/admin/users/_avatar.html.haml +5 -0
- data/app/views/admin/users/_form.html.haml +53 -0
- data/app/views/admin/users/_password_fields.html.haml +18 -0
- data/app/views/admin/users/edit.html.haml +9 -0
- data/app/views/admin/users/index.html.haml +39 -0
- data/app/views/admin/users/new.html.haml +6 -0
- data/app/views/admin/users/remove.html.haml +16 -0
- data/app/views/admin/welcome/login.html.haml +23 -0
- data/app/views/layouts/application.html.haml +50 -0
- data/app/views/site/not_found.html.haml +3 -0
- data/bin/ci/before_script +15 -0
- data/bin/trusty_cms +53 -0
- data/config/application.rb +124 -0
- data/config/boot.rb +9 -0
- data/config/compass.config +15 -0
- data/config/database.db2.yml +20 -0
- data/config/database.mysql.yml +25 -0
- data/config/database.postgresql.yml +25 -0
- data/config/database.sqlite.yml +16 -0
- data/config/database.sqlserver.yml +20 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +19 -0
- data/config/environments/production.rb +27 -0
- data/config/environments/test.rb +35 -0
- data/config/initializers/active_record_extensions.rb +1 -0
- data/config/initializers/configuration_extensions.rb +0 -0
- data/config/initializers/haml.rb +2 -0
- data/config/initializers/object_extensions.rb +1 -0
- data/config/initializers/radiant_config.rb +16 -0
- data/config/initializers/rails_patch.rb +2 -0
- data/config/initializers/response_cache_timeout.rb +3 -0
- data/config/initializers/string_extensions.rb +1 -0
- data/config/initializers/symbol_extensions.rb +1 -0
- data/config/initializers/tmp.rb +2 -0
- data/config/locales/en.yml +230 -0
- data/config/locales/en_available_tags.yml +625 -0
- data/config/preinitializer.rb +18 -0
- data/config/routes.rb +30 -0
- data/db/migrate/001_create_radiant_tables.rb +75 -0
- data/db/migrate/002_insert_initial_data.rb +12 -0
- data/db/migrate/003_rename_behavior_column.rb +9 -0
- data/db/migrate/004_rename_filter_column.rb +11 -0
- data/db/migrate/005_add_virtual_column_to_page.rb +9 -0
- data/db/migrate/006_integer_columns_to_boolean.rb +36 -0
- data/db/migrate/007_remove_virtual_column_from_page.rb +9 -0
- data/db/migrate/008_add_virtual_column_to_page_again.rb +9 -0
- data/db/migrate/009_add_content_type_field_to_layout.rb +9 -0
- data/db/migrate/010_merge_behaviors_and_pages.rb +57 -0
- data/db/migrate/011_rename_type_column_on_page_to_class_name.rb +9 -0
- data/db/migrate/012_create_extension_meta.rb +13 -0
- data/db/migrate/013_add_notes_field_to_user.rb +9 -0
- data/db/migrate/014_rename_config_default_parts_key.rb +17 -0
- data/db/migrate/015_add_optimistic_locking.rb +15 -0
- data/db/migrate/016_add_sessions.rb +16 -0
- data/db/migrate/017_rename_created_by_updated_by_columns.rb +15 -0
- data/db/migrate/018_add_description_and_keywords_to_pages.rb +11 -0
- data/db/migrate/019_add_salt_to_users.rb +11 -0
- data/db/migrate/020_add_session_info_to_users.rb +11 -0
- data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
- data/db/migrate/20081203140407_add_indexes.rb +19 -0
- data/db/migrate/20090226140109_add_user_language.rb +9 -0
- data/db/migrate/20090929164633_rename_developer_role_to_designer.rb +9 -0
- data/db/migrate/20091003095744_change_user_language_to_locale.rb +9 -0
- data/db/migrate/20100805154952_add_page_fields.rb +15 -0
- data/db/migrate/20100805155020_convert_page_metas.rb +24 -0
- data/db/migrate/20100810151922_add_field_name_index.rb +11 -0
- data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +13 -0
- data/db/migrate/20111016150725_extend_page_part_content_limit.rb +15 -0
- data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +11 -0
- data/db/schema.rb +128 -0
- data/lib/active_record_extensions/active_record_extensions.rb +27 -0
- data/lib/annotatable.rb +68 -0
- data/lib/configuration_extensions/configuration_extensions.rb +357 -0
- data/lib/generators/extension/USAGE +30 -0
- data/lib/generators/extension/extension_generator.rb +97 -0
- data/lib/generators/extension/templates/README.md +6 -0
- data/lib/generators/extension/templates/RSpecRakefile +109 -0
- data/lib/generators/extension/templates/Rakefile +25 -0
- data/lib/generators/extension/templates/cucumber.yml +1 -0
- data/lib/generators/extension/templates/cucumber_env.rb +11 -0
- data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
- data/lib/generators/extension/templates/en.yml +3 -0
- data/lib/generators/extension/templates/extension.rb +21 -0
- data/lib/generators/extension/templates/functional_test.rb +15 -0
- data/lib/generators/extension/templates/gemspec.rb +29 -0
- data/lib/generators/extension/templates/lib.rb +8 -0
- data/lib/generators/extension/templates/migration.rb +9 -0
- data/lib/generators/extension/templates/radiant_config.rb +3 -0
- data/lib/generators/extension/templates/routes.rb +5 -0
- data/lib/generators/extension/templates/spec.opts +6 -0
- data/lib/generators/extension/templates/spec_helper.rb +42 -0
- data/lib/generators/extension/templates/tasks.rake +47 -0
- data/lib/generators/extension/templates/test_helper.rb +26 -0
- data/lib/generators/extension_controller/USAGE +36 -0
- data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
- data/lib/generators/extension_controller/templates/controller.rb +10 -0
- data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
- data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
- data/lib/generators/extension_controller/templates/helper.rb +2 -0
- data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
- data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
- data/lib/generators/extension_controller/templates/view.html.erb +2 -0
- data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
- data/lib/generators/extension_mailer/USAGE +17 -0
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
- data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
- data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
- data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
- data/lib/generators/extension_mailer/templates/view.erb +3 -0
- data/lib/generators/extension_migration/USAGE +34 -0
- data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
- data/lib/generators/extension_migration/templates/migration.rb +11 -0
- data/lib/generators/extension_model/USAGE +35 -0
- data/lib/generators/extension_model/extension_model_generator.rb +68 -0
- data/lib/generators/extension_model/templates/fixtures.yml +19 -0
- data/lib/generators/extension_model/templates/migration.rb +16 -0
- data/lib/generators/extension_model/templates/model.rb +2 -0
- data/lib/generators/extension_model/templates/model_spec.rb +11 -0
- data/lib/generators/extension_model/templates/unit_test.rb +8 -0
- data/lib/generators/generator_base_extension.rb +16 -0
- data/lib/generators/instance/instance_generator.rb +148 -0
- data/lib/generators/instance/templates/databases/db2.yml +40 -0
- data/lib/generators/instance/templates/databases/mysql.yml +47 -0
- data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
- data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
- data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
- data/lib/generators/instance/templates/instance_boot.rb +122 -0
- data/lib/generators/instance/templates/instance_config.ru +2 -0
- data/lib/generators/instance/templates/instance_environment.rb +83 -0
- data/lib/generators/instance/templates/instance_gemfile +81 -0
- data/lib/generators/instance/templates/instance_generate +6 -0
- data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
- data/lib/generators/instance/templates/instance_rakefile +3 -0
- data/lib/generators/instance/templates/instance_routes.rb +1 -0
- data/lib/generators/language_extension/USAGE +27 -0
- data/lib/generators/language_extension/language_extension_generator.rb +71 -0
- data/lib/generators/language_extension/templates/README +3 -0
- data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
- data/lib/generators/language_extension/templates/Rakefile +25 -0
- data/lib/generators/language_extension/templates/available_tags.yml +553 -0
- data/lib/generators/language_extension/templates/cucumber.yml +1 -0
- data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
- data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
- data/lib/generators/language_extension/templates/extension.rb +12 -0
- data/lib/generators/language_extension/templates/functional_test.rb +15 -0
- data/lib/generators/language_extension/templates/gemspec.rb +24 -0
- data/lib/generators/language_extension/templates/lang.yml +181 -0
- data/lib/generators/language_extension/templates/lib.rb +8 -0
- data/lib/generators/language_extension/templates/spec.opts +6 -0
- data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
- data/lib/generators/language_extension/templates/tasks.rake +28 -0
- data/lib/generators/language_extension/templates/test_helper.rb +26 -0
- data/lib/inheritable_class_attributes.rb +65 -0
- data/lib/local_time.rb +6 -0
- data/lib/login_system.rb +132 -0
- data/lib/method_observer.rb +50 -0
- data/lib/object_extensions/object_extensions.rb +5 -0
- data/lib/simpleton.rb +21 -0
- data/lib/string_extensions/string_extensions.rb +25 -0
- data/lib/symbol_extensions/symbol_extensions.rb +5 -0
- data/lib/tasks/database.rake +85 -0
- data/lib/tasks/environments.rake +11 -0
- data/lib/tasks/extensions.rake +85 -0
- data/lib/tasks/framework.rake +255 -0
- data/lib/tasks/instance.rake +23 -0
- data/lib/tasks/prototype.rake +31 -0
- data/lib/tasks/radiant_config.rake +18 -0
- data/lib/tasks/release.rake +131 -0
- data/lib/tasks/translate.rake +59 -0
- data/lib/tasks/undefine.rake +28 -0
- data/lib/translation_support.rb +54 -0
- data/lib/trusty_cms/admin_ui/region_partials.rb +23 -0
- data/lib/trusty_cms/admin_ui/region_set.rb +35 -0
- data/lib/trusty_cms/admin_ui.rb +244 -0
- data/lib/trusty_cms/available_locales.rb +19 -0
- data/lib/trusty_cms/cache.rb +100 -0
- data/lib/trusty_cms/config/definition.rb +142 -0
- data/lib/trusty_cms/engine.rb +10 -0
- data/lib/trusty_cms/extension/script.rb +395 -0
- data/lib/trusty_cms/extension.rb +146 -0
- data/lib/trusty_cms/extension_loader.rb +130 -0
- data/lib/trusty_cms/extension_migrator.rb +98 -0
- data/lib/trusty_cms/extension_path.rb +200 -0
- data/lib/trusty_cms/initializer.rb +162 -0
- data/lib/trusty_cms/pagination/controller.rb +41 -0
- data/lib/trusty_cms/pagination/link_renderer.rb +34 -0
- data/lib/trusty_cms/resource_responses.rb +121 -0
- data/lib/trusty_cms/setup.rb +227 -0
- data/lib/trusty_cms/taggable.rb +138 -0
- data/lib/trusty_cms/task_support.rb +66 -0
- data/lib/trusty_cms.rb +19 -0
- data/log/.keep +0 -0
- data/public/.htaccess +40 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/admin/add_tab.png +0 -0
- data/public/images/admin/avatar_32x32.png +0 -0
- data/public/images/admin/avatar_64x64.png +0 -0
- data/public/images/admin/avatar_96x96.png +0 -0
- data/public/images/admin/brown_bottom_line.gif +0 -0
- data/public/images/admin/calendar_down.gif +0 -0
- data/public/images/admin/collapse.png +0 -0
- data/public/images/admin/draft_page.png +0 -0
- data/public/images/admin/expand.png +0 -0
- data/public/images/admin/image.png +0 -0
- data/public/images/admin/javascript.png +0 -0
- data/public/images/admin/layout.png +0 -0
- data/public/images/admin/metadata_toggle.png +0 -0
- data/public/images/admin/minus.png +0 -0
- data/public/images/admin/minus_disabled.png +0 -0
- data/public/images/admin/minus_grey.png +0 -0
- data/public/images/admin/navigation_secondary_separator.gif +0 -0
- data/public/images/admin/page.png +0 -0
- data/public/images/admin/plus.png +0 -0
- data/public/images/admin/plus_disabled.png +0 -0
- data/public/images/admin/plus_grey.png +0 -0
- data/public/images/admin/popup_border_background.png +0 -0
- data/public/images/admin/popup_border_bottom_left.png +0 -0
- data/public/images/admin/popup_border_bottom_right.png +0 -0
- data/public/images/admin/popup_border_top_left.png +0 -0
- data/public/images/admin/popup_border_top_right.png +0 -0
- data/public/images/admin/search.png +0 -0
- data/public/images/admin/single_form_shadow.png +0 -0
- data/public/images/admin/snippet.png +0 -0
- data/public/images/admin/spinner.gif +0 -0
- data/public/images/admin/status_background.png +0 -0
- data/public/images/admin/status_bottom_left.png +0 -0
- data/public/images/admin/status_bottom_right.png +0 -0
- data/public/images/admin/status_spinner.gif +0 -0
- data/public/images/admin/status_top_left.png +0 -0
- data/public/images/admin/status_top_right.png +0 -0
- data/public/images/admin/stylesheet.png +0 -0
- data/public/images/admin/tab_close.png +0 -0
- data/public/images/admin/upload.png +0 -0
- data/public/images/admin/virtual_page.png +0 -0
- data/public/images/radiant/radiant-badge-color.png +0 -0
- data/public/javascripts/admin/application.js +94 -0
- data/public/javascripts/admin/codearea.js +165 -0
- data/public/javascripts/admin/controls.js +965 -0
- data/public/javascripts/admin/cookie.js +80 -0
- data/public/javascripts/admin/dateinput.js +402 -0
- data/public/javascripts/admin/dragdrop.js +974 -0
- data/public/javascripts/admin/dropdown.js +216 -0
- data/public/javascripts/admin/effects.js +1122 -0
- data/public/javascripts/admin/lowpro.js +340 -0
- data/public/javascripts/admin/overrides.js +1 -0
- data/public/javascripts/admin/page_preview.js +41 -0
- data/public/javascripts/admin/pagefield.js +54 -0
- data/public/javascripts/admin/pagestatus.js +17 -0
- data/public/javascripts/admin/popup.js +339 -0
- data/public/javascripts/admin/prototype.js +4874 -0
- data/public/javascripts/admin/ruledtable.js +13 -0
- data/public/javascripts/admin/shortcuts.js +33 -0
- data/public/javascripts/admin/sitemap.js +149 -0
- data/public/javascripts/admin/status.js +233 -0
- data/public/javascripts/admin/tabcontrol.js +123 -0
- data/public/javascripts/admin/toggle.js +430 -0
- data/public/javascripts/admin/utility.js +53 -0
- data/public/javascripts/admin/validationerror.js +18 -0
- data/public/loading-iframe.html +11 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/sass/admin/_base.sass +18 -0
- data/public/stylesheets/sass/admin/main.sass +27 -0
- data/public/stylesheets/sass/admin/modules/_boxes.sass +6 -0
- data/public/stylesheets/sass/admin/modules/_gradients.sass +4 -0
- data/public/stylesheets/sass/admin/modules/_links.sass +18 -0
- data/public/stylesheets/sass/admin/overrides.sass +2 -0
- data/public/stylesheets/sass/admin/partials/_actions.sass +96 -0
- data/public/stylesheets/sass/admin/partials/_avatars.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_content.sass +58 -0
- data/public/stylesheets/sass/admin/partials/_dateinput.sass +62 -0
- data/public/stylesheets/sass/admin/partials/_deprecated.sass +55 -0
- data/public/stylesheets/sass/admin/partials/_dropdown.sass +28 -0
- data/public/stylesheets/sass/admin/partials/_footer.sass +12 -0
- data/public/stylesheets/sass/admin/partials/_forms.sass +322 -0
- data/public/stylesheets/sass/admin/partials/_header.sass +114 -0
- data/public/stylesheets/sass/admin/partials/_index.sass +147 -0
- data/public/stylesheets/sass/admin/partials/_layout.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_messages.sass +10 -0
- data/public/stylesheets/sass/admin/partials/_popup.sass +213 -0
- data/public/stylesheets/sass/admin/partials/_tabcontrol.sass +72 -0
- data/public/stylesheets/sass/admin/partials/_toolbar.sass +31 -0
- data/public/stylesheets/sass/admin/partials/_typography.sass +60 -0
- data/public/stylesheets/sass/admin/partials/_validations.sass +19 -0
- data/rails/init.rb +1 -0
- data/script/about +4 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/extension +5 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/performance/request +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/rails +6 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/version +5 -0
- data/spec/ci/database.mysql.yml +4 -0
- data/spec/ci/database.postgresql.yml +4 -0
- data/spec/ci/database.sqlite.yml +3 -0
- data/trusty_cms.gemspec +50 -0
- metadata +781 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :i18n do
|
3
|
+
|
4
|
+
desc "Syncs all available translations to the English master"
|
5
|
+
task :sync => :environment do
|
6
|
+
# All places TrustyCms can store locales
|
7
|
+
locale_paths = TrustyCms::AvailableLocales.locale_paths
|
8
|
+
# The main translation root, basically where English is kept
|
9
|
+
language_root = "#{TRUSTY_CMS_ROOT}/config/locales"
|
10
|
+
words = TranslationSupport.get_translation_keys(language_root)
|
11
|
+
locale_paths.each do |path|
|
12
|
+
if path == language_root || path.match('language_pack')
|
13
|
+
Dir["#{path}/*.yml"].each do |filename|
|
14
|
+
next if filename.match('_available_tags')
|
15
|
+
basename = File.basename(filename, '.yml')
|
16
|
+
puts "Syncing #{basename}"
|
17
|
+
(comments, other) = TranslationSupport.read_file(filename, basename)
|
18
|
+
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
|
19
|
+
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
|
20
|
+
TranslationSupport.write_file(filename, basename, comments, other)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Creates or updates the English available tag descriptions"
|
27
|
+
task :available_tags => :environment do
|
28
|
+
descriptions = Hash.new
|
29
|
+
Page.tag_descriptions.sort.each do |tag, desc|
|
30
|
+
tag = ' ' + tag.gsub(':','-') + ':'
|
31
|
+
desc = desc.gsub(' ',' ')
|
32
|
+
descriptions[tag] = ' "' + desc.gsub('%','%').gsub('"','\"').strip + '"'
|
33
|
+
end
|
34
|
+
comments = ''
|
35
|
+
TranslationSupport.write_file("#{TRUSTY_CMS_ROOT}/config/locales/en_available_tags.yml","---\nen:\n desc",comments,descriptions)
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Syncs all translations available_tags to the English master"
|
39
|
+
task :sync_available_tags => :environment do
|
40
|
+
# All places TrustyCms can store locales
|
41
|
+
locale_paths = TrustyCms::AvailableLocales.locale_paths
|
42
|
+
# The main translation root, basically where English is kept
|
43
|
+
language_root = "#{TRUSTY_CMS_ROOT}/config/locales"
|
44
|
+
words = TranslationSupport.open_available_tags("#{language_root}/en_available_tags.yml")
|
45
|
+
locale_paths.each do |path|
|
46
|
+
if path == language_root || path.match('language_pack')
|
47
|
+
Dir["#{path}/*.yml"].each do |filename|
|
48
|
+
next unless filename.match('_available_tags')
|
49
|
+
basename = File.basename(filename, '_available_tags.yml')
|
50
|
+
puts "Syncing #{basename}"
|
51
|
+
(comments, other) = TranslationSupport.open_available_tags(filename)
|
52
|
+
puts other
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# # Undefined unneeded tasks in instance mode
|
2
|
+
# unless TrustyCms.app?
|
3
|
+
# def undefine_task(*names)
|
4
|
+
# app = Rake.application
|
5
|
+
# tasks = app.instance_variable_get('@tasks')
|
6
|
+
# names.flatten.each { |name| tasks.delete(name) }
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# undefine_task %w(
|
10
|
+
# radiant:clobber_package
|
11
|
+
# radiant:install_gem
|
12
|
+
# radiant:package
|
13
|
+
# radiant:release
|
14
|
+
# radiant:repackage
|
15
|
+
# radiant:uninstall_gem
|
16
|
+
# radiant:import:prototype:stylesheets
|
17
|
+
# radiant:import:prototype:images
|
18
|
+
# radiant:import:prototype:javascripts
|
19
|
+
# radiant:import:prototype:assets
|
20
|
+
# rails:freeze:edge
|
21
|
+
# rails:freeze:gems
|
22
|
+
# rails:unfreeze
|
23
|
+
# rails:update
|
24
|
+
# rails:update:configs
|
25
|
+
# rails:update:javascripts
|
26
|
+
# rails:update:scripts
|
27
|
+
# )
|
28
|
+
# end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class TranslationSupport
|
2
|
+
class << self
|
3
|
+
|
4
|
+
#Retrieve US word set
|
5
|
+
def get_translation_keys(language_root, suffix=nil)
|
6
|
+
(dummy_comments, words) = read_file("#{language_root}/en#{suffix}.yml", 'en')
|
7
|
+
words
|
8
|
+
end
|
9
|
+
|
10
|
+
#Retrieve comments, translation data in hash form
|
11
|
+
def read_file(filename, basename)
|
12
|
+
(comments, data) = IO.read(filename).split(/\n#{basename}:\s*\n/) #Add error checking for failed file read?
|
13
|
+
return comments, create_hash(data, basename)
|
14
|
+
end
|
15
|
+
|
16
|
+
#Creates hash of translation data
|
17
|
+
def create_hash(data, basename)
|
18
|
+
words = Hash.new
|
19
|
+
return words if !data
|
20
|
+
parent = Array.new
|
21
|
+
previous_key = 'base'
|
22
|
+
data.split("\n").each do |w|
|
23
|
+
next if w.strip.blank?
|
24
|
+
(key, value) = w.split(':', 2)
|
25
|
+
value ||= ''
|
26
|
+
shift = (key =~ /\w/)/2 - parent.size #Determine level of current key in comparison to parent array
|
27
|
+
key = key.sub(/^\s+/,'')
|
28
|
+
parent << previous_key if shift > 0 #If key is child of previous key, add previous key as parent
|
29
|
+
(shift * -1).times { parent.pop } if shift < 0 #If key is not related to previous key, remove parent keys
|
30
|
+
previous_key = key #Track key in case next key is child of this key
|
31
|
+
words[parent.join(':') + ':' + key] = value unless key.blank?
|
32
|
+
end
|
33
|
+
words
|
34
|
+
end
|
35
|
+
|
36
|
+
def open_available_tags(filename)
|
37
|
+
data = YAML::load(File.open("#{filename}"))
|
38
|
+
data.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
#Writes to file from translation data hash structure
|
42
|
+
def write_file(filename,basename,comments,words)
|
43
|
+
File.open(filename, "w") do |log|
|
44
|
+
log.puts(comments+"\n"+basename+": \n")
|
45
|
+
words.sort.each do |k,v|
|
46
|
+
keys = k.split(':')
|
47
|
+
(keys.size-1).times { keys[keys.size-1] = ' ' + keys[keys.size-1] } #Add indentation for children keys
|
48
|
+
log.puts(keys[keys.size-1]+':'+v+"\n")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class TrustyCms::AdminUI::RegionPartials
|
2
|
+
def initialize(template)
|
3
|
+
@partials = Hash.new {|h,k| h[k] = "<strong>`#{k}' default partial not found!</strong>" }
|
4
|
+
@template = template
|
5
|
+
end
|
6
|
+
|
7
|
+
def [](key)
|
8
|
+
@partials[key.to_s]
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(method, *args, &block)
|
12
|
+
if block_given?
|
13
|
+
# Ruby 1.9.2 yields self in instance_eval... see https://gist.github.com/479572
|
14
|
+
# lambdas are as strict as methods in 1.9.x, making sure that the args match, Procs are not.
|
15
|
+
if RUBY_VERSION =~ /^1\.9/ and block.lambda? and block.arity != 1
|
16
|
+
raise "You can only pass a proc ('Proc.new') or a lambda that takes exactly one arg (for self) to TrustyCms::AdminUI::RegionPartials' method_missing."
|
17
|
+
end
|
18
|
+
@partials[method.to_s] = @template.capture(&block)
|
19
|
+
else
|
20
|
+
@partials[method.to_s]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class TrustyCms::AdminUI::RegionSet
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@regions = Hash.new do |h,k|
|
5
|
+
h[k] = []
|
6
|
+
end
|
7
|
+
yield self if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](region)
|
11
|
+
@regions[region.to_sym]
|
12
|
+
end
|
13
|
+
|
14
|
+
def add(region=nil, partial=nil, options={})
|
15
|
+
raise ArgumentError, "You must specify a region and a partial" unless region and partial
|
16
|
+
if options[:before]
|
17
|
+
index = @regions[region].empty? ? 0 : (@regions[region].index(options[:before]) || @regions[region].size)
|
18
|
+
self[region].insert(index, partial)
|
19
|
+
elsif options[:after]
|
20
|
+
index = @regions[region].empty? ? 0 : (@regions[region].index(options[:after]) || @regions[region].size - 1)
|
21
|
+
self[region].insert(index + 1, partial)
|
22
|
+
else
|
23
|
+
self[region] << partial
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def method_missing(method, *args, &block)
|
28
|
+
if args.empty?
|
29
|
+
self[method]
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,244 @@
|
|
1
|
+
require 'simpleton'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module TrustyCms
|
5
|
+
class AdminUI
|
6
|
+
# This may be loaded before ActiveSupport, so do an explicit require
|
7
|
+
require 'trusty_cms/admin_ui/region_set'
|
8
|
+
|
9
|
+
class DuplicateTabNameError < StandardError; end
|
10
|
+
|
11
|
+
# The NavTab Class holds the structure of a navigation tab (including
|
12
|
+
# its sub-nav items).
|
13
|
+
class NavTab < Array
|
14
|
+
attr_reader :name
|
15
|
+
|
16
|
+
def initialize(name)
|
17
|
+
@name = name
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](id)
|
21
|
+
unless id.kind_of? Fixnum
|
22
|
+
self.find {|subnav_item| subnav_item.name.to_s.titleize == id.to_s.titleize }
|
23
|
+
else
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def <<(*args)
|
29
|
+
options = args.extract_options!
|
30
|
+
item = args.size > 1 ? deprecated_add(*(args << caller)) : args.first
|
31
|
+
raise DuplicateTabNameError.new("duplicate tab name `#{item.name}'") if self[item.name]
|
32
|
+
item.tab = self if item.respond_to?(:tab=)
|
33
|
+
if options.empty?
|
34
|
+
super(item)
|
35
|
+
else
|
36
|
+
options.symbolize_keys!
|
37
|
+
before = options.delete(:before)
|
38
|
+
after = options.delete(:after)
|
39
|
+
tab_name = before || after
|
40
|
+
if self[tab_name]
|
41
|
+
_index = index(self[tab_name])
|
42
|
+
_index += 1 unless before
|
43
|
+
insert(_index, item)
|
44
|
+
else
|
45
|
+
super(item)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
alias :add :<<
|
51
|
+
|
52
|
+
def add_item(*args)
|
53
|
+
options = args.extract_options!
|
54
|
+
options.symbolize_keys!
|
55
|
+
before = options.delete(:before)
|
56
|
+
after = options.delete(:after)
|
57
|
+
tab_name = before || after
|
58
|
+
if self[tab_name]
|
59
|
+
_index = index(self[tab_name])
|
60
|
+
_index += 1 unless before
|
61
|
+
insert(_index, NavSubItem.new(args.first, args.second))
|
62
|
+
else
|
63
|
+
add NavSubItem.new(args.first, args.second)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def visible?(user)
|
68
|
+
any? { |sub_item| sub_item.visible?(user) }
|
69
|
+
end
|
70
|
+
|
71
|
+
def deprecated_add(name, url, caller)
|
72
|
+
ActiveSupport::Deprecation.warn("admin.tabs.add is no longer supported in TrustyCms 0.9.x. Please update your code to use: \ntab \"Content\" do\n\tadd_item(...)\nend", caller)
|
73
|
+
NavSubItem.new(name, url)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Simple structure for storing the properties of a tab's sub items.
|
78
|
+
class NavSubItem
|
79
|
+
attr_reader :name, :url
|
80
|
+
attr_accessor :tab
|
81
|
+
|
82
|
+
def initialize(name, url = "#")
|
83
|
+
@name, @url = name, url
|
84
|
+
end
|
85
|
+
|
86
|
+
def visible?(user)
|
87
|
+
visible_by_controller?(user)
|
88
|
+
end
|
89
|
+
|
90
|
+
def relative_url
|
91
|
+
File.join(ActionController::Base.relative_url_root || '', url)
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
def visible_by_controller?(user)
|
96
|
+
params = ActionController::Routing::Routes.recognize_path(url, :method => :get)
|
97
|
+
if params && params[:controller]
|
98
|
+
klass = "#{params[:controller].camelize}Controller".constantize
|
99
|
+
klass.user_has_access_to_action?(user, params[:action])
|
100
|
+
else
|
101
|
+
false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
include Simpleton
|
107
|
+
|
108
|
+
attr_accessor :nav
|
109
|
+
|
110
|
+
def nav_tab(*args)
|
111
|
+
NavTab.new(*args)
|
112
|
+
end
|
113
|
+
|
114
|
+
def nav_item(*args)
|
115
|
+
NavSubItem.new(*args)
|
116
|
+
end
|
117
|
+
|
118
|
+
def tabs
|
119
|
+
nav['Content']
|
120
|
+
end
|
121
|
+
|
122
|
+
# Region sets
|
123
|
+
%w{page layout user configuration extension}.each do |controller|
|
124
|
+
attr_accessor controller
|
125
|
+
alias_method "#{controller}s", controller
|
126
|
+
end
|
127
|
+
|
128
|
+
def initialize
|
129
|
+
initialize_nav
|
130
|
+
load_default_regions
|
131
|
+
end
|
132
|
+
|
133
|
+
def initialize_nav
|
134
|
+
@nav = NavTab.new("Tab Container")
|
135
|
+
load_default_nav
|
136
|
+
end
|
137
|
+
|
138
|
+
def load_default_nav
|
139
|
+
content = nav_tab("Content")
|
140
|
+
content << nav_item("Pages", "/admin/pages")
|
141
|
+
nav << content
|
142
|
+
|
143
|
+
design = nav_tab("Design")
|
144
|
+
design << nav_item("Layouts", "/admin/layouts")
|
145
|
+
nav << design
|
146
|
+
|
147
|
+
settings = nav_tab("Settings")
|
148
|
+
settings << nav_item("General", "/admin/configuration")
|
149
|
+
settings << nav_item("Personal", "/admin/preferences")
|
150
|
+
settings << nav_item("Users", "/admin/users")
|
151
|
+
settings << nav_item("Extensions", "/admin/extensions")
|
152
|
+
nav << settings
|
153
|
+
end
|
154
|
+
|
155
|
+
def load_default_regions
|
156
|
+
@page = load_default_page_regions
|
157
|
+
@layout = load_default_layout_regions
|
158
|
+
@user = load_default_user_regions
|
159
|
+
@configuration = load_default_configuration_regions
|
160
|
+
@extension = load_default_extension_regions
|
161
|
+
end
|
162
|
+
|
163
|
+
private
|
164
|
+
|
165
|
+
def load_default_page_regions
|
166
|
+
OpenStruct.new.tap do |page|
|
167
|
+
page.edit = RegionSet.new do |edit|
|
168
|
+
edit.main.concat %w{edit_header edit_form edit_popups}
|
169
|
+
edit.form.concat %w{edit_title edit_extended_metadata edit_page_parts}
|
170
|
+
edit.layout.concat %w{edit_layout edit_type edit_status edit_published_at}
|
171
|
+
edit.form_bottom.concat %w{edit_buttons edit_timestamp}
|
172
|
+
end
|
173
|
+
page.index = RegionSet.new do |index|
|
174
|
+
index.sitemap_head.concat %w{title_column_header status_column_header actions_column_header}
|
175
|
+
index.node.concat %w{title_column status_column actions_column}
|
176
|
+
end
|
177
|
+
page.remove = page.children = page.index
|
178
|
+
page.new = page._part = page.edit
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def load_default_user_regions
|
183
|
+
OpenStruct.new.tap do |user|
|
184
|
+
user.preferences = RegionSet.new do |preferences|
|
185
|
+
preferences.main.concat %w{edit_header edit_form}
|
186
|
+
preferences.form.concat %w{edit_name edit_email edit_username edit_password edit_locale}
|
187
|
+
preferences.form_bottom.concat %w{edit_buttons}
|
188
|
+
end
|
189
|
+
user.edit = RegionSet.new do |edit|
|
190
|
+
edit.main.concat %w{edit_header edit_form}
|
191
|
+
edit.form.concat %w{edit_name edit_email edit_username edit_password
|
192
|
+
edit_roles edit_locale edit_notes}
|
193
|
+
edit.form_bottom.concat %w{edit_buttons edit_timestamp}
|
194
|
+
end
|
195
|
+
user.index = RegionSet.new do |index|
|
196
|
+
index.thead.concat %w{title_header roles_header actions_header}
|
197
|
+
index.tbody.concat %w{title_cell roles_cell actions_cell}
|
198
|
+
index.bottom.concat %w{new_button}
|
199
|
+
end
|
200
|
+
user.new = user.edit
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def load_default_layout_regions
|
205
|
+
OpenStruct.new.tap do |layout|
|
206
|
+
layout.edit = RegionSet.new do |edit|
|
207
|
+
edit.main.concat %w{edit_header edit_form}
|
208
|
+
edit.form.concat %w{edit_title edit_extended_metadata edit_content}
|
209
|
+
edit.form_bottom.concat %w{reference_links edit_buttons edit_timestamp}
|
210
|
+
end
|
211
|
+
layout.index = RegionSet.new do |index|
|
212
|
+
index.top.concat %w{}
|
213
|
+
index.thead.concat %w{title_header actions_header}
|
214
|
+
index.tbody.concat %w{title_cell actions_cell}
|
215
|
+
index.bottom.concat %w{new_button}
|
216
|
+
end
|
217
|
+
layout.new = layout.edit
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def load_default_configuration_regions
|
222
|
+
OpenStruct.new.tap do |configuration|
|
223
|
+
configuration.show = RegionSet.new do |show|
|
224
|
+
show.user.concat %w{preferences}
|
225
|
+
show.config.concat %w{site defaults users}
|
226
|
+
end
|
227
|
+
configuration.edit = RegionSet.new do |edit|
|
228
|
+
edit.main.concat %w{edit_header edit_form}
|
229
|
+
edit.form.concat %w{edit_site edit_defaults edit_users}
|
230
|
+
edit.form_bottom.concat %w{edit_buttons}
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def load_default_extension_regions
|
236
|
+
OpenStruct.new.tap do |extension|
|
237
|
+
extension.index = RegionSet.new do |index|
|
238
|
+
index.thead.concat %w{title_header website_header version_header}
|
239
|
+
index.tbody.concat %w{title_cell website_cell version_cell}
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module TrustyCms::AvailableLocales
|
2
|
+
|
3
|
+
# Returns the list of available locale files in options_for_select format.
|
4
|
+
#
|
5
|
+
def self.locales
|
6
|
+
available_locales = {}
|
7
|
+
TrustyCms.configuration.i18n.load_path.each do |path|
|
8
|
+
if File.exists?(path) && path !~ /_available_tags/
|
9
|
+
locale_yaml = YAML.load_file(path)
|
10
|
+
stem = File.basename(path, '.yml')
|
11
|
+
if locale_yaml[stem] && lang = locale_yaml[stem]["this_file_language"]
|
12
|
+
available_locales[lang] = stem
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
available_locales.collect {|k,v| [k, v]}.sort_by { |s| s[0] }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'rack/cache'
|
2
|
+
# So we can subclass the storage types
|
3
|
+
require 'rack/cache/storage'
|
4
|
+
require 'rack/cache/metastore'
|
5
|
+
require 'rack/cache/entitystore'
|
6
|
+
|
7
|
+
module TrustyCms
|
8
|
+
module Cache
|
9
|
+
mattr_accessor :meta_stores, :entity_stores, :use_x_sendfile, :use_x_accel_redirect
|
10
|
+
self.meta_stores ||= []
|
11
|
+
self.entity_stores ||= []
|
12
|
+
self.use_x_sendfile = false
|
13
|
+
self.use_x_accel_redirect = nil
|
14
|
+
|
15
|
+
def self.new(app, options={})
|
16
|
+
self.use_x_sendfile = options.delete(:use_x_sendfile) if options[:use_x_sendfile]
|
17
|
+
self.use_x_accel_redirect = options.delete(:use_x_accel_redirect) if options[:use_x_accel_redirect]
|
18
|
+
Rack::Cache.new(app, {
|
19
|
+
:private_headers => ['Authorization'],
|
20
|
+
:entitystore => "radiant:tmp/cache/entity",
|
21
|
+
:metastore => "radiant:tmp/cache/meta",
|
22
|
+
:verbose => false,
|
23
|
+
:allow_reload => false,
|
24
|
+
:allow_revalidate => false}.merge(options))
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.clear
|
28
|
+
meta_stores.each {|ms| ms.clear }
|
29
|
+
entity_stores.each {|es| es.clear }
|
30
|
+
end
|
31
|
+
|
32
|
+
class EntityStore < Rack::Cache::EntityStore::Disk
|
33
|
+
def initialize(root="#{Rails.root}/tmp/cache/entity")
|
34
|
+
super
|
35
|
+
TrustyCms::Cache.entity_stores << self
|
36
|
+
end
|
37
|
+
|
38
|
+
def clear
|
39
|
+
Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def write(body)
|
43
|
+
# Verify that the cache directory exists before attempting to write
|
44
|
+
FileUtils.mkdir_p(self.root, :mode => 0755) unless File.directory?(self.root)
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class MetaStore < Rack::Cache::MetaStore::Disk
|
50
|
+
def initialize(root="#{Rails.root}/tmp/cache/meta")
|
51
|
+
super
|
52
|
+
TrustyCms::Cache.meta_stores << self
|
53
|
+
end
|
54
|
+
|
55
|
+
def clear
|
56
|
+
Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) }
|
57
|
+
end
|
58
|
+
|
59
|
+
def store(request, response, entitystore)
|
60
|
+
# Verify that the cache directory exists before attempting to store
|
61
|
+
FileUtils.mkdir_p(self.root, :mode => 0755) unless File.directory?(self.root)
|
62
|
+
super
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
def restore_response(hash, body=nil)
|
67
|
+
# Cribbed from the Rack::Cache source
|
68
|
+
status = hash.delete('X-Status').to_i
|
69
|
+
response = Rack::Cache::Response.new(status, hash, body)
|
70
|
+
|
71
|
+
# Add acceleration headers
|
72
|
+
if TrustyCms::Cache.use_x_sendfile
|
73
|
+
accelerate(response, 'X-Sendfile', File.expand_path(body.path))
|
74
|
+
elsif TrustyCms::Cache.use_x_accel_redirect
|
75
|
+
virtual_path = File.expand_path(body.path)
|
76
|
+
entity_path = File.expand_path(TrustyCms::Cache.entity_stores.first.root)
|
77
|
+
virtual_path[entity_path] = TrustyCms::Cache.use_x_accel_redirect
|
78
|
+
accelerate(response,'X-Accel-Redirect', virtual_path)
|
79
|
+
end
|
80
|
+
response
|
81
|
+
end
|
82
|
+
|
83
|
+
def accelerate(response, header, value)
|
84
|
+
response.headers[header] = value
|
85
|
+
response.body = []
|
86
|
+
response.headers['Content-Length'] = '0'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Rack::Cache will look for a constant matching the uri scheme given to the :metastore and :entitystore options
|
93
|
+
# when initialising the Middleware
|
94
|
+
class Rack::Cache::EntityStore
|
95
|
+
RADIANT = TrustyCms::Cache::EntityStore
|
96
|
+
end
|
97
|
+
|
98
|
+
class Rack::Cache::MetaStore
|
99
|
+
RADIANT = TrustyCms::Cache::MetaStore
|
100
|
+
end
|