typus 0.9.39 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/typus/active_record.rb
DELETED
@@ -1,323 +0,0 @@
|
|
1
|
-
module Typus
|
2
|
-
|
3
|
-
def self.included(base)
|
4
|
-
base.extend ClassMethods
|
5
|
-
end
|
6
|
-
|
7
|
-
module ClassMethods
|
8
|
-
|
9
|
-
# Return model fields as a OrderedHash
|
10
|
-
def model_fields
|
11
|
-
hash = ActiveSupport::OrderedHash.new
|
12
|
-
columns.map { |u| hash[u.name.to_sym] = u.type.to_sym }
|
13
|
-
return hash
|
14
|
-
end
|
15
|
-
|
16
|
-
def model_relationships
|
17
|
-
hash = ActiveSupport::OrderedHash.new
|
18
|
-
reflect_on_all_associations.map { |i| hash[i.name] = i.macro }
|
19
|
-
return hash
|
20
|
-
end
|
21
|
-
|
22
|
-
##
|
23
|
-
# This method is used to change a Rails behavior.
|
24
|
-
#
|
25
|
-
# typus $ script/console
|
26
|
-
# Loading development environment (Rails 2.3.2)
|
27
|
-
# >> TypusUser.human_name
|
28
|
-
# => "Typususer"
|
29
|
-
# >> TypusUser.typus_human_name
|
30
|
-
# => "Typus user"
|
31
|
-
#
|
32
|
-
def typus_human_name
|
33
|
-
human_name(:default => self.name.underscore.humanize)
|
34
|
-
end
|
35
|
-
|
36
|
-
def typus_description
|
37
|
-
Typus::Configuration.config[self.name]['description']
|
38
|
-
end
|
39
|
-
|
40
|
-
# Form and list fields
|
41
|
-
def typus_fields_for(filter)
|
42
|
-
|
43
|
-
fields_with_type = ActiveSupport::OrderedHash.new
|
44
|
-
|
45
|
-
begin
|
46
|
-
fields = Typus::Configuration.config[name]['fields'][filter.to_s]
|
47
|
-
fields = fields.split(', ').collect { |f| f.to_sym }
|
48
|
-
rescue
|
49
|
-
return [] if filter == 'list'
|
50
|
-
filter = 'list'
|
51
|
-
retry
|
52
|
-
end
|
53
|
-
|
54
|
-
begin
|
55
|
-
|
56
|
-
fields.each do |field|
|
57
|
-
|
58
|
-
attribute_type = model_fields[field]
|
59
|
-
|
60
|
-
# Custom field_type depending on the attribute name.
|
61
|
-
case field.to_s
|
62
|
-
when 'parent_id' then attribute_type = :tree
|
63
|
-
when /file_name/ then attribute_type = :file
|
64
|
-
when /password/ then attribute_type = :password
|
65
|
-
when 'position' then attribute_type = :position
|
66
|
-
end
|
67
|
-
|
68
|
-
if reflect_on_association(field)
|
69
|
-
attribute_type = reflect_on_association(field).macro
|
70
|
-
end
|
71
|
-
|
72
|
-
if typus_field_options_for(:selectors).include?(field)
|
73
|
-
attribute_type = :selector
|
74
|
-
end
|
75
|
-
|
76
|
-
if typus_tiny_mce_fields.include?(field.to_s)
|
77
|
-
attribute_type = :tiny_mce
|
78
|
-
end
|
79
|
-
|
80
|
-
# And finally insert the field and the attribute_type
|
81
|
-
# into the fields_with_type ordered hash.
|
82
|
-
fields_with_type[field.to_s] = attribute_type
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
rescue
|
87
|
-
fields = Typus::Configuration.config[name]['fields']['list'].split(', ')
|
88
|
-
retry
|
89
|
-
end
|
90
|
-
|
91
|
-
return fields_with_type
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
# Return tiny_mce options of the model merged into the default options
|
96
|
-
def typus_tiny_mce_options
|
97
|
-
typus_options_for(:tiny_mce).merge(Typus::Configuration.config[name]['fields']['options']['tiny_mce']['options'].symbolize_keys.delete_if { |key,value| value == nil})
|
98
|
-
rescue
|
99
|
-
typus_options_for(:tiny_mce)
|
100
|
-
end
|
101
|
-
|
102
|
-
# Tiny_mce fields of the model
|
103
|
-
def typus_tiny_mce_fields
|
104
|
-
Typus::Configuration.config[name]['fields']['options']['tiny_mce']['fields'].split(', ')
|
105
|
-
rescue
|
106
|
-
[]
|
107
|
-
end
|
108
|
-
|
109
|
-
# Typus sidebar filters.
|
110
|
-
def typus_filters
|
111
|
-
|
112
|
-
fields_with_type = ActiveSupport::OrderedHash.new
|
113
|
-
|
114
|
-
data = Typus::Configuration.config[name]['filters']
|
115
|
-
return [] unless data
|
116
|
-
fields = data.split(', ').collect { |i| i.to_sym }
|
117
|
-
|
118
|
-
fields.each do |field|
|
119
|
-
attribute_type = model_fields[field.to_sym]
|
120
|
-
if reflect_on_association(field.to_sym)
|
121
|
-
attribute_type = reflect_on_association(field.to_sym).macro
|
122
|
-
end
|
123
|
-
fields_with_type[field.to_s] = attribute_type
|
124
|
-
end
|
125
|
-
|
126
|
-
return fields_with_type
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
# Extended actions for this model on Typus.
|
131
|
-
def typus_actions_for(filter)
|
132
|
-
Typus::Configuration.config[name]['actions'][filter.to_s].split(', ')
|
133
|
-
rescue
|
134
|
-
[]
|
135
|
-
end
|
136
|
-
|
137
|
-
# Used for +search+, +relationships+
|
138
|
-
def typus_defaults_for(filter)
|
139
|
-
data = Typus::Configuration.config[name][filter.to_s]
|
140
|
-
return (!data.nil?) ? data.split(', ') : []
|
141
|
-
end
|
142
|
-
|
143
|
-
def typus_field_options_for(filter)
|
144
|
-
Typus::Configuration.config[name]['fields']['options'][filter.to_s].split(', ').collect { |i| i.to_sym }
|
145
|
-
rescue
|
146
|
-
[]
|
147
|
-
end
|
148
|
-
|
149
|
-
# We should be able to overwrite options by model.
|
150
|
-
def typus_options_for(filter)
|
151
|
-
|
152
|
-
data = Typus::Configuration.config[name]
|
153
|
-
unless data['options'].nil?
|
154
|
-
value = data['options'][filter.to_s] unless data['options'][filter.to_s].nil?
|
155
|
-
end
|
156
|
-
|
157
|
-
return (!value.nil?) ? value : Typus::Configuration.options[filter.to_sym]
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
def typus_export_formats
|
162
|
-
data = Typus::Configuration.config[name]
|
163
|
-
!data['export'].nil? ? data['export'].split(', ') : []
|
164
|
-
end
|
165
|
-
|
166
|
-
# Used for `order_by`.
|
167
|
-
def typus_order_by
|
168
|
-
|
169
|
-
fields = typus_defaults_for(:order_by)
|
170
|
-
|
171
|
-
order = if fields.empty?
|
172
|
-
"#{table_name}.id ASC"
|
173
|
-
else
|
174
|
-
fields.map do |field|
|
175
|
-
field.include?('-') ? "#{table_name}.#{field.delete('-')} DESC" : "#{table_name}.#{field} ASC"
|
176
|
-
end.join(', ')
|
177
|
-
end
|
178
|
-
|
179
|
-
return order
|
180
|
-
|
181
|
-
end
|
182
|
-
|
183
|
-
# We are able to define our own booleans.
|
184
|
-
def typus_boolean(attribute = :default)
|
185
|
-
|
186
|
-
boolean = Typus::Configuration.config[name]['fields']['options']['booleans'][attribute.to_s] rescue nil
|
187
|
-
boolean = 'true, false' if boolean.nil?
|
188
|
-
|
189
|
-
hash = ActiveSupport::OrderedHash.new
|
190
|
-
|
191
|
-
if boolean.kind_of?(Array)
|
192
|
-
hash[:true] = boolean.first.humanize
|
193
|
-
hash[:false] = boolean.last.humanize
|
194
|
-
else
|
195
|
-
hash[:true] = boolean.split(', ').first.humanize
|
196
|
-
hash[:false] = boolean.split(', ').last.humanize
|
197
|
-
end
|
198
|
-
|
199
|
-
return hash
|
200
|
-
|
201
|
-
end
|
202
|
-
|
203
|
-
# We are able to define how to display dates on Typus
|
204
|
-
def typus_date_format(attribute = :default)
|
205
|
-
date_format = Typus::Configuration.config[name]['fields']['options']['date_formats'][attribute.to_s].to_sym rescue nil
|
206
|
-
return !date_format.nil? ? date_format : :db
|
207
|
-
end
|
208
|
-
|
209
|
-
# We are able to define which template to use to render the attribute
|
210
|
-
# within the form
|
211
|
-
def typus_template(attribute)
|
212
|
-
Typus::Configuration.config[name]['fields']['options']['templates'][attribute.to_s] rescue nil
|
213
|
-
end
|
214
|
-
|
215
|
-
def build_conditions(params)
|
216
|
-
|
217
|
-
conditions, joins = merge_conditions, []
|
218
|
-
|
219
|
-
query_params = params.dup
|
220
|
-
%w( action controller ).each { |param| query_params.delete(param) }
|
221
|
-
|
222
|
-
# If a search is performed.
|
223
|
-
if query_params[:search]
|
224
|
-
search = typus_defaults_for(:search).map do |s|
|
225
|
-
["LOWER(#{s}) LIKE '%#{ActiveRecord::Base.connection.quote_string(query_params[:search].downcase)}%'"]
|
226
|
-
end
|
227
|
-
conditions = merge_conditions(conditions, search.join(' OR '))
|
228
|
-
end
|
229
|
-
|
230
|
-
query_params.each do |key, value|
|
231
|
-
|
232
|
-
filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym]
|
233
|
-
|
234
|
-
##
|
235
|
-
# Sidebar filters:
|
236
|
-
#
|
237
|
-
# - Booleans: true, false
|
238
|
-
# - Datetime: today, last_few_days, last_7_days, last_30_days
|
239
|
-
# - Integer & String: *_id and "selectors" (p.ej. category_id)
|
240
|
-
#
|
241
|
-
# today last_few_days last_7_days last_30_days
|
242
|
-
#
|
243
|
-
case filter_type
|
244
|
-
when :boolean
|
245
|
-
condition = { key => (value == 'true') ? true : false }
|
246
|
-
conditions = merge_conditions(conditions, condition)
|
247
|
-
when :datetime
|
248
|
-
interval = case value
|
249
|
-
when 'today' then Time.new.midnight..Time.new.midnight.tomorrow
|
250
|
-
when 'last_few_days' then 3.days.ago.midnight..Time.new.midnight.tomorrow
|
251
|
-
when 'last_7_days' then 6.days.ago.midnight..Time.new.midnight.tomorrow
|
252
|
-
when 'last_30_days' then Time.new.midnight.last_month..Time.new.midnight.tomorrow
|
253
|
-
end
|
254
|
-
condition = ["#{key} BETWEEN ? AND ?", interval.first.to_s(:db), interval.last.to_s(:db)]
|
255
|
-
conditions = merge_conditions(conditions, condition)
|
256
|
-
when :integer, :string
|
257
|
-
condition = { key => value }
|
258
|
-
conditions = merge_conditions(conditions, condition)
|
259
|
-
when :has_and_belongs_to_many
|
260
|
-
condition = { key => { :id => value } }
|
261
|
-
conditions = merge_conditions(conditions, condition)
|
262
|
-
joins << key.to_sym
|
263
|
-
end
|
264
|
-
|
265
|
-
end
|
266
|
-
|
267
|
-
return conditions, joins
|
268
|
-
|
269
|
-
end
|
270
|
-
|
271
|
-
def typus_user_id?
|
272
|
-
columns.map { |u| u.name }.include?(Typus.user_fk)
|
273
|
-
end
|
274
|
-
|
275
|
-
end
|
276
|
-
|
277
|
-
module InstanceMethods
|
278
|
-
|
279
|
-
def previous_and_next(condition = {}, klass = self.class)
|
280
|
-
|
281
|
-
previous_conditions = "#{klass.primary_key} < #{quote_value(id)}"
|
282
|
-
next_conditions = "#{klass.primary_key} > #{quote_value(id)}"
|
283
|
-
|
284
|
-
if !condition.empty?
|
285
|
-
conditions, joins = klass.build_conditions(condition)
|
286
|
-
previous_conditions += " AND #{conditions}"
|
287
|
-
next_conditions += " AND #{conditions}"
|
288
|
-
end
|
289
|
-
|
290
|
-
select = !klass.typus_user_id? ? klass.primary_key : "#{klass.primary_key}, #{Typus.user_fk}"
|
291
|
-
|
292
|
-
previous_ = klass.send(:with_exclusive_scope) do
|
293
|
-
klass.find :first,
|
294
|
-
:select => select,
|
295
|
-
:order => "#{klass.primary_key} DESC",
|
296
|
-
:conditions => previous_conditions
|
297
|
-
end
|
298
|
-
|
299
|
-
next_ = klass.send(:with_exclusive_scope) do
|
300
|
-
klass.find :first,
|
301
|
-
:select => select,
|
302
|
-
:order => "#{klass.primary_key} ASC",
|
303
|
-
:conditions => next_conditions
|
304
|
-
end
|
305
|
-
|
306
|
-
return previous_, next_
|
307
|
-
|
308
|
-
end
|
309
|
-
|
310
|
-
def typus_name
|
311
|
-
respond_to?(:name) ? name : "#{self.class}##{id}"
|
312
|
-
end
|
313
|
-
|
314
|
-
def owned_by?(user)
|
315
|
-
send(Typus.user_fk) == user.id
|
316
|
-
end
|
317
|
-
|
318
|
-
end
|
319
|
-
|
320
|
-
end
|
321
|
-
|
322
|
-
ActiveRecord::Base.send :include, Typus
|
323
|
-
ActiveRecord::Base.send :include, Typus::InstanceMethods
|
@@ -1,15 +0,0 @@
|
|
1
|
-
if defined?(ActionController::Routing::RouteSet)
|
2
|
-
|
3
|
-
class ActionController::Routing::RouteSet
|
4
|
-
|
5
|
-
def load_routes_with_typus!
|
6
|
-
typus_routes = File.join(File.dirname(__FILE__), 'routes_hack.rb')
|
7
|
-
add_configuration_file(typus_routes) unless configuration_files.include?(typus_routes)
|
8
|
-
load_routes_without_typus!
|
9
|
-
end
|
10
|
-
|
11
|
-
alias_method_chain :load_routes!, :typus
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
ActionController::Routing::Routes.draw do |map|
|
2
|
-
|
3
|
-
begin
|
4
|
-
ActionController::Routing::Routes.recognize_path '/admin/typus_users'
|
5
|
-
rescue
|
6
|
-
map.connect ':controller/:action/:id'
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
ActionController::Routing::Routes.recognize_path '/admin/typus_users.csv'
|
11
|
-
rescue
|
12
|
-
map.connect ':controller.:format'
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
data/lib/typus/preferences.rb
DELETED
data/lib/typus/preview.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
module Typus
|
2
|
-
|
3
|
-
module InstanceMethods
|
4
|
-
|
5
|
-
include ActionView::Helpers::UrlHelper
|
6
|
-
|
7
|
-
# OPTIMIZE
|
8
|
-
def typus_preview_on_table(attribute)
|
9
|
-
|
10
|
-
attachment = attribute.split('_file_name').first
|
11
|
-
file_preview = Typus::Configuration.options[:file_preview]
|
12
|
-
file_thumbnail = Typus::Configuration.options[:file_thumbnail]
|
13
|
-
|
14
|
-
if send(attachment).styles.member?(file_preview) && send("#{attachment}_content_type") =~ /^image\/.+/
|
15
|
-
<<-HTML
|
16
|
-
<script type="text/javascript" charset="utf-8">
|
17
|
-
$(document).ready(function() { $("##{to_dom}").fancybox(); });
|
18
|
-
</script>
|
19
|
-
<a id="#{to_dom}" href="#{send(attachment).url(file_preview)}" title="#{typus_name}">#{send(attribute)}</a>
|
20
|
-
HTML
|
21
|
-
else
|
22
|
-
<<-HTML
|
23
|
-
<a href="#{send(attachment).url}">#{send(attribute)}</a>
|
24
|
-
HTML
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# OPTIMIZE
|
29
|
-
def typus_preview(attribute)
|
30
|
-
|
31
|
-
attachment = attribute.split('_file_name').first
|
32
|
-
|
33
|
-
case send("#{attachment}_content_type")
|
34
|
-
when /^image\/.+/
|
35
|
-
file_preview = Typus::Configuration.options[:file_preview]
|
36
|
-
file_thumbnail = Typus::Configuration.options[:file_thumbnail]
|
37
|
-
if send(attachment).styles.member?(file_preview) && send(attachment).styles.member?(file_thumbnail)
|
38
|
-
<<-HTML
|
39
|
-
<script type="text/javascript" charset="utf-8">
|
40
|
-
$(document).ready(function() { $("##{to_dom}").fancybox(); });
|
41
|
-
</script>
|
42
|
-
<a id="#{to_dom}" href="#{send(attachment).url(file_preview)}" title="#{typus_name}">
|
43
|
-
<img src="#{send(attachment).url(file_thumbnail)}" />
|
44
|
-
</a>
|
45
|
-
HTML
|
46
|
-
elsif send(attachment).styles.member?(file_thumbnail)
|
47
|
-
<<-HTML
|
48
|
-
<script type="text/javascript" charset="utf-8">
|
49
|
-
$(document).ready(function() { $("##{to_dom}").fancybox(); });
|
50
|
-
</script>
|
51
|
-
<a href="#{send(attachment).url}" title="#{typus_name}">
|
52
|
-
<img src="#{send(attachment).url(file_thumbnail)}" />
|
53
|
-
</a>
|
54
|
-
HTML
|
55
|
-
elsif send(attachment).styles.member?(file_preview)
|
56
|
-
<<-HTML
|
57
|
-
<img src="#{send(attachment).url(file_preview)}" />
|
58
|
-
HTML
|
59
|
-
else
|
60
|
-
<<-HTML
|
61
|
-
<a href="#{send(attachment).url}">#{send(attribute)}</a>
|
62
|
-
HTML
|
63
|
-
end
|
64
|
-
else
|
65
|
-
<<-HTML
|
66
|
-
<a href="#{send(attachment).url}">#{send(attribute)}</a>
|
67
|
-
HTML
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
ActiveRecord::Base.send :include, Typus::InstanceMethods
|
data/lib/typus/quick_edit.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module Typus
|
2
|
-
|
3
|
-
module QuickEdit
|
4
|
-
|
5
|
-
def quick_edit
|
6
|
-
|
7
|
-
render :text => '' and return unless session[:typus_user_id]
|
8
|
-
|
9
|
-
links = [[ "Dashboard", admin_dashboard_path ]]
|
10
|
-
links << [ params[:message], "/admin/#{params[:path]}" ] if params[:message] && params[:path]
|
11
|
-
|
12
|
-
options = links.reverse.map do |link|
|
13
|
-
"<li><a href=\"#{link.last}\">#{link.first}</a></li>"
|
14
|
-
end
|
15
|
-
|
16
|
-
content = <<-HTML
|
17
|
-
var links = '';
|
18
|
-
links += '<div id="quick_edit">';
|
19
|
-
links += '<ul>';
|
20
|
-
links += '#{options}';
|
21
|
-
links += '</ul>';
|
22
|
-
links += '</div>';
|
23
|
-
links += '<style type="text/css">';
|
24
|
-
links += '<!--';
|
25
|
-
links += '#quick_edit { font-size: 12px; font-family: sans-serif; position: absolute; top: 0px; right: 0px; margin: 10px; }';
|
26
|
-
links += '#quick_edit a { color: #FFF; font-weight: bold; text-decoration: none; }'
|
27
|
-
links += '#quick_edit ul { margin: 0; padding: 0; }';
|
28
|
-
links += '#quick_edit li { display: inline; background: #000; margin: 0 0 0 5px; padding: 3px 5px; }';
|
29
|
-
links += '-->';
|
30
|
-
links += '</style>';
|
31
|
-
document.write(links);
|
32
|
-
HTML
|
33
|
-
|
34
|
-
render :text => content
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
data/lib/typus/reloader.rb
DELETED
data/lib/typus/string.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class String
|
2
|
-
|
3
|
-
def extract_controller(admin = 'admin')
|
4
|
-
split('/').delete_if { |i| i.eql?(admin) }
|
5
|
-
end
|
6
|
-
|
7
|
-
def extract_resource
|
8
|
-
extract_controller.join('/')
|
9
|
-
end
|
10
|
-
|
11
|
-
def extract_class
|
12
|
-
extract_controller.map { |i| i.capitalize }.join('::').classify.constantize
|
13
|
-
end
|
14
|
-
|
15
|
-
def extract_human_name
|
16
|
-
extract_class.typus_human_name.gsub('/', ' ')
|
17
|
-
end
|
18
|
-
|
19
|
-
def typus_actions_for(filter)
|
20
|
-
Typus::Configuration.config[self]['actions'][filter.to_s].split(', ') rescue []
|
21
|
-
end
|
22
|
-
|
23
|
-
def typus_defaults_for(filter)
|
24
|
-
Typus::Configuration.config[self][filter.to_s].split(', ') rescue []
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/lib/vendor/active_record.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
class ActiveRecord::Base
|
2
|
-
|
3
|
-
def to_dom(*args)
|
4
|
-
|
5
|
-
options = args.extract_options!
|
6
|
-
display_id = new_record? ? 'new' : id
|
7
|
-
|
8
|
-
[ options[:prefix],
|
9
|
-
self.class.name.underscore,
|
10
|
-
display_id,
|
11
|
-
options[:suffix] ].compact.join('_')
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
data/lib/vendor/rss_parser.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class RssParser
|
2
|
-
|
3
|
-
require 'rexml/document'
|
4
|
-
|
5
|
-
def self.run(url)
|
6
|
-
xml = REXML::Document.new Net::HTTP.get(URI.parse(url))
|
7
|
-
data = { :title => xml.root.elements['channel/title'].text,
|
8
|
-
:home_url => xml.root.elements['channel/link'].text,
|
9
|
-
:rss_url => url,
|
10
|
-
:items => [] }
|
11
|
-
xml.elements.each '//item' do |item|
|
12
|
-
new_items = {} and item.elements.each do |e|
|
13
|
-
new_items[e.name.gsub(/^dc:(\w)/,"\1").to_sym] = e.text
|
14
|
-
end
|
15
|
-
data[:items] << new_items
|
16
|
-
end
|
17
|
-
data
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
data/rails/init.rb
DELETED
data/tasks/typus_tasks.rake
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
namespace :typus do
|
2
|
-
|
3
|
-
desc 'Install acts_as_list, acts_as_tree and paperclip.'
|
4
|
-
task :misc do
|
5
|
-
plugins = [ 'git://github.com/thoughtbot/paperclip.git',
|
6
|
-
'git://github.com/rails/acts_as_list.git',
|
7
|
-
'git://github.com/rails/acts_as_tree.git' ]
|
8
|
-
system "script/plugin install #{plugins.join(' ')} --force"
|
9
|
-
end
|
10
|
-
|
11
|
-
desc 'Install ssl_requirement.'
|
12
|
-
task :ssl do
|
13
|
-
system "script/plugin install git://github.com/rails/ssl_requirement.git --force"
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Install tiny_mce.'
|
17
|
-
task :tiny_mce do
|
18
|
-
system "script/plugin install git://github.com/kete/tiny_mce.git --force"
|
19
|
-
load File.join Rails.root, 'vendor', 'plugins', 'tiny_mce', 'tasks', 'tiny_mce.rake'
|
20
|
-
Rake::Task["tiny_mce:install"].invoke
|
21
|
-
end
|
22
|
-
|
23
|
-
desc 'List current roles.'
|
24
|
-
task :roles => :environment do
|
25
|
-
Typus::Configuration.roles.each do |role|
|
26
|
-
puts "\n#{role.first.capitalize} role has access to:"
|
27
|
-
role.last.each { |key, value| puts "- #{key}: #{value}" }
|
28
|
-
end
|
29
|
-
puts "\n"
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
TypusUser:
|
2
|
-
fields:
|
3
|
-
list: email, role, status
|
4
|
-
form: first_name, last_name, role, email, password, password_confirmation
|
5
|
-
options:
|
6
|
-
selectors: role
|
7
|
-
booleans:
|
8
|
-
status: Active, Inactive
|
9
|
-
filters: status, role
|
10
|
-
search: first_name, last_name, email, role
|
11
|
-
application: Typus
|
12
|
-
description: System Users Administration
|
@@ -1 +0,0 @@
|
|
1
|
-
_content.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
_sidebar.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
_edit.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
_index.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
_new.html.erb
|
@@ -1 +0,0 @@
|
|
1
|
-
_show.html.erb
|