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,41 @@
|
|
1
|
+
class Status
|
2
|
+
attr_accessor :id, :name
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
options = options.symbolize_keys
|
6
|
+
@id, @name = options[:id], options[:name]
|
7
|
+
end
|
8
|
+
|
9
|
+
def symbol
|
10
|
+
@name.to_s.downcase.intern
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.[](value)
|
14
|
+
@@statuses.find { |status| status.symbol == value.to_s.downcase.intern }
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.find(id)
|
18
|
+
@@statuses.find { |status| status.id.to_s == id.to_s }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.find_all
|
22
|
+
@@statuses.dup
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.selectable
|
26
|
+
find_all - [self['Scheduled']]
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.selectable_values
|
30
|
+
self.selectable.map(&:name)
|
31
|
+
end
|
32
|
+
|
33
|
+
@@statuses = [
|
34
|
+
Status.new(:id => 1, :name => 'Draft' ),
|
35
|
+
Status.new(:id => 50, :name => 'Reviewed' ),
|
36
|
+
Status.new(:id => 90, :name => 'Scheduled'),
|
37
|
+
Status.new(:id => 100, :name => 'Published'),
|
38
|
+
Status.new(:id => 101, :name => 'Hidden' )
|
39
|
+
]
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class TextFilter
|
2
|
+
include Simpleton
|
3
|
+
include Annotatable
|
4
|
+
|
5
|
+
annotate :filter_name, :description
|
6
|
+
|
7
|
+
def filter(text)
|
8
|
+
text
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def inherited(subclass)
|
13
|
+
subclass.filter_name = subclass.name.to_name('Filter')
|
14
|
+
end
|
15
|
+
|
16
|
+
def filter(text)
|
17
|
+
instance.filter(text)
|
18
|
+
end
|
19
|
+
|
20
|
+
def description_file(filename)
|
21
|
+
text = File.read(filename) rescue ""
|
22
|
+
self.description text
|
23
|
+
end
|
24
|
+
|
25
|
+
def descendants_names
|
26
|
+
descendants.map { |s| s.filter_name }.sort
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_descendant(filter_name)
|
30
|
+
descendants.each do |s|
|
31
|
+
return s if s.filter_name == filter_name
|
32
|
+
end
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,313 @@
|
|
1
|
+
module TrustyCms
|
2
|
+
|
3
|
+
class << self
|
4
|
+
def config_definitions
|
5
|
+
@config_definitions ||= {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def config_definitions=(definitions)
|
9
|
+
@config_definitions = definitions
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Config < ActiveRecord::Base
|
14
|
+
require 'trusty_cms/config/definition'
|
15
|
+
#
|
16
|
+
# The TrustyCms.config model class is stored in the database (and cached) but emulates a hash
|
17
|
+
# with simple bracket methods that allow you to get and set values like so:
|
18
|
+
#
|
19
|
+
# TrustyCms.config['setting.name'] = 'value'
|
20
|
+
# TrustyCms.config['setting.name'] #=> "value"
|
21
|
+
#
|
22
|
+
# Config entries can be used freely as general-purpose global variables unless a definition
|
23
|
+
# has been given for that key, in which case restrictions and defaults may apply. The restrictions
|
24
|
+
# can take the form of validations, requirements, permissions or permitted options. They are
|
25
|
+
# declared by calling TrustyCms::Config#define:
|
26
|
+
#
|
27
|
+
# # setting must be either 'foo', 'bar' or 'blank'
|
28
|
+
# define('admin.name', :select_from => ['foo', 'bar'])
|
29
|
+
#
|
30
|
+
# # setting is (and must be) chosen from the names of currently available layouts
|
31
|
+
# define('shop.layout', :select_from => lambda { Layout.all.map{|l| [l.name,l.id]} }, :alow_blank => false)
|
32
|
+
#
|
33
|
+
# # setting cannot be changed at runtime
|
34
|
+
# define('setting.important', :default => "something", :allow_change => false)
|
35
|
+
#
|
36
|
+
# Which almost always happens in a block like this:
|
37
|
+
#
|
38
|
+
# TrustyCms.config do |config|
|
39
|
+
# config.namespace('user', :allow_change => true) do |user|
|
40
|
+
# user.define 'allow_password_reset?', :default => true
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# and usually in a config/radiant_config.rb file either in radiant itself, in the application directory
|
45
|
+
# or in an extension. TrustyCms currently defines the following settings and makes them editable by
|
46
|
+
# admin users on the site configuration page:
|
47
|
+
#
|
48
|
+
# admin.title :: the title of the admin system
|
49
|
+
# admin.subtitle :: the subtitle of the admin system
|
50
|
+
# defaults.page.parts :: a comma separated list of default page parts
|
51
|
+
# defaults.page.status :: a string representation of the default page status
|
52
|
+
# defaults.page.filter :: the default filter to use on new page parts
|
53
|
+
# defaults.page.fields :: a comma separated list of the default page fields
|
54
|
+
# defaults.snippet.filter :: the default filter to use on new snippets
|
55
|
+
# dev.host :: the hostname where draft pages are viewable
|
56
|
+
# local.timezone :: the timezone name (`rake -D time` for full list)
|
57
|
+
# used to correct displayed times
|
58
|
+
# page.edit.published_date? :: when true, shows the datetime selector
|
59
|
+
# for published date on the page edit screen
|
60
|
+
#
|
61
|
+
# Helper methods are defined in ConfigurationHelper that will display config entry values
|
62
|
+
# or edit fields:
|
63
|
+
#
|
64
|
+
# # to display label and value, where label comes from looking up the config key in the active locale
|
65
|
+
# show_setting('admin.name')
|
66
|
+
#
|
67
|
+
# # to display an appropriate checkbox, text field or select box with label as above:
|
68
|
+
# edit_setting('admin.name)
|
69
|
+
#
|
70
|
+
|
71
|
+
set_table_name "config"
|
72
|
+
after_save :update_cache
|
73
|
+
attr_reader :definition
|
74
|
+
|
75
|
+
class ConfigError < RuntimeError; end
|
76
|
+
|
77
|
+
class << self
|
78
|
+
def [](key)
|
79
|
+
if table_exists?
|
80
|
+
unless TrustyCms::Config.cache_file_exists?
|
81
|
+
TrustyCms::Config.ensure_cache_file
|
82
|
+
TrustyCms::Config.initialize_cache
|
83
|
+
end
|
84
|
+
TrustyCms::Config.initialize_cache if TrustyCms::Config.stale_cache?
|
85
|
+
Rails.cache.read('TrustyCms::Config')[key]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def []=(key, value)
|
90
|
+
if table_exists?
|
91
|
+
setting = find_or_initialize_by_key(key)
|
92
|
+
setting.value = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def to_hash
|
97
|
+
Hash[ *all.map { |pair| [pair.key, pair.value] }.flatten ]
|
98
|
+
end
|
99
|
+
|
100
|
+
def initialize_cache
|
101
|
+
TrustyCms::Config.ensure_cache_file
|
102
|
+
Rails.cache.write('TrustyCms::Config',TrustyCms::Config.to_hash)
|
103
|
+
Rails.cache.write('TrustyCms.cache_mtime', File.mtime(cache_file))
|
104
|
+
Rails.cache.silence!
|
105
|
+
end
|
106
|
+
|
107
|
+
def cache_file_exists?
|
108
|
+
File.file?(cache_file)
|
109
|
+
end
|
110
|
+
|
111
|
+
def stale_cache?
|
112
|
+
return true unless TrustyCms::Config.cache_file_exists?
|
113
|
+
Rails.cache.read('TrustyCms.cache_mtime') != File.mtime(cache_file)
|
114
|
+
end
|
115
|
+
|
116
|
+
def ensure_cache_file
|
117
|
+
FileUtils.mkpath(cache_path)
|
118
|
+
FileUtils.touch(cache_file)
|
119
|
+
end
|
120
|
+
|
121
|
+
def cache_path
|
122
|
+
"#{Rails.root}/tmp"
|
123
|
+
end
|
124
|
+
|
125
|
+
def cache_file
|
126
|
+
cache_file = File.join(cache_path,'radiant_config_cache.txt')
|
127
|
+
end
|
128
|
+
|
129
|
+
def site_settings
|
130
|
+
@site_settings ||= %w{ site.title site.host dev.host local.timezone }
|
131
|
+
end
|
132
|
+
|
133
|
+
def default_settings
|
134
|
+
@default_settings ||= %w{ defaults.locale defaults.page.filter defaults.page.parts defaults.page.fields defaults.page.status defaults.snippet.filter }
|
135
|
+
end
|
136
|
+
|
137
|
+
def user_settings
|
138
|
+
@user_settings ||= ['user.allow_password_reset?']
|
139
|
+
end
|
140
|
+
|
141
|
+
# A convenient drying method for specifying a prefix and options common to several settings.
|
142
|
+
#
|
143
|
+
# TrustyCms.config do |config|
|
144
|
+
# config.namespace('secret', :allow_display => false) do |secret|
|
145
|
+
# secret.define('identity', :default => 'batman') # defines 'secret.identity'
|
146
|
+
# secret.define('lair', :default => 'batcave') # defines 'secret.lair'
|
147
|
+
# secret.define('longing', :default => 'vindication') # defines 'secret.longing'
|
148
|
+
# end
|
149
|
+
# end
|
150
|
+
#
|
151
|
+
def namespace(prefix, options = {}, &block)
|
152
|
+
prefix = [options[:prefix], prefix].join('.') if options[:prefix]
|
153
|
+
with_options(options.merge(:prefix => prefix), &block)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Declares a setting definition that will constrain and support the use of a particular config entry.
|
157
|
+
#
|
158
|
+
# define('setting.key', options)
|
159
|
+
#
|
160
|
+
# Can take several options:
|
161
|
+
# * :default is the value that will be placed in the database if none has been set already
|
162
|
+
# * :type can be :string, :boolean or :integer. Note that all settings whose key ends in ? are considered boolean.
|
163
|
+
# * :select_from should be a list or hash suitable for passing to options_for_select, or a block that will return such a list at runtime
|
164
|
+
# * :validate_with should be a block that will receive a value and return true or false. Validations are also implied by type or select_from.
|
165
|
+
# * :allow_blank should be false if the config item must not be blank or nil
|
166
|
+
# * :allow_change should be false if the config item can only be set, not changed. Add a default to specify an unchanging config entry.
|
167
|
+
# * :allow_display should be false if the config item should not be showable in radius tags
|
168
|
+
#
|
169
|
+
# From the main radiant config/initializers/radiant_config.rb:
|
170
|
+
#
|
171
|
+
# TrustyCms.config do |config|
|
172
|
+
# config.define 'defaults.locale', :select_from => lambda { TrustyCms::AvailableLocales.locales }, :allow_blank => true
|
173
|
+
# config.define 'defaults.page.parts', :default => "Body,Extended"
|
174
|
+
# ...
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# It's also possible to reuse a definition by passing it to define:
|
178
|
+
#
|
179
|
+
# choose_layout = TrustyCms::Config::Definition.new(:select_from => lambda {Layout.all.map{|l| [l.name, l.d]}})
|
180
|
+
# define "my.layout", choose_layout
|
181
|
+
# define "your.layout", choose_layout
|
182
|
+
#
|
183
|
+
# but at the moment that's only done in testing.
|
184
|
+
#
|
185
|
+
def define(key, options={})
|
186
|
+
called_from = caller.grep(/\/initializers\//).first
|
187
|
+
if options.is_a? TrustyCms::Config::Definition
|
188
|
+
definition = options
|
189
|
+
else
|
190
|
+
key = [options[:prefix], key].join('.') if options[:prefix]
|
191
|
+
end
|
192
|
+
|
193
|
+
raise LoadError, %{
|
194
|
+
Config definition error: '#{key}' is defined twice:
|
195
|
+
1. #{called_from}
|
196
|
+
2. #{definitions[key].definer}
|
197
|
+
} unless definitions[key].nil? || definitions[key].empty?
|
198
|
+
|
199
|
+
definition ||= TrustyCms::Config::Definition.new(options.merge(:definer => called_from))
|
200
|
+
definitions[key] = definition
|
201
|
+
|
202
|
+
if self[key].nil? && !definition.default.nil?
|
203
|
+
begin
|
204
|
+
self[key] = definition.default
|
205
|
+
rescue ActiveRecord::RecordInvalid
|
206
|
+
raise LoadError, "Default configuration invalid: value '#{definition.default}' is not allowed for '#{key}'"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def definitions
|
212
|
+
TrustyCms.config_definitions
|
213
|
+
end
|
214
|
+
|
215
|
+
def definition_for(key)
|
216
|
+
definitions[key] ||= TrustyCms::Config::Definition.new(:empty => true)
|
217
|
+
end
|
218
|
+
|
219
|
+
def clear_definitions!
|
220
|
+
TrustyCms.config_definitions = {}
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
# The usual way to use a config item:
|
226
|
+
#
|
227
|
+
# TrustyCms.config['key'] = value
|
228
|
+
#
|
229
|
+
# is equivalent to this:
|
230
|
+
#
|
231
|
+
# TrustyCms::Config.find_or_create_by_key('key').value = value
|
232
|
+
#
|
233
|
+
# Calling value= also applies any validations and restrictions that are found in the associated definition.
|
234
|
+
# so this will raise a ConfigError if you try to change a protected config entry or a RecordInvalid if you
|
235
|
+
# set a value that is not among those permitted.
|
236
|
+
#
|
237
|
+
def value=(param)
|
238
|
+
newvalue = param.to_s
|
239
|
+
if newvalue != self[:value]
|
240
|
+
raise ConfigError, "#{self.key} cannot be changed" unless settable? || self[:value].blank?
|
241
|
+
if boolean?
|
242
|
+
self[:value] = (newvalue == "1" || newvalue == "true") ? "true" : "false"
|
243
|
+
else
|
244
|
+
self[:value] = newvalue
|
245
|
+
end
|
246
|
+
self.save!
|
247
|
+
end
|
248
|
+
self[:value]
|
249
|
+
end
|
250
|
+
|
251
|
+
# Requesting a config item:
|
252
|
+
#
|
253
|
+
# key = TrustyCms.config['key']
|
254
|
+
#
|
255
|
+
# is equivalent to this:
|
256
|
+
#
|
257
|
+
# key = TrustyCms::Config.find_or_create_by_key('key').value
|
258
|
+
#
|
259
|
+
# If the config item is boolean the response will be true or false. For items with :type => :integer it will be an integer,
|
260
|
+
# for everything else a string.
|
261
|
+
#
|
262
|
+
def value
|
263
|
+
if boolean?
|
264
|
+
checked?
|
265
|
+
else
|
266
|
+
self[:value]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Returns the definition associated with this config item. If none has been declared this will be an empty definition
|
271
|
+
# that does not restrict use.
|
272
|
+
#
|
273
|
+
def definition
|
274
|
+
@definition ||= self.class.definition_for(self.key)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns true if the item key ends with '?' or the definition specifies :type => :boolean.
|
278
|
+
#
|
279
|
+
def boolean?
|
280
|
+
definition.boolean? || self.key.ends_with?("?")
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns true if the item is boolean and true.
|
284
|
+
#
|
285
|
+
def checked?
|
286
|
+
return nil if self[:value].nil?
|
287
|
+
boolean? && self[:value] == "true"
|
288
|
+
end
|
289
|
+
|
290
|
+
# Returns true if the item defintion includes a :select_from parameter that limits the range of permissible options.
|
291
|
+
#
|
292
|
+
def selector?
|
293
|
+
definition.selector?
|
294
|
+
end
|
295
|
+
|
296
|
+
# Returns a name corresponding to the current setting value, if the setting definition includes a select_from parameter.
|
297
|
+
#
|
298
|
+
def selected_value
|
299
|
+
definition.selected(value)
|
300
|
+
end
|
301
|
+
|
302
|
+
def update_cache
|
303
|
+
TrustyCms::Config.initialize_cache
|
304
|
+
end
|
305
|
+
|
306
|
+
delegate :default, :type, :allow_blank?, :hidden?, :visible?, :settable?, :selection, :notes, :units, :to => :definition
|
307
|
+
|
308
|
+
def validate
|
309
|
+
definition.validate(self)
|
310
|
+
end
|
311
|
+
|
312
|
+
end
|
313
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module TrustyCms
|
2
|
+
class PageResponseCacheDirector
|
3
|
+
def initialize(page, listener)
|
4
|
+
@page = page
|
5
|
+
@listener = listener
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_cache_control
|
9
|
+
cacheable? ? cacheable_response : non_cacheable_response
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def cache_timeout
|
14
|
+
@cache_timeout ||= 5.minutes
|
15
|
+
end
|
16
|
+
|
17
|
+
def cache_timeout=(val)
|
18
|
+
@cache_timeout = val
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def non_cacheable_response
|
25
|
+
@listener.set_expiry nil, :private => true, "no-cache" => true
|
26
|
+
@listener.set_etag('')
|
27
|
+
end
|
28
|
+
|
29
|
+
def cacheable_response
|
30
|
+
timeout = self.class.cache_timeout
|
31
|
+
if @page.respond_to?(:cache_timeout)
|
32
|
+
timeout = @page.cache_timeout
|
33
|
+
end
|
34
|
+
|
35
|
+
@listener.set_expiry timeout, :public => true, :private => false
|
36
|
+
end
|
37
|
+
|
38
|
+
def cacheable?
|
39
|
+
@listener.cacheable_request? && @page.cache?
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
|
3
|
+
class User < ActiveRecord::Base
|
4
|
+
has_many :pages, :foreign_key => :created_by_id
|
5
|
+
|
6
|
+
# Default Order
|
7
|
+
default_scope :order => 'name'
|
8
|
+
|
9
|
+
# Associations
|
10
|
+
belongs_to :created_by, :class_name => 'User'
|
11
|
+
belongs_to :updated_by, :class_name => 'User'
|
12
|
+
|
13
|
+
# Validations
|
14
|
+
validates_uniqueness_of :login
|
15
|
+
|
16
|
+
validates_confirmation_of :password, :if => :confirm_password?
|
17
|
+
|
18
|
+
validates_presence_of :name, :login
|
19
|
+
validates_presence_of :password, :password_confirmation, :if => :new_record?
|
20
|
+
|
21
|
+
validates_format_of :email, :allow_nil => true, :with => /^$|^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
22
|
+
|
23
|
+
validates_length_of :name, :maximum => 100, :allow_nil => true
|
24
|
+
validates_length_of :login, :within => 3..40, :allow_nil => true
|
25
|
+
validates_length_of :password, :within => 5..40, :allow_nil => true, :if => :validate_length_of_password?
|
26
|
+
validates_length_of :email, :maximum => 255, :allow_nil => true
|
27
|
+
|
28
|
+
attr_writer :confirm_password
|
29
|
+
class << self
|
30
|
+
def unprotected_attributes
|
31
|
+
@unprotected_attributes ||= [:name, :email, :login, :password, :password_confirmation, :locale]
|
32
|
+
end
|
33
|
+
|
34
|
+
def unprotected_attributes=(array)
|
35
|
+
@unprotected_attributes = array.map{|att| att.to_sym }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def has_role?(role)
|
40
|
+
respond_to?("#{role}?") && send("#{role}?")
|
41
|
+
end
|
42
|
+
|
43
|
+
def sha1(phrase)
|
44
|
+
Digest::SHA1.hexdigest("--#{salt}--#{phrase}--")
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.authenticate(login_or_email, password)
|
48
|
+
user = where(["login = ? OR email = ?", login_or_email, login_or_email]).first
|
49
|
+
user if user && user.authenticated?(password)
|
50
|
+
end
|
51
|
+
|
52
|
+
def authenticated?(password)
|
53
|
+
self.password == sha1(password)
|
54
|
+
end
|
55
|
+
|
56
|
+
def after_initialize
|
57
|
+
@confirm_password = true
|
58
|
+
end
|
59
|
+
|
60
|
+
def confirm_password?
|
61
|
+
@confirm_password
|
62
|
+
end
|
63
|
+
|
64
|
+
def remember_me
|
65
|
+
update_attribute(:session_token, sha1(Time.now + TrustyCms::Config['session_timeout'].to_i)) unless self.session_token?
|
66
|
+
end
|
67
|
+
|
68
|
+
def forget_me
|
69
|
+
update_attribute(:session_token, nil)
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def validate_length_of_password?
|
75
|
+
new_record? or not password.to_s.empty?
|
76
|
+
end
|
77
|
+
|
78
|
+
before_create :encrypt_password
|
79
|
+
def encrypt_password
|
80
|
+
self.salt = Digest::SHA1.hexdigest("--#{Time.now}--#{login}--sweet harmonious biscuits--")
|
81
|
+
self.password = sha1(password)
|
82
|
+
end
|
83
|
+
|
84
|
+
before_update :encrypt_password_unless_empty_or_unchanged
|
85
|
+
def encrypt_password_unless_empty_or_unchanged
|
86
|
+
user = self.class.find(self.id)
|
87
|
+
case password
|
88
|
+
when ''
|
89
|
+
self.password = user.password
|
90
|
+
when user.password
|
91
|
+
else
|
92
|
+
encrypt_password
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class UserActionObserver < ActiveRecord::Observer
|
2
|
+
observe User, Page, Layout
|
3
|
+
|
4
|
+
def current_user=(user)
|
5
|
+
self.class.current_user = user
|
6
|
+
end
|
7
|
+
def self.current_user=(user)
|
8
|
+
Thread.current[:current_user] = user
|
9
|
+
end
|
10
|
+
|
11
|
+
def current_user
|
12
|
+
self.class.current_user
|
13
|
+
end
|
14
|
+
def self.current_user
|
15
|
+
Thread.current[:current_user]
|
16
|
+
end
|
17
|
+
|
18
|
+
def before_create(model)
|
19
|
+
model.created_by = self.current_user
|
20
|
+
end
|
21
|
+
|
22
|
+
def before_update(model)
|
23
|
+
model.updated_by = self.current_user
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
- body_classes << "reversed"
|
2
|
+
- @selected = :general
|
3
|
+
|
4
|
+
- render_region :main do |main|
|
5
|
+
- main.edit_header do
|
6
|
+
%h1 Configuration
|
7
|
+
|
8
|
+
- main.edit_form do
|
9
|
+
- form_for :trusty_config, :url => admin_configuration_url, :html => {"data-onsubmit_status"=>"Saving changes…", :method => :put} do |f|
|
10
|
+
= render_region :form_top
|
11
|
+
- render_region :form do |form|
|
12
|
+
- form.edit_site do
|
13
|
+
%fieldset
|
14
|
+
%h3 Site
|
15
|
+
- TrustyCms.config.site_settings.each do |site_setting|
|
16
|
+
%p
|
17
|
+
= edit_config site_setting
|
18
|
+
|
19
|
+
- form.edit_defaults do
|
20
|
+
%fieldset
|
21
|
+
%h3 Defaults
|
22
|
+
- TrustyCms.config.default_settings.each do |default_setting|
|
23
|
+
%p
|
24
|
+
= edit_config default_setting
|
25
|
+
|
26
|
+
- form.edit_users do
|
27
|
+
%fieldset
|
28
|
+
%h3 Passwords
|
29
|
+
- TrustyCms.config.user_settings.each do |user_setting|
|
30
|
+
%p
|
31
|
+
= edit_config user_setting
|
32
|
+
|
33
|
+
- render_region :form_bottom do |form_bottom|
|
34
|
+
- form_bottom.edit_buttons do
|
35
|
+
.buttons
|
36
|
+
%input.button{:type=>"submit", :value=>"Save Changes"}/
|
37
|
+
or
|
38
|
+
= link_to "Cancel", admin_configuration_url
|
@@ -0,0 +1,58 @@
|
|
1
|
+
- body_classes << "reversed"
|
2
|
+
|
3
|
+
#preferences.box
|
4
|
+
- render_region :user do |user|
|
5
|
+
- user.preferences do
|
6
|
+
%h3
|
7
|
+
.actions
|
8
|
+
= button_to t("edit_preferences"), "/admin/preferences", :method => :get
|
9
|
+
= t('personal_preferences')
|
10
|
+
= image_tag(gravatar_url(@user.email, :size=>"64px"), :class=>"avatar", :width=>64, :height=>64, :alt=>"")
|
11
|
+
%p.ruled
|
12
|
+
%label
|
13
|
+
= t('name')
|
14
|
+
%span
|
15
|
+
= current_user.name
|
16
|
+
%p.ruled
|
17
|
+
%label
|
18
|
+
= t('email_address')
|
19
|
+
%span.uri
|
20
|
+
= current_user.email
|
21
|
+
%p.ruled
|
22
|
+
%label
|
23
|
+
= t('login')
|
24
|
+
%span
|
25
|
+
= current_user.login
|
26
|
+
%p.ruled
|
27
|
+
%label
|
28
|
+
= t('password')
|
29
|
+
%big •••••
|
30
|
+
%p.ruled
|
31
|
+
%label
|
32
|
+
= t('language')
|
33
|
+
%span
|
34
|
+
= current_user.locale
|
35
|
+
|
36
|
+
#config.box
|
37
|
+
- render_region :trusty_config do |config|
|
38
|
+
- config.site do
|
39
|
+
%h3
|
40
|
+
- if admin?
|
41
|
+
.actions
|
42
|
+
= button_to t("edit_configuration"), edit_admin_configuration_url, :method => :get
|
43
|
+
Configuration
|
44
|
+
- TrustyCms.config.site_settings.each do |site_setting|
|
45
|
+
%p.ruled
|
46
|
+
= show_config site_setting, :class => (site_setting =~ /host$/ ? 'uri' : nil)
|
47
|
+
|
48
|
+
- config.defaults do
|
49
|
+
%h4 Defaults
|
50
|
+
- TrustyCms.config.default_settings.each do |default_setting|
|
51
|
+
%p.ruled
|
52
|
+
= show_config default_setting
|
53
|
+
|
54
|
+
- config.users do
|
55
|
+
%h4 Passwords
|
56
|
+
- TrustyCms.config.user_settings.each do |user_setting|
|
57
|
+
%p.ruled
|
58
|
+
= show_config user_setting
|
@@ -0,0 +1,41 @@
|
|
1
|
+
- @page_title = t('extensions') + ' - ' + default_page_title
|
2
|
+
|
3
|
+
- content_for :page_css do
|
4
|
+
:sass
|
5
|
+
table.index
|
6
|
+
h4
|
7
|
+
font-size: 110%
|
8
|
+
margin-top: .5em
|
9
|
+
margin-bottom: .25em
|
10
|
+
p
|
11
|
+
margin-top: .25em
|
12
|
+
margin-bottom: .5em
|
13
|
+
|
14
|
+
= render_region :top
|
15
|
+
|
16
|
+
.outset
|
17
|
+
%table#extensions.index
|
18
|
+
%thead
|
19
|
+
%tr
|
20
|
+
- render_region :thead do |thead|
|
21
|
+
- thead.title_header do
|
22
|
+
%th.extension= t('extension')
|
23
|
+
- thead.website_header do
|
24
|
+
%th.website= t('more_info')
|
25
|
+
- thead.version_header do
|
26
|
+
%th.version= t('version')
|
27
|
+
%tbody
|
28
|
+
- @extensions.each do |extension|
|
29
|
+
%tr.node.level_1
|
30
|
+
- render_region :tbody, :locals => {:extension => extension} do |tbody|
|
31
|
+
- tbody.title_cell do
|
32
|
+
%td.extension
|
33
|
+
%h4= h extension.extension_name
|
34
|
+
%p= h extension.description
|
35
|
+
- tbody.website_cell do
|
36
|
+
%td.website
|
37
|
+
= extension.url.nil? || extension.url.empty? ? "" : link_to(t('more_info'), extension.url, :target => "_blank")
|
38
|
+
- tbody.version_cell do
|
39
|
+
%td.version= h extension.version
|
40
|
+
|
41
|
+
= render_region :bottom
|