typus 0.9.39 → 1.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +104 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +96 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +45 -0
- data/Rakefile +19 -48
- data/app/controllers/admin/account_controller.rb +54 -0
- data/app/controllers/admin/dashboard_controller.rb +7 -0
- data/app/controllers/admin/resource_controller.rb +8 -0
- data/app/controllers/admin/resources_controller.rb +307 -0
- data/app/controllers/admin/session_controller.rb +38 -0
- data/app/controllers/admin_controller.rb +26 -0
- data/app/helpers/admin/dashboard_helper.rb +38 -0
- data/app/helpers/admin/filters_helper.rb +81 -0
- data/app/helpers/admin/form_helper.rb +68 -261
- data/app/helpers/admin/preview_helper.rb +48 -0
- data/app/helpers/admin/relationships_helper.rb +192 -0
- data/app/helpers/admin/resources_helper.rb +80 -0
- data/app/helpers/admin/search_helper.rb +19 -0
- data/app/helpers/admin/sidebar_helper.rb +32 -210
- data/app/helpers/admin/table_helper.rb +207 -200
- data/app/helpers/admin_helper.rb +56 -0
- data/app/mailers/admin/mailer.rb +13 -0
- data/app/models/admin/fake_user.rb +38 -0
- data/app/views/admin/account/forgot_password.html.erb +21 -0
- data/app/views/admin/account/new.html.erb +21 -0
- data/app/views/admin/dashboard/_sidebar.html.erb +3 -3
- data/app/views/admin/dashboard/show.html.erb +16 -0
- data/app/views/admin/dashboard/styles.html.erb +154 -0
- data/app/views/admin/helpers/_apps.html.erb +6 -0
- data/app/views/admin/helpers/_flash_message.html.erb +3 -0
- data/app/views/admin/helpers/_header.html.erb +7 -0
- data/app/views/admin/helpers/_login_info.html.erb +4 -0
- data/app/views/admin/helpers/_preview.html.erb +13 -0
- data/app/views/admin/helpers/dashboard/_applications.html.erb +32 -0
- data/app/views/admin/helpers/dashboard/_resources.html.erb +16 -0
- data/app/views/admin/helpers/filters/_filters.html.erb +31 -0
- data/app/views/admin/helpers/resources/_display_link_to_previous.html.erb +3 -0
- data/app/views/admin/helpers/resources/_pagination.html.erb +28 -0
- data/app/views/admin/helpers/search/_search.html.erb +12 -0
- data/app/views/admin/helpers/sidebar/_sidebar.html.erb +17 -0
- data/app/views/admin/helpers/table/_table.html.erb +22 -0
- data/app/views/{typus_mailer/reset_password_link.erb → admin/mailer/reset_password_link.text.erb} +2 -2
- data/{test/config/broken/empty.yml → app/views/admin/resources/_edit.html.erb} +0 -0
- data/app/views/admin/resources/_form.html.erb +26 -0
- data/{test/config/broken/empty_roles.yml → app/views/admin/resources/_index.html.erb} +0 -0
- data/{test/config/empty/empty_01.yml → app/views/admin/resources/_new.html.erb} +0 -0
- data/{test/config/empty/empty_01_roles.yml → app/views/admin/resources/_show.html.erb} +0 -0
- data/app/views/admin/resources/edit.html.erb +23 -21
- data/app/views/admin/resources/index.html.erb +31 -18
- data/app/views/admin/resources/new.html.erb +20 -18
- data/app/views/admin/resources/show.html.erb +29 -20
- data/app/views/admin/session/new.html.erb +26 -0
- data/app/views/admin/templates/_belongs_to.html.erb +4 -0
- data/app/views/admin/templates/_boolean.html.erb +4 -8
- data/app/views/admin/templates/_date.html.erb +9 -2
- data/app/views/admin/templates/_datetime.html.erb +9 -2
- data/app/views/admin/templates/_file.html.erb +20 -5
- data/app/views/admin/templates/_has_many.html.erb +24 -0
- data/app/views/admin/templates/_has_n.html.erb +17 -0
- data/{test/config/empty/empty_02.yml → app/views/admin/templates/_has_one.html.erb} +0 -0
- data/app/views/admin/templates/_password.html.erb +4 -2
- data/app/views/admin/templates/_relate_form.html.erb +4 -0
- data/app/views/admin/templates/_selector.html.erb +6 -18
- data/app/views/admin/templates/_string.html.erb +11 -10
- data/app/views/admin/templates/_text.html.erb +9 -2
- data/app/views/admin/templates/_time.html.erb +9 -2
- data/app/views/admin/templates/_tree.html.erb +4 -0
- data/app/views/layouts/admin/session.html.erb +44 -0
- data/app/views/layouts/admin.html.erb +45 -39
- data/config/available_locales/ca.yml +124 -0
- data/config/available_locales/ca_models.yml +16 -0
- data/config/{locales → available_locales}/de.yml +108 -89
- data/config/available_locales/de_models.yml +13 -0
- data/config/available_locales/es.yml +124 -0
- data/config/available_locales/es_models.yml +13 -0
- data/config/available_locales/fr.yml +124 -0
- data/config/available_locales/fr_models.yml +13 -0
- data/config/available_locales/hu.yml +124 -0
- data/config/available_locales/hu_models.yml +13 -0
- data/config/available_locales/it.yml +136 -0
- data/config/available_locales/it_models.yml +15 -0
- data/config/available_locales/language.yml.template +122 -0
- data/config/available_locales/language_models.yml.template +13 -0
- data/config/{locales → available_locales}/pt-BR.yml +97 -74
- data/config/available_locales/pt-BR_models.yml +13 -0
- data/config/{locales → available_locales}/ru.yml +107 -85
- data/config/available_locales/ru_models.yml +13 -0
- data/config/routes.rb +18 -11
- data/lib/generators/templates/config/initializers/typus.rb +26 -0
- data/lib/generators/templates/config/initializers/typus_authentication.rb +18 -0
- data/lib/generators/templates/config/initializers/typus_resources.rb +30 -0
- data/{generators/typus → lib/generators}/templates/config/typus/README +34 -16
- data/lib/generators/templates/config/typus/application.yml +5 -0
- data/lib/generators/templates/config/typus/application_roles.yml +6 -0
- data/lib/generators/templates/config/typus/typus.yml +17 -0
- data/lib/generators/templates/config/typus/typus_roles.yml +6 -0
- data/lib/generators/templates/controller.rb +4 -0
- data/lib/generators/templates/functional_test.rb +21 -0
- data/{generators/typus/templates/db/create_typus_users.rb → lib/generators/templates/migration.rb} +4 -4
- data/lib/generators/templates/model.rb +8 -0
- data/lib/generators/templates/model.yml +10 -0
- data/{generators/typus/templates/public/images/admin → lib/generators/templates/public/admin/images}/ui-icons.png +0 -0
- data/lib/generators/templates/public/admin/javascripts/application.js +6 -0
- data/lib/generators/templates/public/admin/javascripts/jquery-1.4.2.min.js +154 -0
- data/lib/generators/templates/public/admin/javascripts/jquery.rails.js +126 -0
- data/lib/generators/templates/public/admin/javascripts/jquery.searchField.js +91 -0
- data/lib/generators/templates/public/admin/stylesheets/application.css +11 -0
- data/lib/generators/templates/public/admin/stylesheets/screen.css +356 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/blank.gif +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_close.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_loading.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_nav_left.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_nav_right.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_e.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_n.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_ne.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_nw.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_s.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_se.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_sw.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_shadow_w.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_title_left.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_title_main.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancy_title_over.png +0 -0
- data/{generators/typus/templates/public/images/admin → lib/generators/templates/public/admin/vendor}/fancybox/fancy_title_right.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancybox-x.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancybox-y.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/fancybox.png +0 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/jquery.easing-1.3.pack.js +72 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/jquery.fancybox-1.3.1.css +363 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/jquery.fancybox-1.3.1.js +1077 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/jquery.fancybox-1.3.1.pack.js +44 -0
- data/lib/generators/templates/public/admin/vendor/fancybox/jquery.mousewheel-3.0.2.pack.js +13 -0
- data/lib/generators/templates/view.html.erb +9 -0
- data/lib/generators/typus/migration_generator.rb +85 -0
- data/lib/generators/typus/typus_generator.rb +190 -0
- data/lib/generators/typus/views_generator.rb +27 -0
- data/lib/support/active_record.rb +60 -0
- data/lib/support/array.rb +13 -0
- data/lib/{typus → support}/hash.rb +2 -2
- data/lib/{typus → support}/object.rb +2 -2
- data/lib/support/string.rb +47 -0
- data/lib/tasks/typus.rake +19 -0
- data/lib/typus/authentication.rb +146 -40
- data/lib/typus/configuration.rb +14 -49
- data/lib/typus/engine.rb +6 -0
- data/lib/typus/format.rb +41 -18
- data/lib/typus/orm/active_record.rb +378 -0
- data/lib/typus/resources.rb +57 -0
- data/lib/typus/user.rb +54 -37
- data/lib/typus/version.rb +3 -0
- data/lib/typus.rb +118 -80
- data/lib/vendor/paginator.rb +2 -2
- data/test/factories/assets.rb +5 -0
- data/test/factories/categories.rb +3 -0
- data/test/factories/comments.rb +6 -0
- data/test/factories/pages.rb +5 -0
- data/test/factories/pictures.rb +7 -0
- data/test/factories/posts.rb +6 -0
- data/test/factories/typus_users.rb +8 -0
- data/test/{config → fixtures/config}/broken/application.yml +0 -0
- data/test/{config → fixtures/config}/broken/application_roles.yml +0 -0
- data/test/{config/empty/empty_02_roles.yml → fixtures/config/broken/empty.yml} +0 -0
- data/test/fixtures/config/broken/empty_roles.yml +0 -0
- data/test/{config → fixtures/config}/broken/undefined.yml +0 -0
- data/test/{config → fixtures/config}/broken/undefined_roles.yml +0 -0
- data/test/{config → fixtures/config}/default/typus.yml +2 -1
- data/{generators/typus/templates/config/typus → test/fixtures/config/default}/typus_roles.yml +0 -0
- data/test/fixtures/config/empty/empty_01.yml +0 -0
- data/test/fixtures/config/empty/empty_01_roles.yml +0 -0
- data/test/fixtures/config/empty/empty_02.yml +0 -0
- data/test/fixtures/config/empty/empty_02_roles.yml +0 -0
- data/test/{config → fixtures/config}/locales/es.yml +0 -0
- data/test/fixtures/config/namespaced/application.yml +5 -0
- data/test/fixtures/config/namespaced/application_roles.yml +2 -0
- data/test/{config → fixtures/config}/ordered/001_roles.yml +0 -0
- data/test/{config → fixtures/config}/ordered/002_roles.yml +0 -0
- data/test/{config → fixtures/config}/unordered/app_one_roles.yml +0 -0
- data/test/{config → fixtures/config}/unordered/app_two_roles.yml +0 -0
- data/test/fixtures/config/working/application.yml +73 -0
- data/test/fixtures/config/working/application_roles.yml +24 -0
- data/{generators/typus/templates/config/typus → test/fixtures/config/working}/typus.yml +2 -1
- data/test/{config/default → fixtures/config/working}/typus_roles.yml +0 -0
- data/test/fixtures/rails_app/README +244 -0
- data/test/fixtures/rails_app/Rakefile +7 -0
- data/test/fixtures/rails_app/app/controllers/admin/assets_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/categories_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/comments_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/pages_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/pictures_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/posts_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/status_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/typus_users_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/admin/watch_dog_controller.rb +2 -0
- data/test/fixtures/rails_app/app/controllers/application_controller.rb +4 -0
- data/test/fixtures/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/fixtures/{app → rails_app/app}/models/asset.rb +1 -1
- data/test/fixtures/{app → rails_app/app}/models/category.rb +2 -2
- data/test/fixtures/{app → rails_app/app}/models/comment.rb +1 -1
- data/test/fixtures/{app → rails_app/app}/models/custom_user.rb +1 -1
- data/test/fixtures/{app → rails_app/app}/models/delayed/task.rb +2 -2
- data/test/fixtures/rails_app/app/models/page.rb +9 -0
- data/test/fixtures/rails_app/app/models/picture.rb +6 -0
- data/test/fixtures/{app → rails_app/app}/models/post.rb +6 -6
- data/test/fixtures/rails_app/app/models/typus_user.rb +8 -0
- data/test/fixtures/{app → rails_app/app}/models/view.rb +1 -1
- data/test/fixtures/rails_app/app/views/admin/categories/_form.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/dashboard/_sidebar.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/mailer/reset_password_link.text.erb +6 -0
- data/test/fixtures/rails_app/app/views/admin/posts/_edit.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/posts/_index.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/posts/_new.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/posts/_show.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/posts/_sidebar.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/resources/_sidebar.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/status/index.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/admin/templates/_datepicker.html.erb +1 -0
- data/test/fixtures/rails_app/app/views/layouts/application.html.erb +14 -0
- data/test/fixtures/rails_app/config/application.rb +50 -0
- data/test/fixtures/rails_app/config/boot.rb +13 -0
- data/test/fixtures/rails_app/config/database.yml +22 -0
- data/test/fixtures/rails_app/config/environment.rb +5 -0
- data/test/fixtures/rails_app/config/environments/development.rb +19 -0
- data/test/fixtures/rails_app/config/environments/production.rb +42 -0
- data/test/fixtures/rails_app/config/environments/test.rb +34 -0
- data/test/fixtures/rails_app/config/initializers/acts_as_list.rb +258 -0
- data/test/fixtures/rails_app/config/initializers/acts_as_tree.rb +98 -0
- data/test/fixtures/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/fixtures/rails_app/config/initializers/inflections.rb +10 -0
- data/test/fixtures/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/fixtures/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/fixtures/rails_app/config/initializers/session_store.rb +8 -0
- data/test/fixtures/rails_app/config/initializers/typus.rb +6 -0
- data/test/fixtures/rails_app/config/locales/en.yml +5 -0
- data/test/fixtures/rails_app/config/routes.rb +8 -0
- data/test/{config/working → fixtures/rails_app/config/typus}/application.yml +11 -9
- data/test/{config/working → fixtures/rails_app/config/typus}/application_roles.yml +0 -0
- data/{generators/typus_update_schema_to_01/templates/config → test/fixtures/rails_app/config/typus}/typus.yml +0 -0
- data/test/{config/working → fixtures/rails_app/config/typus}/typus_roles.yml +0 -0
- data/test/fixtures/rails_app/config.ru +4 -0
- data/test/fixtures/rails_app/db/seeds.rb +7 -0
- data/test/fixtures/rails_app/db/test.sqlite3 +0 -0
- data/test/fixtures/rails_app/log/test.log +4268 -0
- data/test/fixtures/rails_app/public/404.html +26 -0
- data/test/fixtures/rails_app/public/422.html +26 -0
- data/test/fixtures/rails_app/public/500.html +26 -0
- data/test/fixtures/rails_app/public/favicon.ico +0 -0
- data/test/fixtures/rails_app/public/images/rails.png +0 -0
- data/test/fixtures/rails_app/public/index.html +279 -0
- data/test/fixtures/rails_app/public/javascripts/application.js +2 -0
- data/test/fixtures/rails_app/public/javascripts/controls.js +965 -0
- data/test/fixtures/rails_app/public/javascripts/dragdrop.js +974 -0
- data/test/fixtures/rails_app/public/javascripts/effects.js +1123 -0
- data/test/fixtures/rails_app/public/javascripts/prototype.js +4874 -0
- data/test/fixtures/rails_app/public/javascripts/rails.js +118 -0
- data/test/fixtures/rails_app/public/robots.txt +5 -0
- data/test/fixtures/rails_app/script/rails +9 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100902120447.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100902120700.csv +2 -0
- data/test/functional/admin/account_controller_test.rb +90 -0
- data/test/functional/admin/dashboard_controller_http_basic_test.rb +24 -0
- data/test/functional/admin/dashboard_controller_none_test.rb +18 -0
- data/test/functional/admin/dashboard_controller_test.rb +106 -0
- data/test/functional/admin/resources_controller_assets_relationships.rb +59 -0
- data/test/functional/admin/resources_controller_categories_before_test.rb +10 -0
- data/test/functional/admin/resources_controller_categories_lists_test.rb +44 -0
- data/test/functional/admin/resources_controller_categories_views_test.rb +10 -0
- data/test/functional/admin/resources_controller_comments_toggle_test.rb +21 -0
- data/test/functional/admin/{master_controller_posts_before_test.rb → resources_controller_posts_before_test.rb} +3 -3
- data/test/functional/admin/resources_controller_posts_crud_custom_test.rb +27 -0
- data/test/functional/admin/resources_controller_posts_crud_test.rb +44 -0
- data/test/functional/admin/resources_controller_posts_formats_test.rb +39 -0
- data/test/functional/admin/resources_controller_posts_forms_test.rb +58 -0
- data/test/functional/admin/resources_controller_posts_permissions_test.rb +100 -0
- data/test/functional/admin/{master_controller_posts_relationships_test.rb → resources_controller_posts_relationships_test.rb} +25 -20
- data/test/functional/admin/resources_controller_posts_roles.rb +52 -0
- data/test/functional/admin/resources_controller_posts_views_test.rb +143 -0
- data/test/functional/admin/resources_controller_tableless_resource_test.rb +51 -0
- data/test/functional/admin/resources_controller_typus_users_test.rb +159 -0
- data/test/functional/admin/session_controller_test.rb +85 -0
- data/test/helpers/admin/dashboard_helper_test.rb +42 -0
- data/test/helpers/admin/form_helper_test.rb +52 -276
- data/test/helpers/admin/resources_helper_test.rb +52 -0
- data/test/helpers/admin/sidebar_helper_test.rb +133 -224
- data/test/helpers/admin/table_helper_test.rb +136 -144
- data/test/helpers/admin_helper_test.rb +69 -0
- data/test/lib/support/active_record_test.rb +35 -0
- data/test/lib/support/array_test.rb +15 -0
- data/test/lib/support/hash_test.rb +11 -0
- data/test/lib/support/string_test.rb +48 -0
- data/test/lib/typus/active_record_test.rb +385 -0
- data/test/lib/typus/configuration_test.rb +52 -0
- data/test/lib/typus/resource_test.rb +17 -0
- data/test/lib/typus/routes_test.rb +29 -0
- data/test/lib/typus_test.rb +72 -40
- data/test/{vendor → lib/vendor}/paginator_test.rb +7 -4
- data/test/schema.rb +28 -3
- data/test/test_helper.rb +29 -0
- data/test/unit/admin/mailer_test.rb +32 -0
- data/test/unit/typus_user_roles_test.rb +69 -61
- data/test/unit/typus_user_test.rb +56 -143
- data/typus.gemspec +18 -276
- metadata +305 -231
- data/.gitignore +0 -1
- data/AUTHORS.md +0 -34
- data/CHANGES +0 -3
- data/README.md +0 -75
- data/VERSION +0 -1
- data/app/controllers/admin/master_controller.rb +0 -394
- data/app/controllers/typus_controller.rb +0 -152
- data/app/helpers/admin/master_helper.rb +0 -104
- data/app/helpers/admin/public_helper.rb +0 -27
- data/app/helpers/typus_helper.rb +0 -181
- data/app/models/typus_mailer.rb +0 -14
- data/app/models/typus_user.rb +0 -5
- data/app/views/admin/shared/_feedback.html.erb +0 -6
- data/app/views/admin/shared/_footer.html.erb +0 -2
- data/app/views/admin/shared/_pagination.html.erb +0 -28
- data/app/views/admin/templates/_tiny_mce.html.erb +0 -2
- data/app/views/layouts/typus.html.erb +0 -29
- data/app/views/typus/dashboard.html.erb +0 -9
- data/app/views/typus/recover_password.html.erb +0 -7
- data/app/views/typus/reset_password.html.erb +0 -15
- data/app/views/typus/sign_in.html.erb +0 -9
- data/app/views/typus/sign_up.html.erb +0 -7
- data/config/locales/es.yml +0 -105
- data/config/locales/fr.yml +0 -98
- data/config/locales/language.yml.template +0 -106
- data/generators/typus/templates/auto/index.html.erb +0 -11
- data/generators/typus/templates/auto/resource_controller.rb.erb +0 -15
- data/generators/typus/templates/auto/resource_controller_test.rb.erb +0 -11
- data/generators/typus/templates/auto/resources_controller.rb.erb +0 -37
- data/generators/typus/templates/config/initializers/typus.rb +0 -34
- data/generators/typus/templates/config/typus/application.yml +0 -6
- data/generators/typus/templates/config/typus/application_roles.yml +0 -23
- data/generators/typus/templates/lib/tasks/typus_tasks.rake +0 -32
- data/generators/typus/templates/public/images/admin/fancybox/fancy_closebox.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_left.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_progress.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_right.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_e.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_n.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_ne.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_nw.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_s.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_se.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_sw.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_shadow_w.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_title_left.png +0 -0
- data/generators/typus/templates/public/images/admin/fancybox/fancy_title_main.png +0 -0
- data/generators/typus/templates/public/javascripts/admin/application.js +0 -14
- data/generators/typus/templates/public/javascripts/admin/jquery-1.3.2.min.js +0 -19
- data/generators/typus/templates/public/javascripts/admin/jquery.fancybox-1.2.1.min.js +0 -9
- data/generators/typus/templates/public/stylesheets/admin/jquery.fancybox.css +0 -315
- data/generators/typus/templates/public/stylesheets/admin/reset.css +0 -68
- data/generators/typus/templates/public/stylesheets/admin/screen.css +0 -361
- data/generators/typus/typus_generator.rb +0 -191
- data/generators/typus_update_schema_to_01/templates/migration.rb +0 -11
- data/generators/typus_update_schema_to_01/typus_update_schema_to_01_generator.rb +0 -19
- data/generators/typus_update_schema_to_02/templates/migration.rb +0 -11
- data/generators/typus_update_schema_to_02/typus_update_schema_to_02_generator.rb +0 -11
- data/lib/typus/active_record.rb +0 -323
- data/lib/typus/extensions/routes.rb +0 -15
- data/lib/typus/extensions/routes_hack.rb +0 -15
- data/lib/typus/preferences.rb +0 -11
- data/lib/typus/preview.rb +0 -76
- data/lib/typus/quick_edit.rb +0 -40
- data/lib/typus/reloader.rb +0 -14
- data/lib/typus/string.rb +0 -27
- data/lib/vendor/active_record.rb +0 -15
- data/lib/vendor/rss_parser.rb +0 -20
- data/rails/init.rb +0 -3
- data/tasks/typus_tasks.rake +0 -32
- data/test/config/working/typus.yml +0 -12
- data/test/fixtures/app/controllers/admin/assets_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/categories_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/comments_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/pages_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/posts_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/status_controller.rb +0 -6
- data/test/fixtures/app/controllers/admin/typus_users_controller.rb +0 -2
- data/test/fixtures/app/controllers/admin/watch_dog_controller.rb +0 -6
- data/test/fixtures/app/models/page.rb +0 -5
- data/test/fixtures/app/views/admin/dashboard/_content.html.erb +0 -1
- data/test/fixtures/app/views/admin/dashboard/_sidebar.html.erb +0 -1
- data/test/fixtures/app/views/admin/posts/_edit.html.erb +0 -1
- data/test/fixtures/app/views/admin/posts/_index.html.erb +0 -1
- data/test/fixtures/app/views/admin/posts/_new.html.erb +0 -1
- data/test/fixtures/app/views/admin/posts/_show.html.erb +0 -1
- data/test/fixtures/app/views/admin/posts/_sidebar.html.erb +0 -1
- data/test/fixtures/app/views/admin/resources/_sidebar.html.erb +0 -1
- data/test/fixtures/app/views/admin/shared/_footer.html.erb +0 -1
- data/test/fixtures/app/views/admin/status/index.html.erb +0 -1
- data/test/fixtures/app/views/admin/templates/_datepicker.html.erb +0 -1
- data/test/fixtures/assets.yml +0 -11
- data/test/fixtures/categories.yml +0 -14
- data/test/fixtures/comments.yml +0 -27
- data/test/fixtures/pages.yml +0 -41
- data/test/fixtures/posts.yml +0 -37
- data/test/fixtures/typus_users.yml +0 -59
- data/test/functional/admin/master_controller_assets_relationships.rb +0 -66
- data/test/functional/admin/master_controller_categories_lists_test.rb +0 -64
- data/test/functional/admin/master_controller_posts_crud_test.rb +0 -97
- data/test/functional/admin/master_controller_posts_formats_test.rb +0 -53
- data/test/functional/admin/master_controller_posts_permissions_test.rb +0 -127
- data/test/functional/admin/master_controller_posts_roles.rb +0 -50
- data/test/functional/admin/master_controller_posts_toggle_test.rb +0 -35
- data/test/functional/admin/master_controller_posts_views_test.rb +0 -209
- data/test/functional/admin/master_controller_tableless_resource_test.rb +0 -36
- data/test/functional/admin/master_controller_typus_users_test.rb +0 -211
- data/test/functional/typus_controller_test.rb +0 -342
- data/test/helper.rb +0 -51
- data/test/helpers/admin/master_helper_test.rb +0 -70
- data/test/helpers/admin/public_helper_test.rb +0 -26
- data/test/helpers/typus_helper_test.rb +0 -96
- data/test/lib/active_record_test.rb +0 -377
- data/test/lib/configuration_test.rb +0 -95
- data/test/lib/hash_test.rb +0 -11
- data/test/lib/routes_test.rb +0 -71
- data/test/lib/string_test.rb +0 -55
- data/test/unit/typus_mailer_test.rb +0 -29
- data/test/unit/typus_test.rb +0 -17
- data/test/vendor/active_record_test.rb +0 -18
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class Admin::SessionControllerTest < ActionController::TestCase
|
|
4
|
+
|
|
5
|
+
context "Setup" do
|
|
6
|
+
|
|
7
|
+
should "redirect_to_new_admin_account_when_no_admin_users" do
|
|
8
|
+
get :new
|
|
9
|
+
assert_response :redirect
|
|
10
|
+
assert_redirected_to new_admin_account_path
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context "With users" do
|
|
16
|
+
|
|
17
|
+
setup do
|
|
18
|
+
@typus_user = Factory(:typus_user)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
should "render new" do
|
|
22
|
+
get :new
|
|
23
|
+
assert_response :success
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
should "render new and verify title and header" do
|
|
27
|
+
get :new
|
|
28
|
+
assert_select "title", "Sign in"
|
|
29
|
+
assert_select "h1", "Typus"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
should "render new inside account layout" do
|
|
33
|
+
get :new
|
|
34
|
+
assert_match "layouts/admin/session", @controller.inspect
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "verify_typus_sign_in_layout_does_not_include_recover_password_link" do
|
|
38
|
+
get :new
|
|
39
|
+
assert !@response.body.include?("Recover password")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
should "verify new includes recover_password_link when mailer_sender is set" do
|
|
43
|
+
Typus.expects(:mailer_sender).returns("john@example.com")
|
|
44
|
+
get :new
|
|
45
|
+
assert @response.body.include?("Recover password")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
should "not_create_session_for_invalid_users" do
|
|
49
|
+
post :create, { :typus_user => { :email => "john@example.com", :password => "XXXXXXXX" } }
|
|
50
|
+
|
|
51
|
+
assert_response :redirect
|
|
52
|
+
assert_redirected_to new_admin_session_path
|
|
53
|
+
assert_equal "The email and/or password you entered is invalid.", flash[:alert]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
should "not_create_session_for_a_disabled_user" do
|
|
57
|
+
typus_user = Factory(:typus_user, :email => "disabled@example.com", :status => false)
|
|
58
|
+
|
|
59
|
+
post :create, { :typus_user => { :email => typus_user.email, :password => "12345678" } }
|
|
60
|
+
|
|
61
|
+
assert @request.session[:typus_user_id].nil?
|
|
62
|
+
assert_response :redirect
|
|
63
|
+
assert_redirected_to new_admin_session_path
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
should "create_session_for_an_enabled_user" do
|
|
67
|
+
post :create, { :typus_user => { :email => @typus_user.email, :password => "12345678" } }
|
|
68
|
+
|
|
69
|
+
assert_equal @typus_user.id, @request.session[:typus_user_id]
|
|
70
|
+
assert_response :redirect
|
|
71
|
+
assert_redirected_to admin_dashboard_path
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
should "destroy" do
|
|
75
|
+
delete :destroy
|
|
76
|
+
|
|
77
|
+
assert @request.session[:typus_user_id].nil?
|
|
78
|
+
assert_response :redirect
|
|
79
|
+
assert_redirected_to new_admin_session_path
|
|
80
|
+
assert flash.empty?
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class Admin::DashboardHelperTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
include Admin::DashboardHelper
|
|
6
|
+
|
|
7
|
+
include ActionView::Helpers::UrlHelper
|
|
8
|
+
include ActionView::Helpers::TextHelper
|
|
9
|
+
|
|
10
|
+
def render(*args); args; end
|
|
11
|
+
|
|
12
|
+
=begin
|
|
13
|
+
|
|
14
|
+
# FIXME: Pending to verify the applications included. Use the keys.
|
|
15
|
+
should "render applications" do
|
|
16
|
+
@current_user = Factory(:typus_user)
|
|
17
|
+
|
|
18
|
+
output = applications
|
|
19
|
+
partial = "admin/helpers/dashboard/applications"
|
|
20
|
+
options = { :applications => { [ "Site", [ "Asset", "Page" ] ] => nil,
|
|
21
|
+
[ "System", [ "Delayed::Task" ] ] => nil,
|
|
22
|
+
[ "Blog", [ "Comment", "Post" ] ] => nil,
|
|
23
|
+
[ "Typus", [ "TypusUser" ] ] => nil } }
|
|
24
|
+
|
|
25
|
+
assert_equal partial, output.first
|
|
26
|
+
assert_equal options, output.last
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
=end
|
|
30
|
+
|
|
31
|
+
should "render resources" do
|
|
32
|
+
@current_user = Factory(:typus_user)
|
|
33
|
+
|
|
34
|
+
output = resources
|
|
35
|
+
partial = "admin/helpers/dashboard/resources"
|
|
36
|
+
options = { :resources => ["Git", "Status", "WatchDog"] }
|
|
37
|
+
|
|
38
|
+
assert_equal partial, output.first
|
|
39
|
+
assert_equal options, output.last
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "test_helper"
|
|
2
2
|
|
|
3
3
|
class Admin::FormHelperTest < ActiveSupport::TestCase
|
|
4
4
|
|
|
5
5
|
include Admin::FormHelper
|
|
6
|
-
include Admin::
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
include ActionView::Helpers::FormTagHelper
|
|
10
|
-
include ActionView::Helpers::FormOptionsHelper
|
|
11
|
-
include ActionView::Helpers::DateHelper
|
|
12
|
-
include ActionView::Helpers::UrlHelper
|
|
13
|
-
include ActionView::Helpers::TagHelper
|
|
14
|
-
include ActionController::UrlWriter
|
|
15
|
-
|
|
16
|
-
# FIXME
|
|
17
|
-
def test_build_form
|
|
18
|
-
return
|
|
19
|
-
end
|
|
6
|
+
include Admin::ResourcesHelper
|
|
7
|
+
|
|
8
|
+
=begin
|
|
20
9
|
|
|
10
|
+
# FIXME: Problem with params number. A form option has to be sent.
|
|
21
11
|
def test_typus_belongs_to_field
|
|
22
12
|
|
|
23
13
|
params = { :controller => 'admin/post', :id => 1, :action => :create }
|
|
24
|
-
self.
|
|
14
|
+
self.stubs(:params).returns(params)
|
|
25
15
|
|
|
26
16
|
@current_user = mock()
|
|
27
|
-
@current_user.
|
|
28
|
-
@resource =
|
|
17
|
+
@current_user.stubs(:can?).with('create', Post).returns(false)
|
|
18
|
+
@resource = Comment
|
|
29
19
|
|
|
30
20
|
expected = <<-HTML
|
|
31
|
-
<li><label for="
|
|
21
|
+
<li><label for="comment_post">Post
|
|
32
22
|
<small></small>
|
|
33
23
|
</label>
|
|
34
|
-
<select id="
|
|
24
|
+
<select id="comment_post_id" name="comment[post_id]"><option value=""></option>
|
|
35
25
|
<option value="3">Post#3</option>
|
|
36
26
|
<option value="4">Post#4</option>
|
|
37
27
|
<option value="1">Post#1</option>
|
|
@@ -42,294 +32,78 @@ class Admin::FormHelperTest < ActiveSupport::TestCase
|
|
|
42
32
|
|
|
43
33
|
end
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
=end
|
|
36
|
+
|
|
37
|
+
=begin
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
# FIXME: Problem with the number of attributes.
|
|
40
|
+
def test_typus_belongs_to_field_with_different_attribute_name
|
|
48
41
|
|
|
49
42
|
params = { :controller => 'admin/post', :id => 1, :action => :edit }
|
|
50
|
-
self.
|
|
43
|
+
self.stubs(:params).returns(params)
|
|
51
44
|
|
|
52
45
|
@current_user = mock()
|
|
53
|
-
@current_user.
|
|
54
|
-
@resource =
|
|
46
|
+
@current_user.stubs(:can?).with('create', Comment).returns(true)
|
|
47
|
+
@resource = Post
|
|
55
48
|
|
|
56
49
|
expected = <<-HTML
|
|
57
|
-
<li><label for="
|
|
50
|
+
<li><label for="post_favorite_comment">Favorite comment
|
|
58
51
|
<small><a href="http://test.host/admin/comments/new?back_to=%2Fadmin%2Fpost%2Fedit%2F1&selected=favorite_comment_id" onclick="return confirm('Are you sure you want to leave this page?\\n\\nIf you have made any changes to the fields without clicking the Save/Update entry button, your changes will be lost.\\n\\nClick OK to continue, or click Cancel to stay on this page.');">Add</a></small>
|
|
59
52
|
</label>
|
|
60
|
-
<select id="
|
|
53
|
+
<select id="post_favorite_comment_id" name="post[favorite_comment_id]"><option value=""></option>
|
|
61
54
|
<option value="1">John</option>
|
|
62
55
|
<option value="2">Me</option>
|
|
63
56
|
<option value="3">John</option>
|
|
64
57
|
<option value="4">Me</option></select></li>
|
|
65
58
|
HTML
|
|
66
|
-
assert_equal expected, typus_belongs_to_field('favorite_comment')
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# FIXME
|
|
71
|
-
def test_typus_template_field_for_boolean_fields
|
|
72
|
-
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
@resource = { :class => Post }
|
|
76
|
-
|
|
77
|
-
expected = <<-HTML
|
|
78
|
-
<li><label>Test</label>
|
|
79
|
-
<input name="item[test]" type="hidden" value="0" /><input id="item_test" name="item[test]" type="checkbox" value="1" /> <label class=\"inline_label\" for=\"item_test\">Checked if active</label></li>
|
|
80
|
-
HTML
|
|
81
|
-
|
|
82
|
-
assert_equal expected, typus_template_field('test', 'boolean')
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# FIXME
|
|
87
|
-
def test_typus_template_field_for_date_fields
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
@resource = { :class => Post }
|
|
92
|
-
|
|
93
|
-
expected = <<-HTML
|
|
94
|
-
<li><label for="item_test">Test</label>
|
|
95
|
-
HTML
|
|
96
|
-
|
|
97
|
-
assert_equal expected, typus_template_field('test', 'date')
|
|
98
|
-
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# FIXME
|
|
102
|
-
def test_typus_template_field_for_datetime_fields
|
|
103
|
-
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
@resource = { :class => Post }
|
|
107
|
-
|
|
108
|
-
expected = <<-HTML
|
|
109
|
-
<li><label for="item_test">Test</label>
|
|
110
|
-
HTML
|
|
111
|
-
|
|
112
|
-
assert_equal expected, typus_template_field('test', 'datetime')
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
# FIXME
|
|
117
|
-
def test_typus_template_field_for_file_fields
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
@resource = { :class => Post }
|
|
122
|
-
@item = Post.new
|
|
123
|
-
|
|
124
|
-
expected = <<-HTML
|
|
125
|
-
<li><label for="item_asset_file_name">Asset</label>
|
|
126
|
-
<input id="item_asset" name="item[asset]" size="30" type="file" />
|
|
127
|
-
|
|
128
|
-
</li>
|
|
129
|
-
HTML
|
|
130
|
-
|
|
131
|
-
assert_equal expected, typus_template_field('asset_file_name', 'file')
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# FIXME
|
|
136
|
-
def test_typus_template_field_for_password_fields
|
|
137
|
-
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
@resource = { :class => Post }
|
|
141
|
-
|
|
142
|
-
expected = <<-HTML
|
|
143
|
-
<li><label for="item_test">Test</label>
|
|
144
|
-
<input class="text" id="item_test" name="item[test]" size="30" type="password" /></li>
|
|
145
|
-
HTML
|
|
146
|
-
|
|
147
|
-
assert_equal expected, typus_template_field('test', 'password')
|
|
148
|
-
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
# FIXME
|
|
152
|
-
def test_typus_template_field_for_selector_fields
|
|
153
|
-
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
@resource = { :class => Post }
|
|
157
|
-
@item = posts(:published)
|
|
158
|
-
|
|
159
|
-
expected = <<-HTML
|
|
160
|
-
<li><label for="item_status">Status</label>
|
|
161
|
-
<select id="item_status" name="item[status]">
|
|
162
|
-
<option value=""></option>
|
|
163
|
-
<option selected value="true">true</option>
|
|
164
|
-
<option value="false">false</option>
|
|
165
|
-
<option value="pending">pending</option>
|
|
166
|
-
<option value="published">published</option>
|
|
167
|
-
<option value="unpublished">unpublished</option>
|
|
168
|
-
</select></li>
|
|
169
|
-
HTML
|
|
170
|
-
|
|
171
|
-
assert_equal expected, typus_template_field('test', 'selector')
|
|
172
|
-
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
# FIXME
|
|
176
|
-
def test_typus_template_field_for_text_fields
|
|
177
|
-
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
@resource = { :class => Post }
|
|
181
|
-
|
|
182
|
-
expected = <<-HTML
|
|
183
|
-
<li><label for="item_test">Test</label>
|
|
184
|
-
<textarea class="text" cols="40" id="item_test" name="item[test]" rows="10"></textarea></li>
|
|
185
|
-
HTML
|
|
186
59
|
|
|
187
|
-
assert_equal expected,
|
|
60
|
+
assert_equal expected, typus_belongs_to_field('favorite_comment')
|
|
188
61
|
|
|
189
62
|
end
|
|
190
63
|
|
|
191
|
-
|
|
192
|
-
def test_typus_template_field_for_time_fields
|
|
193
|
-
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
@resource = { :class => Post }
|
|
197
|
-
|
|
198
|
-
expected = <<-HTML
|
|
199
|
-
<li><label for="item_test">Test</label>
|
|
200
|
-
HTML
|
|
64
|
+
=end
|
|
201
65
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
end
|
|
66
|
+
=begin
|
|
205
67
|
|
|
68
|
+
# FIXME: Problem with the number of params.
|
|
206
69
|
def test_typus_tree_field
|
|
207
70
|
|
|
208
|
-
return if !defined?(ActiveRecord::Acts::Tree)
|
|
209
|
-
|
|
210
71
|
self.stubs(:expand_tree_into_select_field).returns('expand_tree_into_select_field')
|
|
211
72
|
|
|
212
|
-
@resource =
|
|
213
|
-
items = @resource[:class].roots
|
|
73
|
+
@resource = Page
|
|
214
74
|
|
|
215
75
|
expected = <<-HTML
|
|
216
|
-
<li><label for="
|
|
217
|
-
<select id="
|
|
76
|
+
<li><label for="page_parent">Parent</label>
|
|
77
|
+
<select id="page_parent" name="page[parent]">
|
|
218
78
|
<option value=""></option>
|
|
219
79
|
expand_tree_into_select_field
|
|
220
80
|
</select></li>
|
|
221
81
|
HTML
|
|
222
82
|
|
|
223
|
-
assert_equal expected, typus_tree_field('parent'
|
|
83
|
+
assert_equal expected, typus_tree_field('parent')
|
|
224
84
|
|
|
225
85
|
end
|
|
226
86
|
|
|
227
|
-
|
|
228
|
-
def test_typus_string_field
|
|
229
|
-
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
@resource = { :class => Post }
|
|
233
|
-
|
|
234
|
-
expected = <<-HTML
|
|
235
|
-
<li><label for="item_test">Test</label>
|
|
236
|
-
<input class="text" id="item_test" name="item[test]" size="30" type="text" /></li>
|
|
237
|
-
HTML
|
|
87
|
+
=end
|
|
238
88
|
|
|
239
|
-
|
|
89
|
+
=begin
|
|
240
90
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
# FIXME
|
|
244
|
-
def test_typus_relationships
|
|
245
|
-
return
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
# FIXME
|
|
249
|
-
def test_typus_form_has_many_with_items
|
|
250
|
-
|
|
251
|
-
return
|
|
252
|
-
|
|
253
|
-
@current_user = typus_users(:admin)
|
|
254
|
-
@resource = { :class => Post, :self => 'posts' }
|
|
255
|
-
@item = Post.find(1)
|
|
256
|
-
|
|
257
|
-
params = { :controller => 'admin/posts', :id => 1, :action => 'edit' }
|
|
258
|
-
self.expects(:params).at_least_once.returns(params)
|
|
259
|
-
|
|
260
|
-
self.stubs(:build_list).returns('<!-- a_nice_list -->')
|
|
261
|
-
|
|
262
|
-
output = typus_form_has_many('comments')
|
|
263
|
-
expected = <<-HTML
|
|
264
|
-
<a name="comments"></a>
|
|
265
|
-
<div class="box_relationships">
|
|
266
|
-
<h2>
|
|
267
|
-
<a href="http://test.host/admin/comments" title="Comments filtered by Post#1">Comments</a>
|
|
268
|
-
<small><a href="http://test.host/admin/comments/new?back_to=%23comments&resource=post&resource_id=1">Add new</a></small>
|
|
269
|
-
</h2>
|
|
270
|
-
<!-- a_nice_list --></div>
|
|
271
|
-
HTML
|
|
272
|
-
|
|
273
|
-
assert_equal expected, output
|
|
274
|
-
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
# FIXME
|
|
278
|
-
def test_typus_form_has_many_without_items
|
|
279
|
-
|
|
280
|
-
return
|
|
281
|
-
|
|
282
|
-
@current_user = typus_users(:admin)
|
|
283
|
-
@resource = { :class => Post, :self => 'posts' }
|
|
284
|
-
@item = Post.find(1)
|
|
285
|
-
@item.comments.destroy_all
|
|
286
|
-
|
|
287
|
-
params = { :controller => 'admin/posts', :id => 1, :action => 'edit' }
|
|
288
|
-
self.expects(:params).at_least_once.returns(params)
|
|
289
|
-
|
|
290
|
-
output = typus_form_has_many('comments')
|
|
291
|
-
expected = <<-HTML
|
|
292
|
-
<a name="comments"></a>
|
|
293
|
-
<div class="box_relationships">
|
|
294
|
-
<h2>
|
|
295
|
-
<a href="http://test.host/admin/comments" title="Comments filtered by Post#1">Comments</a>
|
|
296
|
-
<small><a href="http://test.host/admin/comments/new?back_to=%23comments&resource=post&resource_id=1">Add new</a></small>
|
|
297
|
-
</h2>
|
|
298
|
-
<div id="flash" class="notice"><p>There are no comments.</p></div>
|
|
299
|
-
</div>
|
|
300
|
-
HTML
|
|
301
|
-
|
|
302
|
-
assert_equal expected, output
|
|
303
|
-
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
# FIXME
|
|
307
|
-
def test_typus_form_has_and_belongs_to_many
|
|
308
|
-
return
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
# FIXME
|
|
312
|
-
def test_typus_template_field
|
|
313
|
-
return
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
def test_attribute_disabled
|
|
317
|
-
|
|
318
|
-
@resource = { :class => Post }
|
|
91
|
+
# FIXME: Attribute disabled
|
|
319
92
|
|
|
93
|
+
should "verify attribute_disabled" do
|
|
94
|
+
@resource = Post
|
|
320
95
|
assert !attribute_disabled?('test')
|
|
321
|
-
|
|
322
96
|
Post.expects(:accessible_attributes).returns(['test'])
|
|
323
97
|
assert !attribute_disabled?('test')
|
|
324
|
-
|
|
325
98
|
Post.expects(:accessible_attributes).returns(['no_test'])
|
|
326
99
|
assert attribute_disabled?('test')
|
|
327
|
-
|
|
328
100
|
end
|
|
329
101
|
|
|
330
|
-
|
|
102
|
+
=end
|
|
331
103
|
|
|
332
|
-
|
|
104
|
+
=begin
|
|
105
|
+
|
|
106
|
+
def test_expand_tree_into_select_field
|
|
333
107
|
|
|
334
108
|
items = Page.roots
|
|
335
109
|
|
|
@@ -338,12 +112,12 @@ class Admin::FormHelperTest < ActiveSupport::TestCase
|
|
|
338
112
|
@item = Page.find(1)
|
|
339
113
|
output = expand_tree_into_select_field(items, 'parent_id')
|
|
340
114
|
expected = <<-HTML
|
|
341
|
-
<option value="1"> &#
|
|
342
|
-
<option value="2">  
|
|
343
|
-
<option value="3"> &#
|
|
344
|
-
<option value="4">  
|
|
345
|
-
<option value="5">  
|
|
346
|
-
<option value="6">  
|
|
115
|
+
<option value="1"> ↳ Page#1</option>
|
|
116
|
+
<option value="2"> ↳ Page#2</option>
|
|
117
|
+
<option value="3"> ↳ Page#3</option>
|
|
118
|
+
<option value="4"> ↳ Page#4</option>
|
|
119
|
+
<option value="5"> ↳ Page#5</option>
|
|
120
|
+
<option value="6"> ↳ Page#6</option>
|
|
347
121
|
HTML
|
|
348
122
|
assert_equal expected, output
|
|
349
123
|
|
|
@@ -352,15 +126,17 @@ class Admin::FormHelperTest < ActiveSupport::TestCase
|
|
|
352
126
|
@item = Page.find(4)
|
|
353
127
|
output = expand_tree_into_select_field(items, 'parent_id')
|
|
354
128
|
expected = <<-HTML
|
|
355
|
-
<option value="1"> &#
|
|
356
|
-
<option value="2">  
|
|
357
|
-
<option selected value="3"> &#
|
|
358
|
-
<option value="4">  
|
|
359
|
-
<option value="5">  
|
|
360
|
-
<option value="6">  
|
|
129
|
+
<option value="1"> ↳ Page#1</option>
|
|
130
|
+
<option value="2"> ↳ Page#2</option>
|
|
131
|
+
<option selected value="3"> ↳ Page#3</option>
|
|
132
|
+
<option value="4"> ↳ Page#4</option>
|
|
133
|
+
<option value="5"> ↳ Page#5</option>
|
|
134
|
+
<option value="6"> ↳ Page#6</option>
|
|
361
135
|
HTML
|
|
362
136
|
assert_equal expected, output
|
|
363
137
|
|
|
364
138
|
end
|
|
365
139
|
|
|
366
|
-
end
|
|
140
|
+
=end
|
|
141
|
+
|
|
142
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class Admin::ResourcesHelperTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
include Admin::ResourcesHelper
|
|
6
|
+
|
|
7
|
+
include ActionView::Helpers::UrlHelper
|
|
8
|
+
include ActionView::Helpers::TagHelper
|
|
9
|
+
|
|
10
|
+
def render(*args); args; end
|
|
11
|
+
|
|
12
|
+
should "verify display_link_to_previous" do
|
|
13
|
+
@resource = Post
|
|
14
|
+
params = { :action => "edit", :back_to => "/back_to_param" }
|
|
15
|
+
self.expects(:params).at_least_once.returns(params)
|
|
16
|
+
|
|
17
|
+
partial = "admin/helpers/resources/display_link_to_previous"
|
|
18
|
+
options = { :message => "You're updating a Post." }
|
|
19
|
+
|
|
20
|
+
assert_equal [ partial, options ], display_link_to_previous
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
should "remove_filter_link" do
|
|
24
|
+
output = remove_filter_link("")
|
|
25
|
+
assert output.nil?
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "Build list" do
|
|
29
|
+
|
|
30
|
+
setup do
|
|
31
|
+
@model = TypusUser
|
|
32
|
+
@fields = %w( email role status )
|
|
33
|
+
@items = TypusUser.all
|
|
34
|
+
@resource = "typus_users"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
should "verify build_list_when_returns_a_table" do
|
|
38
|
+
self.stubs(:build_table).returns("a_list_with_items")
|
|
39
|
+
output = build_list(@model, @fields, @items, @resource)
|
|
40
|
+
assert_equal "a_list_with_items", output
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
should "verify build_list_when_returns_a_template" do
|
|
44
|
+
self.stubs(:render).returns("a_template")
|
|
45
|
+
File.stubs(:exist?).returns(true)
|
|
46
|
+
output = build_list(@model, @fields, @items, @resource)
|
|
47
|
+
assert_equal "a_template", output
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|