trusty-cms 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/CHANGELOG.md +1 -1
- data/Gemfile +12 -8
- data/Gemfile.lock +141 -82
- data/LICENSE.md +1 -1
- data/README.md +48 -5
- data/Vagrantfile +122 -0
- data/{public → app/assets}/images/admin/add_tab.png +0 -0
- data/app/assets/images/admin/animated-overlay.gif +0 -0
- data/{public → app/assets}/images/admin/avatar_32x32.png +0 -0
- data/{public → app/assets}/images/admin/avatar_64x64.png +0 -0
- data/{public → app/assets}/images/admin/avatar_96x96.png +0 -0
- data/{public → app/assets}/images/admin/brown_bottom_line.gif +0 -0
- data/{public → app/assets}/images/admin/calendar_down.gif +0 -0
- data/{public → app/assets}/images/admin/collapse.png +0 -0
- data/{public/images/admin/expand.png → app/assets/images/admin/collapsed.png} +0 -0
- data/{public → app/assets}/images/admin/draft_page.png +0 -0
- data/{public → app/assets}/images/admin/image.png +0 -0
- data/{public → app/assets}/images/admin/javascript.png +0 -0
- data/{public → app/assets}/images/admin/layout.png +0 -0
- data/{public → app/assets}/images/admin/metadata_toggle.png +0 -0
- data/{public → app/assets}/images/admin/minus.png +0 -0
- data/{public → app/assets}/images/admin/minus_disabled.png +0 -0
- data/{public → app/assets}/images/admin/minus_grey.png +0 -0
- data/{public → app/assets}/images/admin/navigation_secondary_separator.gif +0 -0
- data/{public → app/assets}/images/admin/page.png +0 -0
- data/{public → app/assets}/images/admin/plus.png +0 -0
- data/{public → app/assets}/images/admin/plus_disabled.png +0 -0
- data/{public → app/assets}/images/admin/plus_grey.png +0 -0
- data/{public → app/assets}/images/admin/popup_border_background.png +0 -0
- data/{public → app/assets}/images/admin/popup_border_bottom_left.png +0 -0
- data/{public → app/assets}/images/admin/popup_border_bottom_right.png +0 -0
- data/{public → app/assets}/images/admin/popup_border_top_left.png +0 -0
- data/{public → app/assets}/images/admin/popup_border_top_right.png +0 -0
- data/{public → app/assets}/images/admin/search.png +0 -0
- data/{public → app/assets}/images/admin/single_form_shadow.png +0 -0
- data/{public → app/assets}/images/admin/snippet.png +0 -0
- data/{public → app/assets}/images/admin/spinner.gif +0 -0
- data/{public → app/assets}/images/admin/status_background.png +0 -0
- data/{public → app/assets}/images/admin/status_bottom_left.png +0 -0
- data/{public → app/assets}/images/admin/status_bottom_right.png +0 -0
- data/{public → app/assets}/images/admin/status_spinner.gif +0 -0
- data/{public → app/assets}/images/admin/status_top_left.png +0 -0
- data/{public → app/assets}/images/admin/status_top_right.png +0 -0
- data/{public → app/assets}/images/admin/stylesheet.png +0 -0
- data/{public → app/assets}/images/admin/tab_close.png +0 -0
- data/app/assets/images/admin/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/admin/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/admin/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/admin/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/admin/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/admin/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/admin/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/admin/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/admin/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/admin/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/admin/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/admin/ui-icons_cd0a0a_256x240.png +0 -0
- data/{public → app/assets}/images/admin/upload.png +0 -0
- data/{public → app/assets}/images/admin/virtual_page.png +0 -0
- data/{public → app/assets}/images/radiant/radiant-badge-color.png +0 -0
- data/app/assets/javascripts/admin.js +35 -0
- data/app/assets/javascripts/admin/autopopulate-breadcrumb.js +35 -0
- data/{public → app/assets}/javascripts/admin/cookie.js +13 -13
- data/app/assets/javascripts/admin/datecheck.js +7 -0
- data/app/assets/javascripts/admin/dropdown.js +26 -0
- data/app/assets/javascripts/admin/jquery-ui.js +2371 -0
- data/app/assets/javascripts/admin/jquery.treetable.js +629 -0
- data/app/assets/javascripts/admin/jquery.validate.min.js +4 -0
- data/app/assets/javascripts/admin/modernizr.js +409 -0
- data/app/assets/javascripts/admin/more-or-less.js +38 -0
- data/app/assets/javascripts/admin/page-edit.js +51 -0
- data/app/assets/javascripts/admin/pagefield.js +35 -0
- data/app/assets/javascripts/admin/persist.min.js +31 -0
- data/app/assets/javascripts/admin/popup.js +40 -0
- data/app/assets/javascripts/admin/preview.js +40 -0
- data/app/assets/javascripts/admin/tabcontrol.js.erb +81 -0
- data/app/assets/javascripts/admin/tags.js +41 -0
- data/app/assets/javascripts/admin/treetable.js +50 -0
- data/app/assets/javascripts/admin/utilities.js +5 -0
- data/app/assets/javascripts/admin/validation.js +7 -0
- data/app/assets/javascripts/admin/validations/user_validations.js +21 -0
- data/app/assets/javascripts/ckeditor/config.js +10 -0
- data/{config/initializers/configuration_extensions.rb → app/assets/javascripts/ckeditor/contents.css} +0 -0
- data/app/assets/javascripts/notes.md +40 -0
- data/app/assets/stylesheets/admin/_base.scss +17 -0
- data/app/assets/stylesheets/admin/main.scss +34 -0
- data/app/assets/stylesheets/admin/modules/_boxes.scss +7 -0
- data/app/assets/stylesheets/admin/modules/_gradients.scss +5 -0
- data/app/assets/stylesheets/admin/modules/_links.scss +24 -0
- data/app/assets/stylesheets/admin/partials/_actions.scss +118 -0
- data/app/assets/stylesheets/admin/partials/_avatars.scss +12 -0
- data/app/assets/stylesheets/admin/partials/_content.scss +74 -0
- data/app/assets/stylesheets/admin/partials/_dateinput.scss +71 -0
- data/app/assets/stylesheets/admin/partials/_deprecated.scss +65 -0
- data/app/assets/stylesheets/admin/partials/_dropdown.scss +34 -0
- data/app/assets/stylesheets/admin/partials/_footer.scss +14 -0
- data/app/assets/stylesheets/admin/partials/_forms.scss +419 -0
- data/app/assets/stylesheets/admin/partials/_header.scss +135 -0
- data/app/assets/stylesheets/admin/partials/_index.scss +198 -0
- data/app/assets/stylesheets/admin/partials/_jquery-ui-structure.scss +258 -0
- data/app/assets/stylesheets/admin/partials/_jquery-ui-theme.scss +410 -0
- data/app/assets/stylesheets/admin/partials/_jquery-ui.scss +650 -0
- data/app/assets/stylesheets/admin/partials/_layout.scss +14 -0
- data/app/assets/stylesheets/admin/partials/_messages.scss +13 -0
- data/app/assets/stylesheets/admin/partials/_popup.scss +263 -0
- data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +94 -0
- data/app/assets/stylesheets/admin/partials/_toolbar.scss +40 -0
- data/app/assets/stylesheets/admin/partials/_treetable.scss +120 -0
- data/app/assets/stylesheets/admin/partials/_typography.scss +77 -0
- data/app/assets/stylesheets/admin/partials/_validations.scss +22 -0
- data/app/controllers/admin/configuration_controller.rb +9 -9
- data/app/controllers/admin/extensions_controller.rb +1 -1
- data/app/controllers/admin/page_parts_controller.rb +1 -1
- data/app/controllers/admin/pages_controller.rb +8 -5
- data/app/controllers/admin/preferences_controller.rb +8 -25
- data/app/controllers/admin/resource_controller.rb +19 -20
- data/app/controllers/admin/users_controller.rb +7 -7
- data/app/controllers/admin/welcome_controller.rb +9 -9
- data/app/controllers/application_controller.rb +13 -24
- data/app/controllers/site_controller.rb +2 -1
- data/app/helpers/admin/configuration_helper.rb +20 -19
- data/app/helpers/admin/extensions_helper.rb +1 -1
- data/app/helpers/admin/layouts_helper.rb +1 -19
- data/app/helpers/admin/node_helper.rb +21 -7
- data/app/helpers/admin/pages_helper.rb +4 -92
- data/app/helpers/admin/preferences_helper.rb +1 -1
- data/app/helpers/admin/regions_helper.rb +5 -4
- data/app/helpers/application_helper.rb +62 -64
- data/app/models/deprecated_tags.rb +1 -21
- data/app/models/file_not_found_page.rb +8 -8
- data/app/models/layout.rb +3 -2
- data/app/models/menu_renderer.rb +7 -7
- data/app/models/page.rb +8 -7
- data/app/models/page_context.rb +10 -10
- data/app/models/page_field.rb +1 -0
- data/app/models/page_part.rb +5 -5
- data/app/models/standard_tags.rb +95 -75
- data/app/models/status.rb +8 -8
- data/app/models/text_filter.rb +5 -5
- data/app/models/trusty_cms/config.rb +36 -42
- data/app/models/trusty_cms/page_response_cache_director.rb +2 -1
- data/app/models/user.rb +1 -10
- data/app/models/user_action_observer.rb +5 -5
- data/app/views/admin/configuration/edit.html.haml +5 -5
- data/app/views/admin/configuration/show.html.haml +11 -11
- data/app/views/admin/extensions/index.html.haml +4 -4
- data/app/views/admin/layouts/_form.html.haml +6 -7
- data/app/views/admin/layouts/_popups.html.haml +4 -0
- data/app/views/admin/layouts/edit.html.haml +4 -2
- data/app/views/admin/layouts/new.html.haml +1 -1
- data/app/views/admin/layouts/remove.html.haml +3 -3
- data/app/views/admin/page_fields/_page_field.html.haml +3 -2
- data/app/views/admin/page_parts/_page_part.html.haml +4 -5
- data/app/views/admin/pages/_fields.html.haml +2 -3
- data/app/views/admin/pages/_meta_row.html.haml +2 -2
- data/app/views/admin/pages/_node.html.haml +4 -9
- data/app/views/admin/pages/_popups.html.haml +9 -5
- data/app/views/admin/pages/children.html.haml +5 -1
- data/app/views/admin/pages/edit.html.haml +1 -3
- data/app/views/admin/pages/index.html.haml +2 -2
- data/app/views/admin/pages/new.html.haml +2 -4
- data/app/views/admin/pages/remove.html.haml +8 -7
- data/app/views/admin/preferences/edit.html.haml +14 -14
- data/app/views/admin/references/_tag_reference.haml +1 -1
- data/app/views/admin/references/filters.haml +1 -1
- data/app/views/admin/references/tags.haml +9 -27
- data/app/views/admin/users/_avatar.html.haml +2 -2
- data/app/views/admin/users/_form.html.haml +16 -16
- data/app/views/admin/users/_password_fields.html.haml +3 -3
- data/app/views/admin/users/edit.html.haml +1 -1
- data/app/views/admin/users/new.html.haml +2 -2
- data/app/views/admin/users/remove.html.haml +4 -4
- data/app/views/admin/welcome/login.html.haml +6 -6
- data/app/views/layouts/application.html.haml +22 -11
- data/app/views/site/not_found.html.haml +1 -1
- data/app/views/site/show_page.html.haml +1 -0
- data/bin/ci/before_script +0 -5
- data/config.ru +4 -0
- data/config/application.rb +118 -108
- data/config/boot.rb +1 -1
- data/config/database.mysql.yml +3 -6
- data/config/environments/development.rb +17 -5
- data/config/environments/production.rb +20 -3
- data/config/environments/test.rb +17 -0
- data/config/initializers/active_record_extensions.rb +1 -1
- data/config/initializers/haml.rb +1 -1
- data/config/initializers/rails_patch.rb +1 -1
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/string_extensions.rb +1 -1
- data/config/initializers/symbol_extensions.rb +1 -1
- data/config/initializers/{radiant_config.rb → trusty_cms_config.rb} +2 -2
- data/config/locales/en.yml +33 -33
- data/config/locales/en_available_tags.yml +62 -62
- data/config/routes.rb +18 -10
- data/db/migrate/001_create_radiant_tables.rb +3 -3
- data/db/migrate/002_insert_initial_data.rb +2 -2
- data/db/migrate/005_add_virtual_column_to_page.rb +1 -1
- data/db/migrate/006_integer_columns_to_boolean.rb +9 -9
- data/db/migrate/007_remove_virtual_column_from_page.rb +1 -1
- data/db/migrate/008_add_virtual_column_to_page_again.rb +1 -1
- data/db/migrate/010_merge_behaviors_and_pages.rb +6 -6
- data/db/migrate/014_rename_config_default_parts_key.rb +3 -3
- data/db/migrate/015_add_optimistic_locking.rb +2 -2
- data/db/migrate/020_add_session_info_to_users.rb +1 -1
- data/db/migrate/20081203140407_add_indexes.rb +2 -2
- data/db/migrate/20090226140109_add_user_language.rb +2 -2
- data/db/migrate/20100805155020_convert_page_metas.rb +1 -1
- data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +1 -1
- data/db/migrate/20111016150725_extend_page_part_content_limit.rb +1 -1
- data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +3 -4
- data/db/schema.rb +0 -6
- data/lib/active_record_extensions/active_record_extensions.rb +3 -3
- data/lib/annotatable.rb +3 -3
- data/lib/configuration_extensions/configuration_extensions.rb +7 -42
- data/lib/generators/extension/extension_generator.rb +11 -11
- data/lib/generators/extension/templates/README.md +1 -1
- data/lib/generators/extension/templates/cucumber.yml +1 -1
- data/lib/generators/extension/templates/cucumber_env.rb +2 -2
- data/lib/generators/extension/templates/cucumber_paths.rb +7 -7
- data/lib/generators/extension/templates/en.yml +1 -1
- data/lib/generators/extension/templates/functional_test.rb +3 -3
- data/lib/generators/extension/templates/migration.rb +4 -4
- data/lib/generators/extension/templates/routes.rb +1 -1
- data/lib/generators/extension/templates/spec_helper.rb +1 -1
- data/lib/generators/extension/templates/tasks.rake +5 -5
- data/lib/generators/extension/templates/test_helper.rb +5 -5
- data/lib/generators/extension_controller/extension_controller_generator.rb +11 -11
- data/lib/generators/extension_controller/templates/helper.rb +1 -1
- data/lib/generators/extension_controller/templates/helper_spec.rb +2 -2
- data/lib/generators/extension_controller/templates/view.html.erb +1 -1
- data/lib/generators/extension_controller/templates/view_spec.rb +1 -1
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +10 -10
- data/lib/generators/extension_mailer/templates/mailer.rb +2 -2
- data/lib/generators/extension_migration/extension_migration_generator.rb +5 -5
- data/lib/generators/extension_model/extension_model_generator.rb +10 -10
- data/lib/generators/generator_base_extension.rb +1 -1
- data/lib/generators/instance/instance_generator.rb +14 -14
- data/lib/generators/instance/templates/databases/db2.yml +3 -3
- data/lib/generators/instance/templates/databases/mysql.yml +2 -2
- data/lib/generators/instance/templates/instance_boot.rb +4 -4
- data/lib/generators/instance/templates/instance_environment.rb +13 -3
- data/lib/generators/instance/templates/instance_radiant_config.rb +2 -2
- data/lib/generators/language_extension/language_extension_generator.rb +14 -14
- data/lib/generators/language_extension/templates/available_tags.yml +91 -91
- data/lib/generators/language_extension/templates/cucumber.yml +1 -1
- data/lib/generators/language_extension/templates/cucumber_env.rb +3 -3
- data/lib/generators/language_extension/templates/cucumber_paths.rb +4 -4
- data/lib/generators/language_extension/templates/extension.rb +1 -1
- data/lib/generators/language_extension/templates/functional_test.rb +3 -3
- data/lib/generators/language_extension/templates/lang.yml +39 -39
- data/lib/generators/language_extension/templates/spec_helper.rb +1 -1
- data/lib/generators/language_extension/templates/tasks.rake +3 -3
- data/lib/generators/language_extension/templates/test_helper.rb +5 -5
- data/lib/inheritable_class_attributes.rb +11 -11
- data/lib/local_time.rb +2 -2
- data/lib/login_system.rb +5 -6
- data/lib/method_observer.rb +9 -9
- data/lib/simpleton.rb +7 -7
- data/lib/string_extensions/string_extensions.rb +5 -5
- data/lib/symbol_extensions/symbol_extensions.rb +1 -1
- data/lib/tasks/database.rake +17 -20
- data/lib/tasks/extensions.rake +2 -2
- data/lib/tasks/framework.rake +13 -13
- data/lib/tasks/instance.rake +1 -1
- data/lib/tasks/radiant_config.rake +3 -3
- data/lib/tasks/translate.rake +10 -10
- data/lib/tasks/undefine.rake +1 -5
- data/lib/translation_support.rb +7 -7
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/admin_ui.rb +34 -34
- data/lib/trusty_cms/admin_ui/region_partials.rb +3 -3
- data/lib/trusty_cms/admin_ui/region_set.rb +5 -5
- data/lib/trusty_cms/available_locales.rb +1 -1
- data/lib/trusty_cms/config/definition.rb +21 -21
- data/lib/trusty_cms/engine.rb +4 -7
- data/lib/trusty_cms/extension.rb +15 -15
- data/lib/trusty_cms/extension/script.rb +7 -7
- data/lib/trusty_cms/extension_loader.rb +23 -11
- data/lib/trusty_cms/extension_migrator.rb +9 -9
- data/lib/trusty_cms/extension_path.rb +23 -23
- data/lib/trusty_cms/initializer.rb +33 -15
- data/lib/trusty_cms/pagination/link_renderer.rb +3 -3
- data/lib/trusty_cms/resource_responses.rb +15 -15
- data/lib/trusty_cms/setup.rb +35 -33
- data/lib/trusty_cms/taggable.rb +18 -18
- data/public/404.html +1 -1
- data/public/500.html +1 -1
- data/public/loading-iframe.html +1 -1
- data/public/robots.txt +1 -1
- data/script/rails +0 -0
- data/spec/features/admin_login_spec.rb +92 -0
- data/spec/features/config_spec.rb +34 -0
- data/spec/features/javascript_smoke_spec.rb +59 -0
- data/spec/features/layouts_spec.rb +49 -0
- data/spec/features/pages_spec.rb +55 -0
- data/spec/fixtures/users.yml +16 -0
- data/spec/helpers/regions_helper_spec.rb +16 -0
- data/spec/rails_helper.rb +74 -0
- data/spec/spec_helper.rb +78 -0
- data/spec/support/custom_actions.rb +9 -0
- data/trusty_cms.gemspec +22 -25
- metadata +393 -242
- checksums.yaml +0 -15
- data/config/compass.config +0 -15
- data/config/database.db2.yml +0 -20
- data/config/database.postgresql.yml +0 -25
- data/config/database.sqlite.yml +0 -16
- data/config/database.sqlserver.yml +0 -20
- data/config/initializers/object_extensions.rb +0 -1
- data/config/preinitializer.rb +0 -18
- data/lib/object_extensions/object_extensions.rb +0 -5
- data/lib/tasks/prototype.rake +0 -31
- data/lib/tasks/release.rake +0 -131
- data/lib/trusty_cms/cache.rb +0 -100
- data/public/javascripts/admin/application.js +0 -94
- data/public/javascripts/admin/codearea.js +0 -165
- data/public/javascripts/admin/controls.js +0 -965
- data/public/javascripts/admin/dateinput.js +0 -402
- data/public/javascripts/admin/dragdrop.js +0 -974
- data/public/javascripts/admin/dropdown.js +0 -216
- data/public/javascripts/admin/effects.js +0 -1122
- data/public/javascripts/admin/lowpro.js +0 -340
- data/public/javascripts/admin/overrides.js +0 -1
- data/public/javascripts/admin/page_preview.js +0 -41
- data/public/javascripts/admin/pagefield.js +0 -54
- data/public/javascripts/admin/pagestatus.js +0 -17
- data/public/javascripts/admin/popup.js +0 -339
- data/public/javascripts/admin/prototype.js +0 -4874
- data/public/javascripts/admin/ruledtable.js +0 -13
- data/public/javascripts/admin/shortcuts.js +0 -33
- data/public/javascripts/admin/sitemap.js +0 -149
- data/public/javascripts/admin/status.js +0 -233
- data/public/javascripts/admin/tabcontrol.js +0 -123
- data/public/javascripts/admin/toggle.js +0 -430
- data/public/javascripts/admin/utility.js +0 -53
- data/public/javascripts/admin/validationerror.js +0 -18
- data/public/stylesheets/sass/admin/_base.sass +0 -18
- data/public/stylesheets/sass/admin/main.sass +0 -27
- data/public/stylesheets/sass/admin/modules/_boxes.sass +0 -6
- data/public/stylesheets/sass/admin/modules/_gradients.sass +0 -4
- data/public/stylesheets/sass/admin/modules/_links.sass +0 -18
- data/public/stylesheets/sass/admin/overrides.sass +0 -2
- data/public/stylesheets/sass/admin/partials/_actions.sass +0 -96
- data/public/stylesheets/sass/admin/partials/_avatars.sass +0 -10
- data/public/stylesheets/sass/admin/partials/_content.sass +0 -58
- data/public/stylesheets/sass/admin/partials/_dateinput.sass +0 -62
- data/public/stylesheets/sass/admin/partials/_deprecated.sass +0 -55
- data/public/stylesheets/sass/admin/partials/_dropdown.sass +0 -28
- data/public/stylesheets/sass/admin/partials/_footer.sass +0 -12
- data/public/stylesheets/sass/admin/partials/_forms.sass +0 -322
- data/public/stylesheets/sass/admin/partials/_header.sass +0 -114
- data/public/stylesheets/sass/admin/partials/_index.sass +0 -147
- data/public/stylesheets/sass/admin/partials/_layout.sass +0 -10
- data/public/stylesheets/sass/admin/partials/_messages.sass +0 -10
- data/public/stylesheets/sass/admin/partials/_popup.sass +0 -213
- data/public/stylesheets/sass/admin/partials/_tabcontrol.sass +0 -72
- data/public/stylesheets/sass/admin/partials/_toolbar.sass +0 -31
- data/public/stylesheets/sass/admin/partials/_typography.sass +0 -60
- data/public/stylesheets/sass/admin/partials/_validations.sass +0 -19
- data/rails/init.rb +0 -1
- data/script/about +0 -4
- data/script/breakpointer +0 -3
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/performance/request +0 -3
- data/script/plugin +0 -3
- data/script/process/inspector +0 -3
- data/script/process/reaper +0 -3
- data/script/process/spawner +0 -3
- data/script/process/spinner +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/script/version +0 -5
- data/spec/ci/database.postgresql.yml +0 -4
- data/spec/ci/database.sqlite.yml +0 -3
@@ -4,8 +4,8 @@ require 'login_system'
|
|
4
4
|
class ApplicationController < ActionController::Base
|
5
5
|
include LoginSystem
|
6
6
|
# TODO: Add an ActionView::PathSet.new([paths]) for all extension view paths
|
7
|
-
prepend_view_path
|
8
|
-
|
7
|
+
prepend_view_path("#{TRUSTY_CMS_ROOT}/app/views")
|
8
|
+
|
9
9
|
protect_from_forgery
|
10
10
|
|
11
11
|
before_filter :set_current_user
|
@@ -18,22 +18,11 @@ class ApplicationController < ActionController::Base
|
|
18
18
|
attr_accessor :trusty_config, :cache
|
19
19
|
attr_reader :pagination_parameters
|
20
20
|
helper_method :pagination_parameters
|
21
|
-
|
21
|
+
|
22
22
|
def initialize
|
23
23
|
super
|
24
24
|
@trusty_config = TrustyCms::Config
|
25
25
|
end
|
26
|
-
|
27
|
-
# helpers to include additional assets from actions or views
|
28
|
-
helper_method :include_stylesheet, :include_javascript
|
29
|
-
|
30
|
-
def include_stylesheet(sheet)
|
31
|
-
@stylesheets << sheet
|
32
|
-
end
|
33
|
-
|
34
|
-
def include_javascript(script)
|
35
|
-
@javascripts << script
|
36
|
-
end
|
37
26
|
|
38
27
|
def template_name
|
39
28
|
case self.action_name
|
@@ -51,7 +40,7 @@ class ApplicationController < ActionController::Base
|
|
51
40
|
self.action_name
|
52
41
|
end
|
53
42
|
end
|
54
|
-
|
43
|
+
|
55
44
|
def rescue_action_in_public(exception)
|
56
45
|
case exception
|
57
46
|
when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
|
@@ -60,21 +49,21 @@ class ApplicationController < ActionController::Base
|
|
60
49
|
super
|
61
50
|
end
|
62
51
|
end
|
63
|
-
|
52
|
+
|
64
53
|
private
|
65
|
-
|
54
|
+
|
66
55
|
def set_current_user
|
67
56
|
UserActionObserver.instance.current_user = current_user
|
68
|
-
end
|
69
|
-
|
70
|
-
def set_user_locale
|
57
|
+
end
|
58
|
+
|
59
|
+
def set_user_locale
|
71
60
|
I18n.locale = current_user && !current_user.locale.blank? ? current_user.locale : TrustyCms::Config['default_locale']
|
72
61
|
end
|
73
62
|
|
74
63
|
def set_timezone
|
75
64
|
Time.zone = TrustyCms::Config['local.timezone'] != nil && TrustyCms::Config['local.timezone'].empty? ? Time.zone_default : TrustyCms::Config['local.timezone']
|
76
65
|
end
|
77
|
-
|
66
|
+
|
78
67
|
def set_javascripts_and_stylesheets
|
79
68
|
@stylesheets ||= []
|
80
69
|
@stylesheets.concat %w(admin/main)
|
@@ -85,7 +74,7 @@ class ApplicationController < ActionController::Base
|
|
85
74
|
@body_classes ||= []
|
86
75
|
@body_classes.concat(%w(reversed))
|
87
76
|
end
|
88
|
-
|
77
|
+
|
89
78
|
# When using TrustyCms with Ruby 1.9, the strings that come in from forms are ASCII-8BIT encoded.
|
90
79
|
# That causes problems, especially when using special chars and with certain DBs, like DB2
|
91
80
|
# That's why we force the encoding of the params to UTF-8
|
@@ -94,7 +83,7 @@ class ApplicationController < ActionController::Base
|
|
94
83
|
# See http://stackoverflow.com/questions/8268778/rails-2-3-9-encoding-of-query-parameters
|
95
84
|
# See https://rails.lighthouseapp.com/projects/8994/tickets/4807
|
96
85
|
# See http://jasoncodes.com/posts/ruby19-rails2-encodings (thanks for the following code, Jason!)
|
97
|
-
def force_utf8_params
|
86
|
+
def force_utf8_params
|
98
87
|
traverse = lambda do |object, block|
|
99
88
|
if object.kind_of?(Hash)
|
100
89
|
object.each_value { |o| traverse.call(o, block) }
|
@@ -110,5 +99,5 @@ class ApplicationController < ActionController::Base
|
|
110
99
|
end
|
111
100
|
traverse.call(params, force_encoding)
|
112
101
|
end
|
113
|
-
|
102
|
+
|
114
103
|
end
|
@@ -24,8 +24,9 @@ class SiteController < ApplicationController
|
|
24
24
|
process_page(@page)
|
25
25
|
set_cache_control
|
26
26
|
@performed_render ||= true
|
27
|
+
render layout: false
|
27
28
|
else
|
28
|
-
render :template => 'site/not_found', :status => 404
|
29
|
+
render :template => 'site/not_found', :status => 404, layout: false
|
29
30
|
end
|
30
31
|
rescue Page::MissingRootPageError
|
31
32
|
redirect_to welcome_url
|
@@ -11,7 +11,7 @@ module Admin::ConfigurationHelper
|
|
11
11
|
setting.valid?
|
12
12
|
domkey = key.gsub(/\W/, '_')
|
13
13
|
html = ""
|
14
|
-
html << content_tag(:label, t("
|
14
|
+
html << content_tag(:label, t("trusty_config.#{key}").titlecase, :for => domkey)
|
15
15
|
if setting.boolean?
|
16
16
|
value = setting.checked? ? t('yes') : t('no')
|
17
17
|
html << content_tag(:span, value, :id => domkey, :class => "#{value} #{options[:class]}")
|
@@ -20,17 +20,18 @@ module Admin::ConfigurationHelper
|
|
20
20
|
html << content_tag(:span, value, :id => domkey, :class => options[:class])
|
21
21
|
end
|
22
22
|
html << content_tag(:span, " #{t("units.#{setting.units}")}", :class => 'units') if setting.units
|
23
|
-
html << content_tag(:span, " #{t('warning')}: #{[setting.errors.
|
24
|
-
html
|
23
|
+
html << content_tag(:span, " #{t('warning')}: #{[setting.errors.get(:value)].flatten.first}", :class => 'warning') if setting.errors.get(:value)
|
24
|
+
Rails.logger.error(html)
|
25
|
+
html.html_safe
|
25
26
|
end
|
26
|
-
|
27
|
+
|
27
28
|
# Renders the setting as label and appropriate input field:
|
28
29
|
#
|
29
30
|
# edit_setting("admin.title")
|
30
31
|
# => <label for="admin_title">Admin title<label><input type="text" name="config['admin.title']" id="admin_title" value="TrustyCms CMS" />
|
31
32
|
#
|
32
33
|
# edit_config("defaults.page.status")
|
33
|
-
# =>
|
34
|
+
# =>
|
34
35
|
# <label for="defaults_page_status">Default page status<label>
|
35
36
|
# <select type="text" name="config['defaults.page.status']" id="defaults_page_status">
|
36
37
|
# <option value="Draft">Draft</option>
|
@@ -43,38 +44,38 @@ module Admin::ConfigurationHelper
|
|
43
44
|
def edit_config(key, options={})
|
44
45
|
setting = setting_for(key)
|
45
46
|
domkey = key.gsub(/\W/, '_')
|
46
|
-
name = "
|
47
|
-
title = t("
|
47
|
+
name = "trusty_config[#{key}]"
|
48
|
+
title = t("trusty_config.#{key}").titlecase
|
48
49
|
title << content_tag(:span, " (#{t("units.#{setting.units}")})", :class => 'units') if setting.units
|
49
50
|
value = params[key.to_sym].nil? ? setting.value : params[key.to_sym]
|
50
51
|
html = ""
|
51
52
|
if setting.boolean?
|
52
53
|
html << hidden_field_tag(name, 0)
|
53
54
|
html << check_box_tag(name, 1, value, :class => 'setting', :id => domkey)
|
54
|
-
html << content_tag(:label, title, :class => 'checkbox', :for => domkey)
|
55
|
+
html << content_tag(:label, title.html_safe, :class => 'checkbox', :for => domkey)
|
55
56
|
elsif setting.selector?
|
56
|
-
html << content_tag(:label, title, :for => domkey)
|
57
|
+
html << content_tag(:label, title.html_safe, :for => domkey)
|
57
58
|
html << select_tag(name, options_for_select(setting.definition.selection, value), :class => 'setting', :id => domkey)
|
58
59
|
else
|
59
|
-
html << content_tag(:label, title, :for => domkey)
|
60
|
+
html << content_tag(:label, title.html_safe, :for => domkey)
|
60
61
|
html << text_field_tag(name, value, :class => 'textbox', :id => domkey)
|
61
62
|
end
|
62
|
-
if setting.errors
|
63
|
-
html << content_tag(:span, [setting.errors
|
64
|
-
html = content_tag(:span, html, :class => "error-with-field")
|
63
|
+
if setting.errors[:value].present?
|
64
|
+
html << content_tag(:span, [setting.errors[:value]].flatten.first, :class => 'error')
|
65
|
+
html = content_tag(:span, html.html_safe, :class => "error-with-field")
|
65
66
|
end
|
66
|
-
html
|
67
|
+
html.html_safe
|
67
68
|
end
|
68
|
-
|
69
|
+
|
69
70
|
def setting_for(key)
|
70
|
-
@
|
71
|
-
@
|
71
|
+
@trusty_config ||= {} # normally initialized in Admin::ConfigurationController
|
72
|
+
@trusty_config[key] ||= TrustyCms.config.find_or_create_by_key(key)
|
72
73
|
end
|
73
|
-
|
74
|
+
|
74
75
|
def definition_for(key)
|
75
76
|
if setting = setting_for(key)
|
76
77
|
setting.definition
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
end
|
81
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
module Admin::ExtensionsHelper
|
2
|
-
end
|
2
|
+
end
|
@@ -1,21 +1,3 @@
|
|
1
1
|
module Admin::LayoutsHelper
|
2
|
-
|
3
|
-
<<-CODE
|
4
|
-
var tagReferenceWindows = {};
|
5
|
-
function loadTagReference() {
|
6
|
-
var pageType = 'Page';
|
7
|
-
if (!tagReferenceWindows[pageType])
|
8
|
-
tagReferenceWindows[pageType] = new Popup.AjaxWindow("#{admin_reference_path('tags')}?class_name=" + encodeURIComponent(pageType), {reload: false});
|
9
|
-
var window = tagReferenceWindows[pageType];
|
10
|
-
if('Page' != pageType) {
|
11
|
-
$('tag_reference_link').highlight();
|
12
|
-
window.show();
|
13
|
-
} else {
|
14
|
-
window.toggle();
|
15
|
-
}
|
16
|
-
lastPageType = pageType;
|
17
|
-
return false;
|
18
|
-
}
|
19
|
-
CODE
|
20
|
-
end
|
2
|
+
|
21
3
|
end
|
@@ -1,14 +1,28 @@
|
|
1
1
|
module Admin::NodeHelper
|
2
2
|
|
3
|
-
def
|
4
|
-
@
|
3
|
+
def render_nodes(page, starting_index, parent_index = nil)
|
4
|
+
@rendered_html = ""
|
5
|
+
render_node page, starting_index, parent_index
|
6
|
+
@rendered_html
|
7
|
+
end
|
8
|
+
|
9
|
+
def render_node(page, index, parent_index = nil)
|
10
|
+
|
11
|
+
@current_node = prepare_page(page)
|
12
|
+
|
13
|
+
@rendered_html += (render :partial => 'admin/pages/node',
|
14
|
+
:locals => {level: index, index: index, parent_index: parent_index,
|
15
|
+
page: page, simple: false, branch: (page.children.count > 0) })
|
16
|
+
index
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare_page(page)
|
5
20
|
page.extend MenuRenderer
|
6
21
|
page.view = self
|
7
22
|
if page.additional_menu_features?
|
8
23
|
page.extend(*page.menu_renderer_modules)
|
9
24
|
end
|
10
|
-
|
11
|
-
render :partial => 'admin/pages/node', :locals => locals
|
25
|
+
page
|
12
26
|
end
|
13
27
|
|
14
28
|
def homepage
|
@@ -16,7 +30,7 @@ module Admin::NodeHelper
|
|
16
30
|
end
|
17
31
|
|
18
32
|
def show_all?
|
19
|
-
|
33
|
+
controller.action_name == 'remove'
|
20
34
|
end
|
21
35
|
|
22
36
|
def expanded_rows
|
@@ -75,7 +89,7 @@ module Admin::NodeHelper
|
|
75
89
|
end
|
76
90
|
|
77
91
|
def node_title
|
78
|
-
%{<span class="title">#{ h(@current_node.title) }</span>}
|
92
|
+
%{<span class="title">#{ h(@current_node.title) }</span>}.html_safe
|
79
93
|
end
|
80
94
|
|
81
95
|
def page_type
|
@@ -83,7 +97,7 @@ module Admin::NodeHelper
|
|
83
97
|
if display_name == 'Page'
|
84
98
|
""
|
85
99
|
else
|
86
|
-
%{<span class="info">(#{ h(display_name) })</span>}
|
100
|
+
%{<span class="info">(#{ h(display_name) })</span>}.html_safe
|
87
101
|
end
|
88
102
|
end
|
89
103
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Admin::PagesHelper
|
2
2
|
include Admin::NodeHelper
|
3
3
|
include Admin::ReferencesHelper
|
4
|
-
|
4
|
+
|
5
5
|
def class_of_page
|
6
6
|
@page.class
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def filter
|
10
|
-
@page.parts.
|
10
|
+
@page.parts.first.filter if @page.parts.respond_to?(:any?) && @page.parts.any?
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def meta_errors?
|
14
14
|
!!(@page.errors[:slug] or @page.errors[:breadcrumb])
|
15
15
|
end
|
@@ -26,92 +26,4 @@ module Admin::PagesHelper
|
|
26
26
|
def clean_page_description(page)
|
27
27
|
page.description.to_s.strip.gsub(/\t/,'').gsub(/\s+/,' ')
|
28
28
|
end
|
29
|
-
|
30
|
-
def page_edit_javascripts
|
31
|
-
<<-CODE
|
32
|
-
function addPart(form) {
|
33
|
-
if (validPartName()) {
|
34
|
-
new Ajax.Updater(
|
35
|
-
$('tab_control').down('.pages'),
|
36
|
-
'#{admin_page_parts_path}',
|
37
|
-
{
|
38
|
-
asynchronous: true,
|
39
|
-
evalScripts: true,
|
40
|
-
insertion: 'bottom',
|
41
|
-
onComplete: function(request){ partAdded() },
|
42
|
-
onLoading: function(request){ partLoading() },
|
43
|
-
parameters: Form.serialize(form)
|
44
|
-
}
|
45
|
-
);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
function removePart() {
|
49
|
-
if(confirm('Remove the current part?')) {
|
50
|
-
TabControls['tab_control'].removeSelected();
|
51
|
-
}
|
52
|
-
}
|
53
|
-
function partAdded() {
|
54
|
-
var tabControl = TabControls['tab_control'];
|
55
|
-
$('add_part_busy').hide();
|
56
|
-
$('add_part_button').disabled = false;
|
57
|
-
$('add_part_popup').closePopup();
|
58
|
-
$('part_name_field').value = '';
|
59
|
-
tabControl.updateTabs();
|
60
|
-
tabControl.select(tabControl.tabs.last());
|
61
|
-
}
|
62
|
-
function partLoading() {
|
63
|
-
$('add_part_button').disabled = true;
|
64
|
-
$('add_part_busy').appear();
|
65
|
-
}
|
66
|
-
function validPartName() {
|
67
|
-
var partNameField = $('part_name_field');
|
68
|
-
var name = partNameField.value.downcase();
|
69
|
-
if (name.blank()) {
|
70
|
-
alert('Part name cannot be empty.');
|
71
|
-
return false;
|
72
|
-
}
|
73
|
-
if (TabControls['tab_control'].findTabByCaption(name)) {
|
74
|
-
alert('Part name must be unique.');
|
75
|
-
return false;
|
76
|
-
}
|
77
|
-
return true;
|
78
|
-
}
|
79
|
-
|
80
|
-
var lastPageType = '#{@page.class.name}';
|
81
|
-
var tagReferenceWindows = {};
|
82
|
-
function loadTagReference(part) {
|
83
|
-
var pageType = $F('page_class_name');
|
84
|
-
if (!tagReferenceWindows[pageType])
|
85
|
-
tagReferenceWindows[pageType] = new Popup.AjaxWindow("#{admin_reference_path('tags')}?class_name=" + encodeURIComponent(pageType), {reload: false});
|
86
|
-
var window = tagReferenceWindows[pageType];
|
87
|
-
if(lastPageType != pageType) {
|
88
|
-
$('tag_reference_link_' + part).highlight();
|
89
|
-
window.show();
|
90
|
-
} else {
|
91
|
-
window.toggle();
|
92
|
-
}
|
93
|
-
lastPageType = pageType;
|
94
|
-
return false;
|
95
|
-
}
|
96
|
-
|
97
|
-
var lastFilter = '#{default_filter_name}';
|
98
|
-
var filterWindows = {};
|
99
|
-
function loadFilterReference(part) {
|
100
|
-
var filter = $F("part_" + part + "_filter_id");
|
101
|
-
if (filter != "") {
|
102
|
-
if (!filterWindows[filter]) filterWindows[filter] = new Popup.AjaxWindow("#{admin_reference_path('filters')}?filter_name="+encodeURIComponent(filter), {reload: false});
|
103
|
-
var window = filterWindows[filter];
|
104
|
-
if(lastFilter != filter) {
|
105
|
-
window.show();
|
106
|
-
} else {
|
107
|
-
window.toggle();
|
108
|
-
}
|
109
|
-
lastFilter = filter;
|
110
|
-
} else {
|
111
|
-
alert('No documentation for filter.');
|
112
|
-
}
|
113
|
-
return false;
|
114
|
-
}
|
115
|
-
CODE
|
116
|
-
end
|
117
29
|
end
|
@@ -14,15 +14,16 @@ module Admin::RegionsHelper
|
|
14
14
|
rescue ::ActionView::TemplateError => e # error in template
|
15
15
|
raise e
|
16
16
|
end
|
17
|
-
end.join
|
17
|
+
end.join.html_safe
|
18
|
+
Rails.logger.error(output)
|
18
19
|
block_given? ? concat(output) : output
|
19
20
|
end
|
20
21
|
|
21
22
|
def lazy_initialize_region_set
|
22
23
|
unless @region_set
|
23
|
-
@controller_name ||= @
|
24
|
-
@template_name ||= @
|
24
|
+
@controller_name ||= @_controller.controller_name
|
25
|
+
@template_name ||= @_controller.template_name
|
25
26
|
@region_set = admin.send(@controller_name).send(@template_name)
|
26
27
|
end
|
27
28
|
end
|
28
|
-
end
|
29
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
1
|
module ApplicationHelper
|
2
2
|
include Admin::RegionsHelper
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
|
4
|
+
def trusty_config
|
5
|
+
TrustyCms::Config
|
6
|
+
end
|
7
|
+
|
8
8
|
def default_page_title
|
9
9
|
title + ' - ' + subtitle
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def title
|
13
|
-
|
13
|
+
trusty_config['admin.title'] || 'Trusty CMS'
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def subtitle
|
17
|
-
|
17
|
+
trusty_config['admin.subtitle'] || 'Publishing for Small Teams'
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def logged_in?
|
21
21
|
!current_user.nil?
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def onsubmit_status(model)
|
25
25
|
model.new_record? ? t('creating_status', :model => t(model.class.name.downcase)) : "#{I18n.t('saving_changes')}…"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def save_model_button(model, options = {})
|
29
29
|
model_name = model.class.name.underscore
|
30
30
|
human_model_name = model_name.humanize.titlecase
|
@@ -35,11 +35,11 @@ module ApplicationHelper
|
|
35
35
|
options[:accesskey] ||= 'S'
|
36
36
|
submit_tag options.delete(:label), options
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def save_model_and_continue_editing_button(model)
|
40
40
|
submit_tag t('buttons.save_and_continue'), :name => 'continue', :class => 'button', :accesskey => "s"
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def current_item?(item)
|
44
44
|
if item.tab && item.tab.many? {|i| current_url?(i.relative_url) }
|
45
45
|
# Accept only stricter URL matches if more than one matches
|
@@ -48,27 +48,28 @@ module ApplicationHelper
|
|
48
48
|
current_url?(item.relative_url)
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def current_tab?(tab)
|
53
53
|
@current_tab ||= tab if tab.any? {|item| current_url?(item.relative_url) }
|
54
54
|
@current_tab == tab
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
def current_url?(options)
|
58
58
|
url = case options
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
when Hash
|
60
|
+
url_for options
|
61
|
+
else
|
62
|
+
options.to_s
|
63
|
+
end
|
64
|
+
#TODO: look for other instances of request_uri
|
65
|
+
request.original_fullpath =~ Regexp.new('^' + Regexp.quote(clean(url)))
|
65
66
|
end
|
66
|
-
|
67
|
+
|
67
68
|
def clean(url)
|
68
69
|
uri = URI.parse(url)
|
69
70
|
uri.path.gsub(%r{/+}, '/').gsub(%r{/$}, '')
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
def nav_link_to(name, options)
|
73
74
|
if current_url?(options)
|
74
75
|
%{<strong>#{ link_to translate_with_default(name), options }</strong>}
|
@@ -76,39 +77,35 @@ module ApplicationHelper
|
|
76
77
|
link_to translate_with_default(name), options
|
77
78
|
end
|
78
79
|
end
|
79
|
-
|
80
|
+
|
80
81
|
def admin?
|
81
82
|
current_user and current_user.admin?
|
82
83
|
end
|
83
|
-
|
84
|
+
|
84
85
|
def designer?
|
85
86
|
current_user and (current_user.designer? or current_user.admin?)
|
86
87
|
end
|
87
|
-
|
88
|
-
def focus(field_name)
|
89
|
-
javascript_tag "Field.activate('#{field_name}');"
|
90
|
-
end
|
91
|
-
|
88
|
+
|
92
89
|
def updated_stamp(model)
|
93
90
|
unless model.new_record?
|
94
91
|
updated_by = (model.updated_by || model.created_by)
|
95
92
|
name = updated_by ? updated_by.name : nil
|
96
93
|
time = (model.updated_at || model.created_at)
|
97
94
|
if name or time
|
98
|
-
html = %{<p class="updated_line">#{t('timestamp.last_updated')} }
|
95
|
+
html = %{<p class="updated_line">#{t('timestamp.last_updated')} }
|
99
96
|
html << %{#{t('timestamp.by')} <strong>#{name}</strong> } if name
|
100
97
|
html << %{#{t('timestamp.at')} #{timestamp(time)}} if time
|
101
98
|
html << %{</p>}
|
102
|
-
html
|
99
|
+
html.html_safe
|
103
100
|
end
|
104
101
|
end
|
105
102
|
end
|
106
|
-
|
103
|
+
|
107
104
|
def timestamp(time)
|
108
105
|
# time.strftime("%I:%M %p on %B %e, %Y").sub("AM", 'am').sub("PM", 'pm')
|
109
|
-
I18n.localize(time, :format => :timestamp)
|
110
|
-
end
|
111
|
-
|
106
|
+
I18n.localize(time, :format => :timestamp)
|
107
|
+
end
|
108
|
+
|
112
109
|
def meta_visible(symbol)
|
113
110
|
v = case symbol
|
114
111
|
when :meta_more
|
@@ -118,62 +115,63 @@ module ApplicationHelper
|
|
118
115
|
end
|
119
116
|
v ? {} : {:style => "display: none"}
|
120
117
|
end
|
121
|
-
|
118
|
+
|
122
119
|
def meta_errors?
|
123
120
|
false
|
124
121
|
end
|
125
|
-
|
122
|
+
|
126
123
|
def meta_label
|
127
124
|
meta_errors? ? 'Less' : 'More'
|
128
125
|
end
|
129
|
-
|
130
|
-
def toggle_javascript_for(id)
|
131
|
-
"Element.toggle('#{id}'); Element.toggle('more-#{id}'); Element.toggle('less-#{id}'); return false;"
|
132
|
-
end
|
133
|
-
|
126
|
+
|
134
127
|
def image(name, options = {})
|
135
128
|
image_tag(append_image_extension("admin/#{name}"), options)
|
136
129
|
end
|
137
|
-
|
130
|
+
|
138
131
|
def image_submit(name, options = {})
|
139
132
|
image_submit_tag(append_image_extension("admin/#{name}"), options)
|
140
133
|
end
|
141
|
-
|
134
|
+
|
142
135
|
def admin
|
143
136
|
TrustyCms::AdminUI.instance
|
144
137
|
end
|
145
|
-
|
138
|
+
|
146
139
|
def filter_options_for_select(selected=nil)
|
147
140
|
options_for_select([[t('select.none'), '']] + TextFilter.descendants_names, selected)
|
148
141
|
end
|
149
|
-
|
142
|
+
|
150
143
|
def body_classes
|
151
144
|
@body_classes ||= []
|
152
145
|
end
|
153
|
-
|
146
|
+
|
154
147
|
def nav_tabs
|
155
148
|
admin.nav
|
156
149
|
end
|
157
|
-
|
150
|
+
|
158
151
|
def translate_with_default(name)
|
159
152
|
t(name.underscore.downcase, :default => name)
|
160
153
|
end
|
161
|
-
|
154
|
+
|
162
155
|
def available_locales_select
|
163
156
|
[[t('select.default'),'']] + TrustyCms::AvailableLocales.locales
|
164
157
|
end
|
165
|
-
|
166
|
-
def
|
167
|
-
overrides =
|
158
|
+
|
159
|
+
def stylesheet_overrides
|
160
|
+
overrides = []
|
168
161
|
if File.exist?("#{Rails.root}/public/stylesheets/admin/overrides.css") || File.exist?("#{Rails.root}/public/stylesheets/sass/admin/overrides.sass")
|
169
|
-
overrides <<
|
162
|
+
overrides << 'admin/overrides'
|
170
163
|
end
|
164
|
+
overrides
|
165
|
+
end
|
166
|
+
|
167
|
+
def javascript_overrides
|
168
|
+
overrides = []
|
171
169
|
if File.exist?("#{Rails.root}/public/javascripts/admin/overrides.js")
|
172
|
-
overrides <<
|
170
|
+
overrides << 'admin/overrides'
|
173
171
|
end
|
174
172
|
overrides
|
175
173
|
end
|
176
|
-
|
174
|
+
|
177
175
|
# Returns a Gravatar URL associated with the email parameter.
|
178
176
|
# See: http://douglasfshearer.com/blog/gravatar-for-ruby-and-ruby-on-rails
|
179
177
|
def gravatar_url(email, options={})
|
@@ -190,8 +188,8 @@ module ApplicationHelper
|
|
190
188
|
options[:default] ||= default_avatar_url
|
191
189
|
|
192
190
|
unless email.blank?
|
193
|
-
# Build the Gravatar url.
|
194
|
-
url = '//gravatar.com/avatar/'
|
191
|
+
# Build the Gravatar url.
|
192
|
+
url = '//gravatar.com/avatar/'
|
195
193
|
url << "#{Digest::MD5.new.update(email)}?"
|
196
194
|
url << "rating=#{options[:rating]}" if options[:rating]
|
197
195
|
url << "&size=#{options[:size]}" if options[:size]
|
@@ -206,9 +204,9 @@ module ApplicationHelper
|
|
206
204
|
local_avatar_url
|
207
205
|
end
|
208
206
|
end
|
209
|
-
|
207
|
+
|
210
208
|
# returns the usual set of pagination links.
|
211
|
-
# options are passed through to will_paginate
|
209
|
+
# options are passed through to will_paginate
|
212
210
|
# and a 'show all' depagination link is added if relevant.
|
213
211
|
def pagination_for(list, options={})
|
214
212
|
if list.respond_to? :total_pages
|
@@ -227,9 +225,9 @@ module ApplicationHelper
|
|
227
225
|
html
|
228
226
|
end
|
229
227
|
end
|
230
|
-
|
228
|
+
|
231
229
|
private
|
232
|
-
|
230
|
+
|
233
231
|
def append_image_extension(name)
|
234
232
|
unless name =~ /\.(.*?)$/
|
235
233
|
name + '.png'
|
@@ -237,5 +235,5 @@ module ApplicationHelper
|
|
237
235
|
name
|
238
236
|
end
|
239
237
|
end
|
240
|
-
|
238
|
+
|
241
239
|
end
|