adva_cms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/NOTES +132 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/adva_cms.gemspec +22 -0
- data/app/assets/images/adva_cms/admin/header_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/section_menu_bg.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_action_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_main_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_sidebar_active.png +0 -0
- data/app/assets/images/adva_cms/admin/tab_top_active.png +0 -0
- data/app/assets/images/adva_cms/asset_selected.png +0 -0
- data/app/assets/images/adva_cms/avatar.gif +0 -0
- data/app/assets/images/adva_cms/filter-bg.png +0 -0
- data/app/assets/images/adva_cms/icons/accept.png +0 -0
- data/app/assets/images/adva_cms/icons/add.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_2.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_cross_3.png +0 -0
- data/app/assets/images/adva_cms/icons/arrow_up_down.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/audio.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/doc.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/pdf.png +0 -0
- data/app/assets/images/adva_cms/icons/assets/video.png +0 -0
- data/app/assets/images/adva_cms/icons/attach.png +0 -0
- data/app/assets/images/adva_cms/icons/bin.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_closed.png +0 -0
- data/app/assets/images/adva_cms/icons/bin_empty.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_black.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_error.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_go.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_red.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_white.png +0 -0
- data/app/assets/images/adva_cms/icons/bullet_yellow.png +0 -0
- data/app/assets/images/adva_cms/icons/cancel.png +0 -0
- data/app/assets/images/adva_cms/icons/comment.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_add.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_blue.gif +0 -0
- data/app/assets/images/adva_cms/icons/comment_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/comment_yellow.gif +0 -0
- data/app/assets/images/adva_cms/icons/cross.png +0 -0
- data/app/assets/images/adva_cms/icons/delete.png +0 -0
- data/app/assets/images/adva_cms/icons/eye.png +0 -0
- data/app/assets/images/adva_cms/icons/favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/help.png +0 -0
- data/app/assets/images/adva_cms/icons/hourglass.png +0 -0
- data/app/assets/images/adva_cms/icons/icon_attachment.gif +0 -0
- data/app/assets/images/adva_cms/icons/icon_padlock.gif +0 -0
- data/app/assets/images/adva_cms/icons/link.png +0 -0
- data/app/assets/images/adva_cms/icons/lock.png +0 -0
- data/app/assets/images/adva_cms/icons/magnifier.png +0 -0
- data/app/assets/images/adva_cms/icons/minus.gif +0 -0
- data/app/assets/images/adva_cms/icons/page_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_favorites.png +0 -0
- data/app/assets/images/adva_cms/icons/page_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_green.png +0 -0
- data/app/assets/images/adva_cms/icons/page_red.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_add.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_delete.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_edit.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_go.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_link.png +0 -0
- data/app/assets/images/adva_cms/icons/page_white_magnify.png +0 -0
- data/app/assets/images/adva_cms/icons/pencil.png +0 -0
- data/app/assets/images/adva_cms/icons/star.png +0 -0
- data/app/assets/images/adva_cms/icons/stop.png +0 -0
- data/app/assets/images/adva_cms/icons/tag_green.png +0 -0
- data/app/assets/images/adva_cms/icons/tick.png +0 -0
- data/app/assets/images/adva_cms/icons/zoom.png +0 -0
- data/app/assets/images/adva_cms/indicator.gif +0 -0
- data/app/assets/images/adva_cms/preview.png +0 -0
- data/app/assets/images/adva_cms/rails.png +0 -0
- data/app/assets/images/adva_cms/sortable_tree/drag.png +0 -0
- data/app/assets/images/adva_cms/theme_selected.png +0 -0
- data/app/assets/javascripts/admin.js +1 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.admin.js +23 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.article.js +22 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.cached_pages.js +14 -0
- data/app/assets/javascripts/adva_cms/admin/jquery.table_tree.js +7 -0
- data/app/assets/javascripts/adva_cms/application.js +14 -0
- data/app/assets/javascripts/adva_cms/base.js +4 -0
- data/app/assets/javascripts/adva_cms/cookie.js +49 -0
- data/app/assets/javascripts/adva_cms/jquery.common.js +41 -0
- data/app/assets/javascripts/adva_cms/jquery.dates.js +51 -0
- data/app/assets/javascripts/adva_cms/jquery.flash.js +57 -0
- data/app/assets/javascripts/adva_cms/jquery.roles.js +25 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery-lowpro.js +224 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.qtip.js +2085 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.table_tree.js +307 -0
- data/app/assets/javascripts/adva_cms/jquery/jquery.tablednd_0_5.js +386 -0
- data/app/assets/javascripts/adva_cms/json.js +139 -0
- data/app/assets/stylesheets/admin.css +1 -0
- data/app/assets/stylesheets/adva_cms/admin.css +16 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/forms.css +121 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/header.css +125 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/layout.css +103 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/lists.css +153 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/sidebar.css +65 -0
- data/app/assets/stylesheets/adva_cms/admin/alternate/top.css +123 -0
- data/app/assets/stylesheets/adva_cms/admin/common.css +76 -0
- data/app/assets/stylesheets/adva_cms/admin/content.css +11 -0
- data/app/assets/stylesheets/adva_cms/admin/forms.css +116 -0
- data/app/assets/stylesheets/adva_cms/admin/header.css +114 -0
- data/app/assets/stylesheets/adva_cms/admin/helptip.css +35 -0
- data/app/assets/stylesheets/adva_cms/admin/layout.css +56 -0
- data/app/assets/stylesheets/adva_cms/admin/lists.css +152 -0
- data/app/assets/stylesheets/adva_cms/admin/projection.css +118 -0
- data/app/assets/stylesheets/adva_cms/admin/reset.css +25 -0
- data/app/assets/stylesheets/adva_cms/admin/screen/top.css +8 -0
- data/app/assets/stylesheets/adva_cms/admin/sidebar.css +67 -0
- data/app/assets/stylesheets/adva_cms/admin/themes.css +49 -0
- data/app/assets/stylesheets/adva_cms/admin/top.css +83 -0
- data/app/assets/stylesheets/adva_cms/admin/users.css +40 -0
- data/app/assets/stylesheets/adva_cms/common.css +49 -0
- data/app/assets/stylesheets/adva_cms/default.css +201 -0
- data/app/assets/stylesheets/adva_cms/forms.css +60 -0
- data/app/assets/stylesheets/adva_cms/jquery/alternate/jquery.tooltip.css +13 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery-ui.css +406 -0
- data/app/assets/stylesheets/adva_cms/jquery/jquery.tooltip.css +10 -0
- data/app/assets/stylesheets/adva_cms/layout/login.css +8 -0
- data/app/assets/stylesheets/adva_cms/layout/simple.css +8 -0
- data/app/assets/stylesheets/adva_cms/menu.css +129 -0
- data/app/assets/stylesheets/adva_cms/reset.css +25 -0
- data/app/controllers/admin/base_controller.rb +101 -0
- data/app/controllers/admin/categories_controller.rb +3 -0
- data/app/controllers/admin/install_controller.rb +61 -0
- data/app/controllers/admin/page/articles_controller.rb +150 -0
- data/app/controllers/admin/page/categories_controller.rb +62 -0
- data/app/controllers/admin/page/contents_controller.rb +52 -0
- data/app/controllers/admin/page/links_controller.rb +69 -0
- data/app/controllers/admin/pages_controller.rb +2 -0
- data/app/controllers/admin/plugins_controller.rb +40 -0
- data/app/controllers/admin/sections_controller.rb +91 -0
- data/app/controllers/admin/sites_controller.rb +99 -0
- data/app/controllers/articles_controller.rb +81 -0
- data/app/controllers/base_controller.rb +82 -0
- data/app/helpers/admin/base_helper.rb +106 -0
- data/app/helpers/base_helper.rb +56 -0
- data/app/helpers/content_helper.rb +90 -0
- data/app/helpers/resource_helper.rb +127 -0
- data/app/models/article.rb +40 -0
- data/app/models/categorization.rb +4 -0
- data/app/models/category.rb +60 -0
- data/app/models/content.rb +155 -0
- data/app/models/event.rb +34 -0
- data/app/models/link.rb +4 -0
- data/app/models/page.rb +36 -0
- data/app/models/section.rb +126 -0
- data/app/models/site.rb +104 -0
- data/app/views/admin/cached_pages/_filter.html.erb +8 -0
- data/app/views/admin/cached_pages/destroy.js.erb +18 -0
- data/app/views/admin/cached_pages/index.html.erb +26 -0
- data/app/views/admin/install/confirmation.html.erb +10 -0
- data/app/views/admin/install/index.html.erb +38 -0
- data/app/views/admin/page/articles/_form.html.erb +40 -0
- data/app/views/admin/page/articles/_options.html.erb +20 -0
- data/app/views/admin/page/articles/edit.html.erb +15 -0
- data/app/views/admin/page/articles/new.html.erb +12 -0
- data/app/views/admin/page/categories/edit.html.erb +22 -0
- data/app/views/admin/page/categories/index.html.erb +23 -0
- data/app/views/admin/page/categories/new.html.erb +19 -0
- data/app/views/admin/page/contents/index.html.erb +40 -0
- data/app/views/admin/page/links/_form.html.erb +26 -0
- data/app/views/admin/page/links/_options.html.erb +23 -0
- data/app/views/admin/page/links/edit.html.erb +12 -0
- data/app/views/admin/page/links/new.html.erb +12 -0
- data/app/views/admin/plugins/_form.html.erb +11 -0
- data/app/views/admin/plugins/index.html.erb +16 -0
- data/app/views/admin/plugins/show.html.erb +43 -0
- data/app/views/admin/sections/_form.html.haml +20 -0
- data/app/views/admin/sections/edit.html.haml +6 -0
- data/app/views/admin/sections/index.html.erb +27 -0
- data/app/views/admin/sections/new.html.erb +29 -0
- data/app/views/admin/sections/settings/_page.html.haml +10 -0
- data/app/views/admin/shared/_header.html.erb +18 -0
- data/app/views/admin/shared/_language_select.html.erb +6 -0
- data/app/views/admin/shared/_section.html.erb +8 -0
- data/app/views/admin/shared/_section_summary.html.erb +23 -0
- data/app/views/admin/shared/_section_tree.html.erb +23 -0
- data/app/views/admin/sites/_email_notifications.html.erb +9 -0
- data/app/views/admin/sites/_form.html.erb +15 -0
- data/app/views/admin/sites/_recent_users.html.erb +11 -0
- data/app/views/admin/sites/_sections.html.erb +10 -0
- data/app/views/admin/sites/_unapproved_comments.html.erb +10 -0
- data/app/views/admin/sites/edit.html.erb +4 -0
- data/app/views/admin/sites/index.html.erb +21 -0
- data/app/views/admin/sites/multi_sites_disabled.html.erb +11 -0
- data/app/views/admin/sites/new.html.erb +21 -0
- data/app/views/admin/sites/show.html.erb +16 -0
- data/app/views/categories/_checkboxes.html.erb +12 -0
- data/app/views/layouts/admin.html.haml +50 -0
- data/app/views/layouts/default.html.erb +38 -0
- data/app/views/layouts/simple.html.erb +22 -0
- data/app/views/pages/articles/index.html.erb +10 -0
- data/app/views/pages/articles/show.html.erb +17 -0
- data/app/views/shared/_flash.html.erb +3 -0
- data/app/views/shared/_footer.html.erb +4 -0
- data/app/views/shared/_menu.html.erb +10 -0
- data/app/views/shared/_sidebar.html.erb +19 -0
- data/app/views/shared/messages/insufficient_permissions.html.erb +4 -0
- data/config/environment.rb +21 -0
- data/config/initializers/has_options.rb +2 -0
- data/config/initializers/has_permalink.rb +27 -0
- data/config/initializers/mailer.rb +12 -0
- data/config/initializers/menus.rb +184 -0
- data/config/initializers/roles.rb +91 -0
- data/config/initializers/settings.rb +26 -0
- data/config/initializers/site.rb +5 -0
- data/config/initializers/translations_are_a_pain.rb +9 -0
- data/config/locales/en.yml +1295 -0
- data/config/routes.rb +47 -0
- data/db/migrate/20080401000001_create_sites_table.rb +28 -0
- data/db/migrate/20080401000002_create_sections_table.rb +25 -0
- data/db/migrate/20080401000003_create_contents_table.rb +35 -0
- data/db/migrate/20080401000004_create_categories_table.rb +17 -0
- data/db/migrate/20080401000005_create_category_assignments.rb +12 -0
- data/db/migrate/20080401000006_create_taggable_tables.rb +26 -0
- data/db/migrate/20080710000000_create_plugin_configs.rb +13 -0
- data/db/migrate/20080715131051_plugin_owner_column.rb +13 -0
- data/db/migrate/20081208161500_add_content_type_to_join_tables.rb +10 -0
- data/db/migrate/20090216114034_rename_category_assignment_to_categorization.rb +13 -0
- data/db/migrate/20090305123429_move_sections_to_pages.rb +9 -0
- data/db/migrate/20090519132700_add_published_at_to_sections.rb +10 -0
- data/db/migrate/20090702085459_create_section_translations.rb +9 -0
- data/db/migrate/20090702200226_create_category_translations.rb +9 -0
- data/db/migrate/20090707171100_upgrade_paperclip_paths.rb +31 -0
- data/db/migrate/20090709111934_add_email_notification_to_site.rb +12 -0
- data/db/migrate/20091026000906_add_nesting_to_articles.rb +26 -0
- data/db/migrate/20140721000000_add_title_to_contents.rb +7 -0
- data/lib/adva_cms.rb +50 -0
- data/lib/adva_cms/version.rb +3 -0
- data/lib/core_ext.rb +7 -0
- data/lib/extensible_forms.rb +283 -0
- data/lib/has_options.rb +46 -0
- data/lib/html_diff.rb +48 -0
- data/lib/rails_ext.rb +15 -0
- data/lib/rails_ext/action_controller/cacheable_flash.rb +30 -0
- data/lib/rails_ext/action_controller/content_for_assignments.rb +105 -0
- data/lib/rails_ext/action_controller/default_params.rb +19 -0
- data/lib/rails_ext/action_controller/event_helper.rb +18 -0
- data/lib/rails_ext/action_controller/page_caching.rb +23 -0
- data/lib/rails_ext/action_controller/render_with_error_proc.rb +46 -0
- data/lib/rails_ext/action_controller/responds_to_parent.rb +46 -0
- data/lib/rails_ext/action_controller/url_for_returning.rb +12 -0
- data/lib/rails_ext/active_record/exists.rb +5 -0
- data/lib/rails_ext/active_record/sti_instantiation.rb +35 -0
- data/lib/rails_ext/active_record/sticky_changes.rb +30 -0
- data/lib/rails_ext/railties/plugin.rb +58 -0
- data/lib/rails_ext/railties/plugin_configuration.rb +72 -0
- data/lib/rails_ext/railties/plugin_initializers.rb +25 -0
- data/lib/registry.rb +49 -0
- data/lib/tasks/adva_cms.rake +178 -0
- data/lib/tasks/translation.rake +69 -0
- data/lib/time_hacks.rb +57 -0
- data/lib/webrat_patch.rb +11 -0
- data/locale/rails/fr.yml +123 -0
- data/test/NOTES +56 -0
- data/test/contexts.rb +365 -0
- data/test/fixtures.rb +190 -0
- data/test/fixtures/templates/alternative_templates/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/index.html.erb +1 -0
- data/test/fixtures/templates/context_templates_test/show.html.erb +0 -0
- data/test/fixtures/templates/layouts/alternative.html.erb +0 -0
- data/test/fixtures/templates/layouts/default.html.erb +0 -0
- data/test/fixtures/templates/menu/shared/_menu.html.erb +8 -0
- data/test/functional/admin/articles_controller_test.rb +329 -0
- data/test/functional/admin/base_controller_test.rb +68 -0
- data/test/functional/admin/cached_pages_controller_test.rb +66 -0
- data/test/functional/admin/categories_controller_test.rb +164 -0
- data/test/functional/admin/cells_controller_spec.rb +32 -0
- data/test/functional/admin/install_controller_test.rb +89 -0
- data/test/functional/admin/plugins_controller_test.rb +93 -0
- data/test/functional/admin/sections_controller_test.rb +201 -0
- data/test/functional/admin/sites_controller_test.rb +240 -0
- data/test/functional/asset_tag_expansions_test.rb +82 -0
- data/test/functional/base_controller_test.rb +73 -0
- data/test/functional/page_articles_controller_test.rb +168 -0
- data/test/functional/page_articles_routes_test.rb +73 -0
- data/test/integration/admin/cached_pages_test.rb +43 -0
- data/test/integration/admin/categories_test.rb +66 -0
- data/test/integration/admin/custom_templates_test.rb +42 -0
- data/test/integration/admin/filtering_articles_test.rb +32 -0
- data/test/integration/admin/plugins.rb +32 -0
- data/test/integration/admin/section_article_test.rb +150 -0
- data/test/integration/admin/section_test.rb +88 -0
- data/test/integration/admin/sites_test.rb +48 -0
- data/test/integration/installation_test.rb +109 -0
- data/test/integration/page_article_comment_test.rb +51 -0
- data/test/integration/page_article_test.rb +87 -0
- data/test/integration/section_index_test.rb +37 -0
- data/test/javascript/assets/jquery-lowpro.js +224 -0
- data/test/javascript/assets/jquery-ui.js +298 -0
- data/test/javascript/assets/jquery.js +4376 -0
- data/test/javascript/assets/testrunner.js +815 -0
- data/test/javascript/assets/testsuite.css +120 -0
- data/test/javascript/lib/jstest.rb +588 -0
- data/test/javascript/templates/test_case.erb +33 -0
- data/test/plugins/adva_context_templates/context_templates_test.rb +138 -0
- data/test/plugins/adva_post_ping/controller/integration_test.rb +78 -0
- data/test/plugins/adva_post_ping/post_ping_test.rb +94 -0
- data/test/plugins/adva_url_history/article_test.rb +94 -0
- data/test/plugins/adva_url_history/init_url_history.rb +18 -0
- data/test/plugins/adva_url_history/section_test.rb +49 -0
- data/test/test_helper.rb +75 -0
- data/test/test_helper/clear_directories.rb +16 -0
- data/test/test_helper/ensure_single_site_mode.rb +10 -0
- data/test/test_helper/extensions/cacheable_flash.rb +14 -0
- data/test/test_helper/extensions/cronjob.rb +11 -0
- data/test/test_helper/extensions/even_test_log.rb +21 -0
- data/test/test_helper/extensions/integration_test.rb +78 -0
- data/test/test_helper/extensions/matchy.rb +365 -0
- data/test/test_helper/extensions/matchy_adva_cms.rb +441 -0
- data/test/test_helper/extensions/rails_patch.rb +40 -0
- data/test/test_helper/extensions/rr.rb +7 -0
- data/test/test_helper/extensions/test_unit.rb +35 -0
- data/test/test_helper/extensions/with_sugar.rb +166 -0
- data/test/test_helper/parse_options.rb +18 -0
- data/test/test_helper/setup_db_transaction.rb +15 -0
- data/test/test_helper/setup_webrat.rb +9 -0
- data/test/test_helper/test_server/init.rb +15 -0
- data/test/unit/helpers/admin/base_helper_test.rb +139 -0
- data/test/unit/helpers/base_helper_spec.rb +54 -0
- data/test/unit/helpers/base_helper_test.rb +165 -0
- data/test/unit/helpers/content_helper_test.rb +127 -0
- data/test/unit/helpers/resource_helper_test.rb +180 -0
- data/test/unit/i18n_test.rb +22 -0
- data/test/unit/lib/cells_ext_spec.rb +96 -0
- data/test/unit/lib/extensible_forms_test.rb +362 -0
- data/test/unit/lib/menu_test.rb +119 -0
- data/test/unit/lib/rails_ext/content_for_assignments_test.rb +75 -0
- data/test/unit/lib/rails_ext/plugin_configuration_test.rb +40 -0
- data/test/unit/lib/rails_ext/sticky_changes_test.rb +33 -0
- data/test/unit/lib/registry_test.rb +91 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_spec.rb +63 -0
- data/test/unit/lib/routing_filter/routing_filter_categories_test.rb +159 -0
- data/test/unit/lib/routing_filter/routing_filter_locale_spec.rb +73 -0
- data/test/unit/lib/routing_filter/routing_filter_root_blog_archive_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_root_section_articles_spec.rb +48 -0
- data/test/unit/lib/routing_filter/routing_filter_root_wikipages_spec.rb +40 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_spec.rb +143 -0
- data/test/unit/lib/routing_filter/routing_filter_sections_test.rb +32 -0
- data/test/unit/lib/routing_filter/routing_filter_sets_test.rb +86 -0
- data/test/unit/models/article_test.rb +191 -0
- data/test/unit/models/category_test.rb +68 -0
- data/test/unit/models/content_test.rb +409 -0
- data/test/unit/models/counter_test.rb +43 -0
- data/test/unit/models/event_test.rb +41 -0
- data/test/unit/models/nested_categories_test.rb +34 -0
- data/test/unit/models/page_test.rb +63 -0
- data/test/unit/models/section_test.rb +315 -0
- data/test/unit/models/site_test.rb +199 -0
- data/test/unit/observers/activities_article_observer_test.rb +42 -0
- data/vendor/gems/belongs_to_cacheable/.gitignore +17 -0
- data/vendor/gems/belongs_to_cacheable/Gemfile +4 -0
- data/vendor/gems/belongs_to_cacheable/LICENSE +22 -0
- data/vendor/gems/belongs_to_cacheable/README.md +29 -0
- data/vendor/gems/belongs_to_cacheable/Rakefile +2 -0
- data/vendor/gems/belongs_to_cacheable/belongs_to_cacheable.gemspec +22 -0
- data/vendor/gems/belongs_to_cacheable/init.rb +1 -0
- data/vendor/gems/belongs_to_cacheable/lib/active_record/belongs_to_cacheable.rb +77 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/lib/belongs_to_cacheable/version.rb +3 -0
- data/vendor/gems/belongs_to_cacheable/spec/belongs_to_cacheable_spec.rb +52 -0
- data/vendor/gems/belongs_to_cacheable/spec/spec_helper.rb +50 -0
- data/vendor/gems/filtered_column/.gitignore +17 -0
- data/vendor/gems/filtered_column/Gemfile +4 -0
- data/vendor/gems/filtered_column/LICENSE +22 -0
- data/vendor/gems/filtered_column/README +4 -0
- data/vendor/gems/filtered_column/README.md +29 -0
- data/vendor/gems/filtered_column/Rakefile +23 -0
- data/vendor/gems/filtered_column/filtered_column.gemspec +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column.rb +17 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/base.rb +28 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/smartypants_filter.rb +14 -0
- data/vendor/gems/filtered_column/lib/filtered_column/filters/textile_filter.rb +13 -0
- data/vendor/gems/filtered_column/lib/filtered_column/macros/base.rb +25 -0
- data/vendor/gems/filtered_column/lib/filtered_column/mixin.rb +46 -0
- data/vendor/gems/filtered_column/lib/filtered_column/processor.rb +52 -0
- data/vendor/gems/filtered_column/lib/filtered_column/version.rb +3 -0
- data/vendor/gems/filtered_column/tasks/filtered_column_tasks.rake +4 -0
- data/vendor/gems/filtered_column/test/abstract_unit.rb +73 -0
- data/vendor/gems/filtered_column/test/filtered_column_test.rb +53 -0
- data/vendor/gems/filtered_column/test/macro_filter_test.rb +23 -0
- data/vendor/gems/has_counter/.gitignore +17 -0
- data/vendor/gems/has_counter/Gemfile +4 -0
- data/vendor/gems/has_counter/LICENSE +22 -0
- data/vendor/gems/has_counter/MIT-LICENSE +20 -0
- data/vendor/gems/has_counter/README.markdown +64 -0
- data/vendor/gems/has_counter/README.md +29 -0
- data/vendor/gems/has_counter/Rakefile +2 -0
- data/vendor/gems/has_counter/db/migrate/20080601194338_create_counters_table.rb.rb +13 -0
- data/vendor/gems/has_counter/has_counter.gemspec +17 -0
- data/vendor/gems/has_counter/lib/active_record/has_counter.rb +64 -0
- data/vendor/gems/has_counter/lib/counter.rb +23 -0
- data/vendor/gems/has_counter/lib/has_counter.rb +4 -0
- data/vendor/gems/has_counter/lib/has_counter/version.rb +3 -0
- data/vendor/gems/has_counter/spec/has_counter.spec.log +0 -0
- data/vendor/gems/has_counter/spec/has_counter.sqlite3.db +0 -0
- data/vendor/gems/has_counter/spec/has_counter_spec.rb +55 -0
- data/vendor/gems/has_counter/spec/spec_helper.rb +117 -0
- data/vendor/gems/has_filter/.gitignore +17 -0
- data/vendor/gems/has_filter/Gemfile +4 -0
- data/vendor/gems/has_filter/LICENSE +22 -0
- data/vendor/gems/has_filter/README.md +29 -0
- data/vendor/gems/has_filter/Rakefile +2 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_add.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_left.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_right.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_remove.png +0 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/filter.js +35 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/jquery.filter.js +23 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/alternate/filter.css +102 -0
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/filter.css +100 -0
- data/vendor/gems/has_filter/app/helpers/filter_helper.rb +3 -0
- data/vendor/gems/has_filter/has_filter.gemspec +17 -0
- data/vendor/gems/has_filter/init.rb +3 -0
- data/vendor/gems/has_filter/lib/has_filter.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/active_record/act_macro.rb +102 -0
- data/vendor/gems/has_filter/lib/has_filter/filter.rb +17 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/base.rb +67 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/categorized.rb +24 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/chain.rb +45 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/set.rb +80 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/state.rb +25 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/tagged.rb +22 -0
- data/vendor/gems/has_filter/lib/has_filter/filter/text.rb +55 -0
- data/vendor/gems/has_filter/lib/has_filter/version.rb +3 -0
- data/vendor/gems/has_filter/test/db/setup.rb +45 -0
- data/vendor/gems/has_filter/test/db/test.sqlite3.db +0 -0
- data/vendor/gems/has_filter/test/fixtures.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/filter_chain_test.rb +41 -0
- data/vendor/gems/has_filter/test/has_filter/filter_scopes_test.rb +102 -0
- data/vendor/gems/has_filter/test/has_filter/filter_tags_test.rb +113 -0
- data/vendor/gems/has_filter/test/has_filter/integration.rb +15 -0
- data/vendor/gems/has_filter/test/has_filter/scopes_test.rb +48 -0
- data/vendor/gems/has_filter/test/log/test.log +34346 -0
- data/vendor/gems/has_filter/test/models.rb +23 -0
- data/vendor/gems/has_filter/test/templates/has_filter/test/index.html.erb +5 -0
- data/vendor/gems/has_filter/test/test_helper.rb +66 -0
- data/vendor/gems/simple_taggable/.gitignore +17 -0
- data/vendor/gems/simple_taggable/Gemfile +4 -0
- data/vendor/gems/simple_taggable/LICENSE +22 -0
- data/vendor/gems/simple_taggable/README +24 -0
- data/vendor/gems/simple_taggable/README.md +29 -0
- data/vendor/gems/simple_taggable/Rakefile +2 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable.rb +153 -0
- data/vendor/gems/simple_taggable/lib/simple_taggable/version.rb +3 -0
- data/vendor/gems/simple_taggable/lib/tag.rb +31 -0
- data/vendor/gems/simple_taggable/lib/tag_list.rb +90 -0
- data/vendor/gems/simple_taggable/lib/tagging.rb +8 -0
- data/vendor/gems/simple_taggable/simple_taggable.gemspec +17 -0
- data/vendor/gems/simple_taggable/test/db/schema.rb +41 -0
- data/vendor/gems/simple_taggable/test/db/simple_taggable.sqlite3.db +0 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazine.rb +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/magazines.yml +2 -0
- data/vendor/gems/simple_taggable/test/fixtures/photo.rb +8 -0
- data/vendor/gems/simple_taggable/test/fixtures/photos.yml +19 -0
- data/vendor/gems/simple_taggable/test/fixtures/post.rb +5 -0
- data/vendor/gems/simple_taggable/test/fixtures/posts.yml +27 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscription.rb +4 -0
- data/vendor/gems/simple_taggable/test/fixtures/subscriptions.yml +3 -0
- data/vendor/gems/simple_taggable/test/fixtures/taggings.yml +112 -0
- data/vendor/gems/simple_taggable/test/fixtures/tags.yml +14 -0
- data/vendor/gems/simple_taggable/test/fixtures/user.rb +6 -0
- data/vendor/gems/simple_taggable/test/fixtures/users.yml +5 -0
- data/vendor/gems/simple_taggable/test/log/simple_taggable.log +1614 -0
- data/vendor/gems/simple_taggable/test/simple_taggable_test.rb +226 -0
- data/vendor/gems/simple_taggable/test/tag_list_test.rb +105 -0
- data/vendor/gems/simple_taggable/test/test_helper.rb +80 -0
- data/vendor/gems/table_builder/.gitignore +17 -0
- data/vendor/gems/table_builder/Gemfile +4 -0
- data/vendor/gems/table_builder/LICENSE +22 -0
- data/vendor/gems/table_builder/README.md +29 -0
- data/vendor/gems/table_builder/Rakefile +2 -0
- data/vendor/gems/table_builder/lib/table_builder.rb +27 -0
- data/vendor/gems/table_builder/lib/table_builder/body.rb +28 -0
- data/vendor/gems/table_builder/lib/table_builder/cell.rb +21 -0
- data/vendor/gems/table_builder/lib/table_builder/column.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/foot.rb +6 -0
- data/vendor/gems/table_builder/lib/table_builder/head.rb +16 -0
- data/vendor/gems/table_builder/lib/table_builder/row.rb +40 -0
- data/vendor/gems/table_builder/lib/table_builder/rows.rb +26 -0
- data/vendor/gems/table_builder/lib/table_builder/table.rb +75 -0
- data/vendor/gems/table_builder/lib/table_builder/tag.rb +58 -0
- data/vendor/gems/table_builder/lib/table_builder/version.rb +3 -0
- data/vendor/gems/table_builder/table_builder.gemspec +17 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_all.html.erb +20 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_body.html.erb +3 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_auto_columns.html.erb +1 -0
- data/vendor/gems/table_builder/test/fixtures/templates/table_simple.html.erb +7 -0
- data/vendor/gems/table_builder/test/table_builder/table_test.rb +230 -0
- data/vendor/gems/table_builder/test/test_helper.rb +49 -0
- data/vendor/gems/tags/.gitignore +17 -0
- data/vendor/gems/tags/Gemfile +4 -0
- data/vendor/gems/tags/LICENSE +22 -0
- data/vendor/gems/tags/README.md +29 -0
- data/vendor/gems/tags/Rakefile +2 -0
- data/vendor/gems/tags/lib/breadcrumbs.rb +13 -0
- data/vendor/gems/tags/lib/menu.rb +179 -0
- data/vendor/gems/tags/lib/menu/builder.rb +74 -0
- data/vendor/gems/tags/lib/tags.rb +7 -0
- data/vendor/gems/tags/lib/tags/tag.rb +125 -0
- data/vendor/gems/tags/lib/tags/version.rb +3 -0
- data/vendor/gems/tags/tags.gemspec +17 -0
- data/vendor/gems/tags/test/tags/menu_test.rb +173 -0
- data/vendor/gems/tags/test/tags/tag_test.rb +13 -0
- data/vendor/gems/tags/test/test_helper.rb +18 -0
- data/vendor/gems/xss_terminate/.gitignore +17 -0
- data/vendor/gems/xss_terminate/Gemfile +4 -0
- data/vendor/gems/xss_terminate/LICENSE +22 -0
- data/vendor/gems/xss_terminate/MIT-LICENSE +20 -0
- data/vendor/gems/xss_terminate/README +94 -0
- data/vendor/gems/xss_terminate/README.md +29 -0
- data/vendor/gems/xss_terminate/Rakefile +23 -0
- data/vendor/gems/xss_terminate/lib/html5lib_sanitize.rb +2453 -0
- data/vendor/gems/xss_terminate/lib/rails_sanitize.rb +8 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate.rb +141 -0
- data/vendor/gems/xss_terminate/lib/xss_terminate/version.rb +3 -0
- data/vendor/gems/xss_terminate/tasks/xss_terminate_tasks.rake +7 -0
- data/vendor/gems/xss_terminate/test/models/comment.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/entry.rb +7 -0
- data/vendor/gems/xss_terminate/test/models/message.rb +3 -0
- data/vendor/gems/xss_terminate/test/models/person.rb +5 -0
- data/vendor/gems/xss_terminate/test/models/review.rb +5 -0
- data/vendor/gems/xss_terminate/test/schema.rb +34 -0
- data/vendor/gems/xss_terminate/test/setup_test.rb +16 -0
- data/vendor/gems/xss_terminate/test/xss_terminate_test.rb +50 -0
- data/vendor/gems/xss_terminate/xss_terminate.gemspec +17 -0
- metadata +744 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
var CachedPage = {
|
2
|
+
clearAll: function(event) {
|
3
|
+
event.preventDefault();
|
4
|
+
$.ajax({
|
5
|
+
url: this.href,
|
6
|
+
type: 'delete',
|
7
|
+
dataType: 'script'
|
8
|
+
});
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
$(document).ready(function() {
|
13
|
+
$('td.actions a.clear').click(CachedPage.clearAll);
|
14
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery-ui
|
3
|
+
//= require jquery_ujs
|
4
|
+
//= require adva_cms/base
|
5
|
+
//= require adva_cms/jquery/jquery.qtip
|
6
|
+
//= require adva_cms/jquery/jquery-lowpro
|
7
|
+
//= require adva_cms/jquery.common
|
8
|
+
//= require adva_cms/admin/jquery.admin
|
9
|
+
//= require adva_cms/jquery/jquery.tablednd_0_5
|
10
|
+
//= require adva_cms/jquery/jquery.table_tree
|
11
|
+
//= require adva_cms/admin/jquery.table_tree
|
12
|
+
//= require adva_cms/admin/jquery.article
|
13
|
+
//= require adva_cms/admin/jquery.cached_pages
|
14
|
+
//= require has_filter/jquery.filter
|
@@ -0,0 +1,49 @@
|
|
1
|
+
// From http://wiki.script.aculo.us/scriptaculous/show/Cookie
|
2
|
+
var Cookie = {
|
3
|
+
set: function(name, value, daysToExpire) {
|
4
|
+
var expire = '';
|
5
|
+
if(!daysToExpire) daysToExpire = 365;
|
6
|
+
var d = new Date();
|
7
|
+
d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
|
8
|
+
expire = 'expires=' + d.toGMTString();
|
9
|
+
var path = "path=/"
|
10
|
+
var cookieValue = escape(name) + '=' + escape(value || '') + '; ' + path + '; ' + expire + ';';
|
11
|
+
return document.cookie = cookieValue;
|
12
|
+
},
|
13
|
+
get: function(name) {
|
14
|
+
var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]+)'));
|
15
|
+
return (cookie ? unescape(cookie[2]) : null);
|
16
|
+
},
|
17
|
+
erase: function(name) {
|
18
|
+
var cookie = Cookie.get(name) || true;
|
19
|
+
Cookie.set(name, '', -1);
|
20
|
+
return cookie;
|
21
|
+
},
|
22
|
+
eraseAll: function() {
|
23
|
+
// Get cookie string and separate into individual cookie phrases:
|
24
|
+
var cookieString = "" + document.cookie;
|
25
|
+
var cookieArray = cookieString.split("; ");
|
26
|
+
|
27
|
+
// Try to delete each cookie:
|
28
|
+
for(var i = 0; i < cookieArray.length; ++ i)
|
29
|
+
{
|
30
|
+
var singleCookie = cookieArray[i].split("=");
|
31
|
+
if(singleCookie.length != 2)
|
32
|
+
continue;
|
33
|
+
var name = unescape(singleCookie[0]);
|
34
|
+
Cookie.erase(name);
|
35
|
+
}
|
36
|
+
},
|
37
|
+
accept: function() {
|
38
|
+
if (typeof navigator.cookieEnabled == 'boolean') {
|
39
|
+
return navigator.cookieEnabled;
|
40
|
+
}
|
41
|
+
Cookie.set('_test', '1');
|
42
|
+
return (Cookie.erase('_test') === '1');
|
43
|
+
},
|
44
|
+
exists: function(cookieName) {
|
45
|
+
var cookieValue = Cookie.get(cookieName);
|
46
|
+
if(!cookieValue) return false;
|
47
|
+
return cookieValue.toString() != "";
|
48
|
+
}
|
49
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
(function($) {
|
2
|
+
window.Form = {
|
3
|
+
toggleDraft: function() {
|
4
|
+
if($(this).attr('checked')) {
|
5
|
+
$('#publish_date_wrapper').hide();
|
6
|
+
} else {
|
7
|
+
$('#publish_date_wrapper').show();
|
8
|
+
}
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
$(document).ready(function() {
|
13
|
+
$('#toggle_draft').click(Form.toggleDraft);
|
14
|
+
|
15
|
+
if($(".hint").size() > 0) {
|
16
|
+
$(".hint").each(function() {
|
17
|
+
if(!$(this).hasClass('text_only')) {
|
18
|
+
var label = $("label[for=" + this.getAttribute('for') + "]");
|
19
|
+
|
20
|
+
if(label) {
|
21
|
+
$(this).appendTo(label);
|
22
|
+
$(this).addClass("move_up");
|
23
|
+
}
|
24
|
+
|
25
|
+
$(this).addClass("enabled");
|
26
|
+
}
|
27
|
+
})
|
28
|
+
$('.hint.enabled').each(function() {
|
29
|
+
$(this).qtip({
|
30
|
+
content: $(this).html(),
|
31
|
+
position: { corner: { target: 'topMiddle', tooltip: 'bottomMiddle' }, adjust: { screen: true, scroll: true } },
|
32
|
+
// FIXME tip option for qtip is broken currently on firefox, add this when this is fixed: tip: 'bottomMiddle'
|
33
|
+
style: { background: '#FBF7E4', color: '#black', name: 'cream',
|
34
|
+
border: { width: 3, radius: 5, color: '#DDDDDD' } },
|
35
|
+
show: { delay: 0, when: { event: 'click' } },
|
36
|
+
hide: { when: { event: 'unfocus' }, effect: { length: 1000 } }
|
37
|
+
});
|
38
|
+
});
|
39
|
+
}
|
40
|
+
});
|
41
|
+
})(jQuery);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/* Date functions */
|
2
|
+
Date.UTCNow = function() {
|
3
|
+
d = new Date();
|
4
|
+
utc = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()));
|
5
|
+
// we need to correct the timezone offset because JS sucks really bad with timezones ...
|
6
|
+
return new Date(utc.getTime() + utc.getTimezoneOffset()*60000);
|
7
|
+
}
|
8
|
+
|
9
|
+
// parse an ISO8601 UTC date string (YYYY-mm-ddZHH:MM:SSZ)
|
10
|
+
Date.parseISO8601 = function(iso8601_date) {
|
11
|
+
return new Date(Date.parse(iso8601_date.replace(/-/g, '/').replace('T', ' ').substr(0, 19))); // always has exactly 19 chars
|
12
|
+
}
|
13
|
+
|
14
|
+
distanceOfTimeInWords = function(seconds) {
|
15
|
+
d = seconds/60; // in minutes
|
16
|
+
|
17
|
+
if (d < 1) return 'less than a minute';
|
18
|
+
|
19
|
+
d = Math.ceil(d); // if it's more than a minute, ceil it
|
20
|
+
if (d < 50) return (d + ' minute' + (d == 1 ? '' : 's'));
|
21
|
+
if (d < 90) return 'about one hour';
|
22
|
+
if (d < 1080) return (Math.round(d/60) + ' hours');
|
23
|
+
if (d < 1440) return 'one day';
|
24
|
+
if (d < 2880) return 'about one day';
|
25
|
+
else return (Math.round(d/1440) + ' days');
|
26
|
+
}
|
27
|
+
|
28
|
+
timeAgoInWords = function(iso8601_date) {
|
29
|
+
utc_date = Date.parseISO8601(iso8601_date);
|
30
|
+
utc_now = Date.UTCNow();
|
31
|
+
d = (utc_now.getTime() - utc_date.getTime())/1000; // in seconds
|
32
|
+
if (d > 0) {
|
33
|
+
return distanceOfTimeInWords(d) + ' ago';
|
34
|
+
} else {
|
35
|
+
return 'in '+ distanceOfTimeInWords(-d);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
createAndFormatDateSpan = function(abbr) {
|
40
|
+
// create a new span element and set its title to the abbr's innerHTML and its value to the timeAgoInWords string
|
41
|
+
abbr.html('<span title="' + abbr.html() + '">' + timeAgoInWords(abbr.attr('title')) + '</span>'); // only used for past dates right now so we can safely use time_ago_in_words here
|
42
|
+
}
|
43
|
+
|
44
|
+
(function($) {
|
45
|
+
$(document).ready(function() {
|
46
|
+
// parse all microformatted dates and re-format them as time distance
|
47
|
+
$('abbr.datetime').each(function() {
|
48
|
+
createAndFormatDateSpan($(this));
|
49
|
+
});
|
50
|
+
});
|
51
|
+
})(jQuery);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
(function($) {
|
2
|
+
var Flash = function(root) {
|
3
|
+
return $.extend({}, Flash, { $root: $(root) });
|
4
|
+
};
|
5
|
+
|
6
|
+
Flash = $.extend(Flash, {
|
7
|
+
transferFromCookies: function() {
|
8
|
+
var data = JSON.parse(unescape(Cookie.get('flash')).replace(/\+/g, ' '));
|
9
|
+
if(!data) data = {};
|
10
|
+
this.data = data;
|
11
|
+
Cookie.erase('flash');
|
12
|
+
},
|
13
|
+
show: function(type, message) {
|
14
|
+
if(!this.data || this.data == {}) this.transferFromCookies();
|
15
|
+
|
16
|
+
var flash = this.$root.find('#flash_' + type);
|
17
|
+
// if no message is given, look it up in the hash
|
18
|
+
if(!message) var message = this.data[type];
|
19
|
+
|
20
|
+
if(!message) return;
|
21
|
+
|
22
|
+
if(message.toString().match(/<li/)) message = "<ul>" + message + '</ul>'
|
23
|
+
flash.html(message);
|
24
|
+
|
25
|
+
flash.show();
|
26
|
+
},
|
27
|
+
|
28
|
+
showAll: function() {
|
29
|
+
this.show('error');
|
30
|
+
this.show('notice');
|
31
|
+
},
|
32
|
+
|
33
|
+
error: function(message) {
|
34
|
+
this.show('error', message);
|
35
|
+
},
|
36
|
+
|
37
|
+
notice: function(message) {
|
38
|
+
this.show('notice', message);
|
39
|
+
},
|
40
|
+
|
41
|
+
hide: function(type) {
|
42
|
+
this.$root.find('#flash_' + type).empty().hide();
|
43
|
+
},
|
44
|
+
|
45
|
+
hideAll: function() {
|
46
|
+
this.hide('error');
|
47
|
+
this.hide('notice');
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
$(document).ready(function() {
|
52
|
+
Flash.$root = $("body");
|
53
|
+
Flash.showAll();
|
54
|
+
});
|
55
|
+
|
56
|
+
window.Flash = Flash;
|
57
|
+
})(jQuery);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
(function($) {
|
2
|
+
authorize_elements = function(roles) {
|
3
|
+
if($.inArray('superuser', roles) > -1) {
|
4
|
+
var elements = $('.visible_for');
|
5
|
+
} else {
|
6
|
+
var elements = [];
|
7
|
+
$.each(roles, function() {
|
8
|
+
$.each($('.' + this.toString()), function() {
|
9
|
+
elements.push(this);
|
10
|
+
});
|
11
|
+
});
|
12
|
+
}
|
13
|
+
|
14
|
+
$.each(elements, function() {
|
15
|
+
element = $(this);
|
16
|
+
if(element) {
|
17
|
+
element.removeClass('visible_for');
|
18
|
+
}
|
19
|
+
})
|
20
|
+
}
|
21
|
+
|
22
|
+
$(document).ready(function() {
|
23
|
+
authorize_elements(['anonymous']);
|
24
|
+
});
|
25
|
+
})(jQuery);
|
@@ -0,0 +1,224 @@
|
|
1
|
+
// http://github.com/danwrong/low-pro-for-jquery/
|
2
|
+
|
3
|
+
(function($) {
|
4
|
+
|
5
|
+
var addMethods = function(source) {
|
6
|
+
var ancestor = this.superclass && this.superclass.prototype;
|
7
|
+
var properties = $.keys(source);
|
8
|
+
|
9
|
+
if (!$.keys({ toString: true }).length) properties.push("toString", "valueOf");
|
10
|
+
|
11
|
+
for (var i = 0, length = properties.length; i < length; i++) {
|
12
|
+
var property = properties[i], value = source[property];
|
13
|
+
if (ancestor && $.isFunction(value) && $.argumentNames(value)[0] == "$super") {
|
14
|
+
|
15
|
+
var method = value, value = $.extend($.wrap((function(m) {
|
16
|
+
return function() { return ancestor[m].apply(this, arguments) };
|
17
|
+
})(property), method), {
|
18
|
+
valueOf: function() { return method },
|
19
|
+
toString: function() { return method.toString() }
|
20
|
+
});
|
21
|
+
}
|
22
|
+
this.prototype[property] = value;
|
23
|
+
}
|
24
|
+
|
25
|
+
return this;
|
26
|
+
}
|
27
|
+
|
28
|
+
$.extend({
|
29
|
+
keys: function(obj) {
|
30
|
+
var keys = [];
|
31
|
+
for (var key in obj) keys.push(key);
|
32
|
+
return keys;
|
33
|
+
},
|
34
|
+
|
35
|
+
argumentNames: function(func) {
|
36
|
+
var names = func.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(/, ?/);
|
37
|
+
return names.length == 1 && !names[0] ? [] : names;
|
38
|
+
},
|
39
|
+
|
40
|
+
bind: function(func, scope) {
|
41
|
+
return function() {
|
42
|
+
return func.apply(scope, $.makeArray(arguments));
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
wrap: function(func, wrapper) {
|
47
|
+
var __method = func;
|
48
|
+
return function() {
|
49
|
+
return wrapper.apply(this, [$.bind(__method, this)].concat($.makeArray(arguments)));
|
50
|
+
}
|
51
|
+
},
|
52
|
+
|
53
|
+
klass: function() {
|
54
|
+
var parent = null, properties = $.makeArray(arguments);
|
55
|
+
if ($.isFunction(properties[0])) parent = properties.shift();
|
56
|
+
|
57
|
+
var klass = function() {
|
58
|
+
this.initialize.apply(this, arguments);
|
59
|
+
};
|
60
|
+
|
61
|
+
klass.superclass = parent;
|
62
|
+
klass.subclasses = [];
|
63
|
+
klass.addMethods = addMethods;
|
64
|
+
|
65
|
+
if (parent) {
|
66
|
+
var subclass = function() { };
|
67
|
+
subclass.prototype = parent.prototype;
|
68
|
+
klass.prototype = new subclass;
|
69
|
+
parent.subclasses.push(klass);
|
70
|
+
}
|
71
|
+
|
72
|
+
for (var i = 0; i < properties.length; i++)
|
73
|
+
klass.addMethods(properties[i]);
|
74
|
+
|
75
|
+
if (!klass.prototype.initialize)
|
76
|
+
klass.prototype.initialize = function() {};
|
77
|
+
|
78
|
+
klass.prototype.constructor = klass;
|
79
|
+
|
80
|
+
return klass;
|
81
|
+
},
|
82
|
+
delegate: function(rules) {
|
83
|
+
return function(e) {
|
84
|
+
var target = $(e.target), parent = null;
|
85
|
+
for (var selector in rules) {
|
86
|
+
if (target.is(selector) || ((parent = target.parents(selector)) && parent.length > 0)) {
|
87
|
+
return rules[selector].apply(this, [parent || target].concat($.makeArray(arguments)));
|
88
|
+
}
|
89
|
+
parent = null;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
var bindEvents = function(instance) {
|
96
|
+
for (var member in instance) {
|
97
|
+
if (member.match(/^on(.+)/) && typeof instance[member] == 'function') {
|
98
|
+
instance.element.bind(RegExp.$1, $.bind(instance[member], instance));
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
var behaviorWrapper = function(behavior) {
|
104
|
+
return $.klass(behavior, {
|
105
|
+
initialize: function($super, element, args) {
|
106
|
+
this.element = $(element);
|
107
|
+
if ($super) $super.apply(this, args);
|
108
|
+
}
|
109
|
+
});
|
110
|
+
}
|
111
|
+
|
112
|
+
var attachBehavior = function(el, behavior, args) {
|
113
|
+
var wrapper = behaviorWrapper(behavior);
|
114
|
+
instance = new wrapper(el, args);
|
115
|
+
|
116
|
+
bindEvents(instance);
|
117
|
+
|
118
|
+
if (!behavior.instances) behavior.instances = [];
|
119
|
+
|
120
|
+
behavior.instances.push(instance);
|
121
|
+
|
122
|
+
return instance;
|
123
|
+
};
|
124
|
+
|
125
|
+
|
126
|
+
$.fn.extend({
|
127
|
+
attach: function() {
|
128
|
+
var args = $.makeArray(arguments), behavior = args.shift();
|
129
|
+
|
130
|
+
if ($.livequery && this.selector) {
|
131
|
+
return this.livequery(function() {
|
132
|
+
attachBehavior(this, behavior, args);
|
133
|
+
});
|
134
|
+
} else {
|
135
|
+
return this.each(function() {
|
136
|
+
attachBehavior(this, behavior, args);
|
137
|
+
});
|
138
|
+
}
|
139
|
+
},
|
140
|
+
attachAndReturn: function() {
|
141
|
+
var args = $.makeArray(arguments), behavior = args.shift();
|
142
|
+
|
143
|
+
return $.map(this, function(el) {
|
144
|
+
return attachBehavior(el, behavior, args);
|
145
|
+
});
|
146
|
+
},
|
147
|
+
delegate: function(type, rules) {
|
148
|
+
return this.bind(type, $.delegate(rules));
|
149
|
+
},
|
150
|
+
attached: function(behavior) {
|
151
|
+
var instances = [];
|
152
|
+
|
153
|
+
if (!behavior.instances) return instances;
|
154
|
+
|
155
|
+
this.each(function(i, element) {
|
156
|
+
$.each(behavior.instances, function(i, instance) {
|
157
|
+
if (instance.element.get(0) == element) instances.push(instance);
|
158
|
+
});
|
159
|
+
});
|
160
|
+
|
161
|
+
return instances;
|
162
|
+
},
|
163
|
+
firstAttached: function(behavior) {
|
164
|
+
return this.attached(behavior)[0];
|
165
|
+
}
|
166
|
+
});
|
167
|
+
|
168
|
+
Remote = $.klass({
|
169
|
+
initialize: function(options) {
|
170
|
+
if (this.element.attr('nodeName') == 'FORM') this.element.attach(Remote.Form, options);
|
171
|
+
else this.element.attach(Remote.Link, options);
|
172
|
+
}
|
173
|
+
});
|
174
|
+
|
175
|
+
Remote.Base = $.klass({
|
176
|
+
initialize : function(options) {
|
177
|
+
this.options = $.extend({
|
178
|
+
|
179
|
+
}, options || {});
|
180
|
+
},
|
181
|
+
_makeRequest : function(options) {
|
182
|
+
$.ajax(options);
|
183
|
+
return false;
|
184
|
+
}
|
185
|
+
});
|
186
|
+
|
187
|
+
Remote.Link = $.klass(Remote.Base, {
|
188
|
+
onclick: function() {
|
189
|
+
var options = $.extend({ url: this.element.attr('href'), type: 'GET' }, this.options);
|
190
|
+
return this._makeRequest(options);
|
191
|
+
}
|
192
|
+
});
|
193
|
+
|
194
|
+
Remote.Form = $.klass(Remote.Base, {
|
195
|
+
onclick: function(e) {
|
196
|
+
var target = e.target;
|
197
|
+
|
198
|
+
if ($.inArray(target.nodeName.toLowerCase(), ['input', 'button']) >= 0 && target.type.match(/submit|image/))
|
199
|
+
this._submitButton = target;
|
200
|
+
},
|
201
|
+
onsubmit: function() {
|
202
|
+
var data = this.element.serializeArray();
|
203
|
+
|
204
|
+
if (this._submitButton) data.push({ name: this._submitButton.name, value: this._submitButton.value });
|
205
|
+
|
206
|
+
var options = $.extend({
|
207
|
+
url : this.element.attr('action'),
|
208
|
+
type : this.element.attr('method') || 'GET',
|
209
|
+
data : data
|
210
|
+
}, this.options);
|
211
|
+
|
212
|
+
this._makeRequest(options);
|
213
|
+
|
214
|
+
return false;
|
215
|
+
}
|
216
|
+
});
|
217
|
+
|
218
|
+
$.ajaxSetup({
|
219
|
+
beforeSend: function(xhr) {
|
220
|
+
xhr.setRequestHeader("Accept", "text/javascript, text/html, application/xml, text/xml, */*");
|
221
|
+
}
|
222
|
+
});
|
223
|
+
|
224
|
+
})(jQuery);
|