browsercms 3.4.2 → 3.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/app/assets/images/cms/file-uploading.gif +0 -0
- data/app/assets/javascripts/cms/application.js +1 -0
- data/app/assets/javascripts/cms/attachment_manager.js.erb +87 -0
- data/app/assets/javascripts/cms/core_library.js.erb +38 -25
- data/app/assets/stylesheets/cms/application.css.erb +1 -0
- data/app/assets/stylesheets/cms/attachment_manager.css.scss +28 -0
- data/app/controllers/cms/application_controller.rb +1 -1
- data/app/controllers/cms/attachments_controller.rb +45 -10
- data/app/controllers/cms/cache_controller.rb +1 -1
- data/app/controllers/cms/content_block_controller.rb +134 -122
- data/app/controllers/cms/content_controller.rb +143 -155
- data/app/controllers/cms/dashboard_controller.rb +11 -9
- data/app/controllers/cms/error_handling.rb +19 -7
- data/app/controllers/cms/file_blocks_controller.rb +2 -2
- data/app/controllers/cms/home_controller.rb +3 -0
- data/app/controllers/cms/section_nodes_controller.rb +52 -44
- data/app/controllers/cms/sections_controller.rb +4 -2
- data/app/controllers/cms/toolbar_controller.rb +14 -10
- data/app/helpers/cms/application_helper.rb +23 -19
- data/app/helpers/cms/form_builder.rb +65 -18
- data/app/helpers/cms/mobile_helper.rb +19 -0
- data/app/helpers/cms/path_helper.rb +30 -4
- data/app/helpers/cms/rendering_helper.rb +9 -1
- data/app/models/cms/abstract_file_block.rb +6 -6
- data/app/models/cms/attachment.rb +196 -107
- data/app/models/cms/category.rb +3 -0
- data/app/models/cms/category_type.rb +2 -0
- data/app/models/cms/connector.rb +3 -0
- data/app/models/cms/content_type.rb +3 -0
- data/app/models/cms/content_type_group.rb +2 -0
- data/app/models/cms/dynamic_view.rb +4 -0
- data/app/models/cms/email_message.rb +2 -0
- data/app/models/cms/file_block.rb +9 -2
- data/app/models/cms/group.rb +5 -2
- data/app/models/cms/group_permission.rb +2 -0
- data/app/models/cms/group_section.rb +3 -0
- data/app/models/cms/group_type.rb +2 -0
- data/app/models/cms/group_type_permission.rb +2 -0
- data/app/models/cms/html_block.rb +3 -2
- data/app/models/cms/image_block.rb +13 -2
- data/app/models/cms/page.rb +14 -3
- data/app/models/cms/page_route.rb +4 -0
- data/app/models/cms/page_route_condition.rb +1 -0
- data/app/models/cms/page_route_option.rb +2 -0
- data/app/models/cms/page_route_requirement.rb +1 -0
- data/app/models/cms/permission.rb +3 -0
- data/app/models/cms/portlet.rb +2 -2
- data/app/models/cms/redirect.rb +2 -0
- data/app/models/cms/section.rb +15 -1
- data/app/models/cms/section_node.rb +1 -0
- data/app/models/cms/site.rb +3 -0
- data/app/models/cms/tag.rb +2 -0
- data/app/models/cms/tagging.rb +3 -0
- data/app/models/cms/task.rb +5 -1
- data/app/models/cms/user.rb +1 -1
- data/app/models/cms/user_group_membership.rb +3 -0
- data/app/views/cms/attachments/_attachment.html.erb +14 -0
- data/app/views/cms/attachments/_attachment_table.html.erb +17 -0
- data/app/views/cms/attachments/_attachment_wrapper.html.erb +4 -0
- data/app/views/cms/blocks/index.html.erb +2 -3
- data/app/views/cms/blocks/show.html.erb +1 -1
- data/app/views/cms/dynamic_views/index.html.erb +1 -1
- data/app/views/cms/email_messages/index.html.erb +1 -1
- data/app/views/cms/file_blocks/_form.html.erb +1 -27
- data/app/views/cms/file_blocks/_section_selector.html.erb +13 -0
- data/app/views/cms/file_blocks/render.html.erb +3 -3
- data/app/views/cms/form_builder/_cms_attachment_manager.html.erb +26 -0
- data/app/views/cms/form_builder/_cms_file_field.html.erb +27 -35
- data/app/views/cms/groups/index.html.erb +1 -1
- data/app/views/cms/image_blocks/_form.html.erb +1 -27
- data/app/views/cms/image_blocks/render.html.erb +4 -1
- data/app/views/cms/page_routes/index.html.erb +3 -0
- data/app/views/cms/shared/error.xml.erb +8 -0
- data/app/views/cms/tags/render.html.erb +1 -1
- data/app/views/cms/toolbar/_mobile_toggle.html.erb +33 -0
- data/app/views/cms/users/index.html.erb +1 -1
- data/app/views/layouts/_page_toolbar.html.erb +2 -1
- data/bin/bcms +21 -26
- data/config/routes.rb +3 -2
- data/db/browsercms.seeds.rb +2 -1
- data/db/migrate/20111130221145_browsercms340.rb +5 -4
- data/db/migrate/20120329144406_browsercms350.rb +32 -0
- data/{test/dummy/db → db}/schema.rb +97 -128
- data/{performance_tuning_notes.md → doc/performance_tuning_notes.md} +0 -0
- data/doc/release_notes.md +74 -0
- data/lib/browsercms.rb +3 -0
- data/lib/cms/acts/content_block.rb +10 -2
- data/lib/cms/addressable.rb +8 -0
- data/lib/cms/attachments/attachment_serving.rb +59 -0
- data/lib/cms/attachments/configuration.rb +88 -0
- data/lib/cms/behaviors/attaching.rb +305 -136
- data/lib/cms/behaviors/connecting.rb +3 -4
- data/lib/cms/behaviors/dynamic_attributes.rb +121 -118
- data/lib/cms/behaviors/flush_cache_on_change.rb +1 -3
- data/lib/cms/behaviors/naming.rb +16 -0
- data/lib/cms/behaviors/pagination.rb +4 -1
- data/lib/cms/behaviors/publishing.rb +9 -3
- data/lib/cms/behaviors/searching.rb +3 -8
- data/lib/cms/behaviors/soft_deleting.rb +1 -0
- data/lib/cms/behaviors/taggable.rb +2 -0
- data/lib/cms/behaviors/versioning.rb +73 -120
- data/lib/cms/caching.rb +53 -11
- data/lib/cms/commands/actions.rb +19 -2
- data/lib/cms/configuration.rb +44 -0
- data/lib/cms/content_rendering_support.rb +9 -6
- data/lib/cms/default_accessible.rb +13 -0
- data/lib/cms/domain_support.rb +22 -0
- data/lib/cms/engine.rb +40 -19
- data/lib/cms/engine_helper.rb +54 -0
- data/lib/cms/extensions/active_record/connection_adapters/abstract/schema_statements.rb +14 -2
- data/lib/cms/mobile_aware.rb +67 -0
- data/lib/cms/route_extensions.rb +3 -0
- data/lib/cms/upgrades/v3_5_0.rb +155 -0
- data/lib/cms/version.rb +6 -1
- data/lib/generators/cms/content_block/content_block_generator.rb +14 -9
- data/lib/generators/cms/content_block/templates/_form.html.erb +17 -6
- data/lib/generators/cms/content_block/templates/render.html.erb +12 -5
- data/lib/generators/cms/template/template_generator.rb +11 -2
- data/lib/tasks/cms.rake +23 -0
- data/lib/templates/active_record/model/model.rb +6 -0
- metadata +127 -517
- data/.gitignore +0 -24
- data/.rvmrc +0 -2
- data/Gemfile +0 -29
- data/Gemfile.lock +0 -196
- data/Rakefile +0 -97
- data/app/assets/images/browsercms/.gitkeep +0 -0
- data/app/controllers/browsercms/application_controller.rb +0 -4
- data/browsercms.gemspec +0 -35
- data/config/cucumber.yml +0 -8
- data/config/database.jdbcmysql.yml +0 -30
- data/config/database.mysql.yml +0 -27
- data/config/database.postgres.yml +0 -25
- data/config/database.sqlite3.yml +0 -11
- data/config/environment.rb +0 -6
- data/config/initializers/query_reviewer_patch.rb +0 -12
- data/config/initializers/rack_1_2_1_patch.rb +0 -12
- data/config/locales/en.yml +0 -5
- data/features/acts_as_content_page.feature +0 -62
- data/features/add_content_to_pages.feature +0 -45
- data/features/caching.feature +0 -13
- data/features/ckeditor.feature +0 -11
- data/features/commands/confirm_aruba_works.feature +0 -24
- data/features/commands/generate_module.feature +0 -54
- data/features/commands/install_browsercms.feature +0 -21
- data/features/commands/new_demo_project.feature +0 -30
- data/features/commands/new_projects.feature +0 -50
- data/features/commands/upgrade_modules_to_3_4_0_from_3_1_x.feature +0 -19
- data/features/commands/upgrade_project_to_3_4_0_from_3_3_x.feature +0 -52
- data/features/commands/upgrading_modules.feature +0 -67
- data/features/content_blocks/manage_custom_blocks.feature +0 -67
- data/features/content_blocks/manage_html_blocks.feature +0 -48
- data/features/content_blocks/manage_image_blocks.feature +0 -41
- data/features/content_files.feature +0 -37
- data/features/content_pages.feature +0 -21
- data/features/generators/content_blocks_for_modules.feature +0 -58
- data/features/generators/content_blocks_for_projects.feature +0 -109
- data/features/install_content.feature +0 -25
- data/features/jquery-testplan.txt +0 -12
- data/features/manage_groups.feature +0 -33
- data/features/manage_page_routes.feature +0 -72
- data/features/manage_redirects.feature +0 -20
- data/features/manage_sections.feature +0 -12
- data/features/manage_tasks.feature +0 -25
- data/features/manage_users.feature +0 -38
- data/features/page_templates.feature +0 -49
- data/features/portlets/email_friend_portlet.feature +0 -29
- data/features/portlets/portlets.feature +0 -100
- data/features/portlets/tag_cloud_portlet.feature +0 -28
- data/features/sitemap/create_pages.feature +0 -15
- data/features/sitemap/manage_links.feature +0 -29
- data/features/sitemap/sitemap.feature +0 -18
- data/features/step_definitions/acts_as_content_page_steps.rb.rb +0 -3
- data/features/step_definitions/ckeditor_steps.rb +0 -13
- data/features/step_definitions/command_line_steps.rb +0 -212
- data/features/step_definitions/content_pages_steps.rb +0 -170
- data/features/step_definitions/data_steps.rb +0 -48
- data/features/step_definitions/edit_page_templates_steps.rb +0 -21
- data/features/step_definitions/html_blocks_steps.rb +0 -9
- data/features/step_definitions/install_content_steps.rb +0 -4
- data/features/step_definitions/manage_content_blocks_steps.rb +0 -26
- data/features/step_definitions/manage_image_blocks_steps.rb +0 -31
- data/features/step_definitions/manage_sections_steps.rb +0 -18
- data/features/step_definitions/manage_user_steps.rb +0 -22
- data/features/step_definitions/more_custom_block_steps.rb +0 -34
- data/features/step_definitions/page_route_steps.rb +0 -65
- data/features/step_definitions/page_template_steps.rb +0 -5
- data/features/step_definitions/permissions_steps.rb +0 -13
- data/features/step_definitions/portlets_steps.rb +0 -64
- data/features/step_definitions/redirect_steps.rb +0 -12
- data/features/step_definitions/sitemap_steps.rb +0 -18
- data/features/step_definitions/tag_cloud_steps.rb +0 -11
- data/features/step_definitions/task_steps.rb +0 -4
- data/features/step_definitions/taxonomy_steps.rb +0 -16
- data/features/step_definitions/upgrade_module_steps.rb +0 -76
- data/features/step_definitions/web_steps.rb +0 -211
- data/features/support/async_support.rb +0 -17
- data/features/support/command_line_helpers.rb +0 -63
- data/features/support/debug_formatter.rb +0 -7
- data/features/support/debugging.rb +0 -28
- data/features/support/env.rb +0 -73
- data/features/support/git_api.rb +0 -9
- data/features/support/open_on_first_failure.rb +0 -25
- data/features/support/paths.rb +0 -32
- data/features/support/rails_api.rb +0 -8
- data/features/support/selectors.rb +0 -39
- data/features/support/transforms.rb +0 -7
- data/features/taxonomy/add_content_with_category.feature +0 -30
- data/features/taxonomy/manage_categories.feature +0 -20
- data/features/taxonomy/manage_category_types.feature +0 -16
- data/lib/cms/init.rb +0 -105
- data/lib/tasks/data.rake +0 -43
- data/lib/tasks/db.rake +0 -82
- data/public/styled_file_field/index.html +0 -72
- data/script/cucumber +0 -10
- data/script/rails +0 -6
- data/test/console_helper.rb +0 -5
- data/test/custom_assertions.rb +0 -84
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/javascripts/content_page.js +0 -2
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/assets/stylesheets/content_page.css +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/cms/products_controller.rb +0 -2
- data/test/dummy/app/controllers/cms/sample_blocks_controller.rb +0 -3
- data/test/dummy/app/controllers/content_page_controller.rb +0 -13
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/content_page_helper.rb +0 -2
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/cms/sample_block.rb +0 -22
- data/test/dummy/app/models/product.rb +0 -5
- data/test/dummy/app/views/cms/products/_form.html.erb +0 -7
- data/test/dummy/app/views/cms/products/render.html.erb +0 -3
- data/test/dummy/app/views/content_page/custom_page.html.erb +0 -3
- data/test/dummy/app/views/content_page/index.html.erb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/layouts/templates/default.html.erb +0 -17
- data/test/dummy/app/views/layouts/templates/subpage.html.erb +0 -16
- data/test/dummy/app/views/test_route/index.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -45
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -27
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -32
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -46
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/browsercms.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/quiet_sprocket_assets.rb +0 -13
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -23
- data/test/dummy/db/migrate/20111228141250_create_products.rb +0 -16
- data/test/dummy/db/seeds.rb +0 -1
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/functional/content_page_controller_test.rb +0 -9
- data/test/dummy/test/unit/helpers/content_page_helper_test.rb +0 -4
- data/test/factories.rb +0 -235
- data/test/fixtures/multipart/foo.jpg +0 -0
- data/test/fixtures/multipart/sample_upload.txt +0 -1
- data/test/fixtures/multipart/second_upload.txt +0 -1
- data/test/fixtures/multipart/test.jpg +0 -0
- data/test/fixtures/multipart/version1.txt +0 -1
- data/test/fixtures/multipart/version2.txt +0 -1
- data/test/functional/cms/cache_controller_test.rb +0 -16
- data/test/functional/cms/categories_controller_test.rb +0 -28
- data/test/functional/cms/connectors_controller_test.rb +0 -64
- data/test/functional/cms/content_block_controller_test.rb +0 -127
- data/test/functional/cms/content_controller_test.rb +0 -351
- data/test/functional/cms/dashboard_controller_test.rb +0 -20
- data/test/functional/cms/file_blocks_controller_test.rb +0 -55
- data/test/functional/cms/home_controller_test.rb +0 -160
- data/test/functional/cms/html_blocks_controller_test.rb +0 -159
- data/test/functional/cms/image_blocks_controller_test.rb +0 -78
- data/test/functional/cms/links_controller_test.rb +0 -92
- data/test/functional/cms/log/test.log +0 -0
- data/test/functional/cms/pages_controller_test.rb +0 -233
- data/test/functional/cms/portlets_controller_test.rb +0 -57
- data/test/functional/cms/sections_controller_test.rb +0 -234
- data/test/functional/cms/sessions_controller_test.rb +0 -80
- data/test/functional/cms/tasks_controller_test.rb +0 -64
- data/test/functional/cms/toolbar_controller_test.rb +0 -76
- data/test/functional/cms/users_controller_test.rb +0 -218
- data/test/integration/cms/password_management_test.rb +0 -66
- data/test/integration/sitemap_performance_test.rb +0 -26
- data/test/mock_file.rb +0 -33
- data/test/performance/browsing_test.rb +0 -9
- data/test/support/engine_controller_hacks.rb +0 -34
- data/test/support/factory_helpers.rb +0 -57
- data/test/support/rails_3_1_routes_hack.rb +0 -70
- data/test/test_helper.rb +0 -199
- data/test/test_logging.rb +0 -67
- data/test/unit/active_record_callbacks.rb +0 -50
- data/test/unit/behaviors/attaching_test.rb +0 -370
- data/test/unit/behaviors/cms_user_test.rb +0 -67
- data/test/unit/behaviors/connectable_test.rb +0 -32
- data/test/unit/behaviors/connecting_test.rb +0 -56
- data/test/unit/behaviors/dynamic_attributes_test.rb +0 -74
- data/test/unit/behaviors/namespacing_test.rb +0 -76
- data/test/unit/behaviors/publishable_test.rb +0 -83
- data/test/unit/behaviors/rendering_test.rb +0 -68
- data/test/unit/behaviors/searching_test.rb +0 -102
- data/test/unit/behaviors/taggable_test.rb +0 -110
- data/test/unit/behaviors/userstamping_test.rb +0 -27
- data/test/unit/behaviors/versioning_test.rb +0 -102
- data/test/unit/extensions/active_record/base_test.rb +0 -25
- data/test/unit/extensions/hash_test.rb +0 -26
- data/test/unit/extensions/integer_test.rb +0 -10
- data/test/unit/extensions/string_test.rb +0 -14
- data/test/unit/factories_test.rb +0 -50
- data/test/unit/generators/install_generator_test.rb +0 -15
- data/test/unit/helpers/application_helper_test.rb +0 -104
- data/test/unit/helpers/date_picker_test.rb +0 -17
- data/test/unit/helpers/menu_helper_test.rb +0 -240
- data/test/unit/helpers/page_helper_test.rb +0 -69
- data/test/unit/helpers/path_helper_test.rb +0 -38
- data/test/unit/helpers/rendering_helper_test.rb +0 -8
- data/test/unit/lib/acts_as_content_page_test.rb +0 -72
- data/test/unit/lib/cms/authentication/controller_test.rb +0 -20
- data/test/unit/lib/cms/engine_helper_test.rb +0 -119
- data/test/unit/lib/cms/sitemap_test.rb +0 -210
- data/test/unit/lib/cms_domain_support_test.rb +0 -44
- data/test/unit/lib/command_line_test.rb +0 -70
- data/test/unit/lib/content_block_test.rb +0 -304
- data/test/unit/lib/content_rendering_support_test.rb +0 -40
- data/test/unit/lib/generators_test.rb +0 -40
- data/test/unit/lib/routes_test.rb +0 -98
- data/test/unit/mock_file_test.rb +0 -19
- data/test/unit/models/attachment_test.rb +0 -160
- data/test/unit/models/category_test.rb +0 -40
- data/test/unit/models/category_type_test.rb +0 -8
- data/test/unit/models/connector_test.rb +0 -152
- data/test/unit/models/content_type_group_test.rb +0 -26
- data/test/unit/models/content_type_test.rb +0 -177
- data/test/unit/models/dynamic_views_test.rb +0 -36
- data/test/unit/models/email_page_portlet_test.rb +0 -20
- data/test/unit/models/file_block_test.rb +0 -246
- data/test/unit/models/group_test.rb +0 -29
- data/test/unit/models/html_block_test.rb +0 -121
- data/test/unit/models/image_block_test.rb +0 -35
- data/test/unit/models/link_test.rb +0 -52
- data/test/unit/models/namespaces_test.rb +0 -57
- data/test/unit/models/page_partial_test.rb +0 -37
- data/test/unit/models/page_route_test.rb +0 -113
- data/test/unit/models/page_template_test.rb +0 -50
- data/test/unit/models/page_test.rb +0 -879
- data/test/unit/models/permission_test.rb +0 -10
- data/test/unit/models/portlet_test.rb +0 -99
- data/test/unit/models/sections_test.rb +0 -278
- data/test/unit/models/site_test.rb +0 -50
- data/test/unit/models/task_test.rb +0 -150
- data/test/unit/models/user_test.rb +0 -358
- data/test/unit/schema_statements_test.rb +0 -137
- data/todo_list.markdown +0 -50
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
This is a file.
|
@@ -1 +0,0 @@
|
|
1
|
-
This is a second file.
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
v1
|
@@ -1 +0,0 @@
|
|
1
|
-
v2
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class CacheControllerTest < ActionController::TestCase
|
5
|
-
include Cms::ControllerTestHelper
|
6
|
-
|
7
|
-
def setup
|
8
|
-
login_as_cms_admin
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_expire_cache
|
12
|
-
#TODO: Implement Cache Expiration
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class CategoriesControllerTest < ActionController::TestCase
|
5
|
-
include Cms::ControllerTestHelper
|
6
|
-
|
7
|
-
def setup
|
8
|
-
given_there_is_a_content_type Cms::Category
|
9
|
-
login_as_cms_admin
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_new_with_no_category_types
|
13
|
-
assert_equal 0, CategoryType.count, "This test depends on there being no category types"
|
14
|
-
get :new
|
15
|
-
assert_response :success
|
16
|
-
assert_select "title", "Please Create A Category Type"
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_new_with_category_types
|
20
|
-
Factory(:category_type, :name => "FooCategoryType")
|
21
|
-
get :new
|
22
|
-
assert_response :success
|
23
|
-
assert_select "title", "Content Library / Add New Category"
|
24
|
-
assert_select "option", "FooCategoryType"
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
class ConnectorsControllerTest < ActionController::TestCase
|
5
|
-
include Cms::ControllerTestHelper
|
6
|
-
|
7
|
-
def setup
|
8
|
-
given_there_is_a_content_type Cms::HtmlBlock
|
9
|
-
given_there_is_a_content_type Cms::Portlet
|
10
|
-
login_as_cms_admin
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_new
|
14
|
-
@page = Factory(:page, :section => root_section, :name => "Test Page")
|
15
|
-
@block = Factory(:html_block)
|
16
|
-
|
17
|
-
get :new, :page_id => @page, :container => "main"
|
18
|
-
|
19
|
-
assert_response :success
|
20
|
-
assert_select "title", "Add Existing Content to 'Test Page' Page"
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_new_portlet
|
24
|
-
@page = Factory(:page, :section => root_section, :name => "Test Page")
|
25
|
-
@portlet = Factory(:portlet, :connect_to_page_id => @page.id, :connect_to_container => "main")
|
26
|
-
reset(:page)
|
27
|
-
|
28
|
-
get :new, :page_id => @page, :container => "main", :block_type => "portlets"
|
29
|
-
|
30
|
-
assert_response :success
|
31
|
-
assert_select "title", "Add Existing Content to 'Test Page' Page"
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_new_with_deleted_portlet
|
35
|
-
@page = Factory(:page, :section => root_section, :name => "Test Page")
|
36
|
-
@portlet = Factory(:portlet)
|
37
|
-
@portlet.destroy
|
38
|
-
|
39
|
-
get :new, :page_id => @page, :container => "main", :block_type => "portlets"
|
40
|
-
|
41
|
-
assert_response :success
|
42
|
-
assert_select "#dynamic_portlet_#{@portlet.id}", :count => 0
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_destroy
|
46
|
-
@page = Factory(:page, :section => root_section)
|
47
|
-
@block = Factory(:html_block, :connect_to_page_id => @page.id, :connect_to_container => "main")
|
48
|
-
reset(:page)
|
49
|
-
|
50
|
-
page_version_count = Page::Version.count
|
51
|
-
|
52
|
-
assert_equal 2, @page.draft.version
|
53
|
-
|
54
|
-
delete :destroy, :id => @page.connectors.for_page_version(@page.draft.version).first.id
|
55
|
-
reset(:page)
|
56
|
-
|
57
|
-
assert_redirected_to @page.path
|
58
|
-
assert_incremented page_version_count, Page::Version.count
|
59
|
-
assert_equal 3, @page.draft.version
|
60
|
-
assert @page.connectors.for_page_version(@page.draft.version).empty?
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Cms::SampleBlocksController < Cms::ContentBlockController
|
4
|
-
end
|
5
|
-
|
6
|
-
class PermissionsForContentBlockControllerTest < ActionController::TestCase
|
7
|
-
include Cms::ControllerTestHelper
|
8
|
-
tests Cms::SampleBlocksController
|
9
|
-
|
10
|
-
# We're stubbing a lot because we *just* want to isolate the behaviour for checking permissions
|
11
|
-
def setup
|
12
|
-
given_there_is_a_content_type(Cms::SampleBlock)
|
13
|
-
|
14
|
-
login_as_cms_admin
|
15
|
-
@user = Cms::User.first
|
16
|
-
@controller.stubs(:current_user).returns(@user)
|
17
|
-
@controller.stubs(:render)
|
18
|
-
@controller.stubs(:model_class).returns(Cms::SampleBlock)
|
19
|
-
@controller.stubs(:set_default_category)
|
20
|
-
@controller.stubs(:blocks_path).returns("/cms/sample_block")
|
21
|
-
@controller.stubs(:block_path).returns("/cms/sample_block")
|
22
|
-
@controller.stubs(:redirect_to_first).returns("/cms/sample_block")
|
23
|
-
|
24
|
-
@block = stub_everything("block")
|
25
|
-
@block.stubs(:class).returns(Cms::SampleBlock)
|
26
|
-
@block.stubs(:as_of_draft_version).returns(@block)
|
27
|
-
@block.stubs(:as_of_version).returns(@block)
|
28
|
-
@block.stubs(:connected_pages).returns(stub(:all => stub))
|
29
|
-
|
30
|
-
Cms::SampleBlock.stubs(:find).returns(@block)
|
31
|
-
Cms::SampleBlock.stubs(:new).returns(@block)
|
32
|
-
Cms::SampleBlock.stubs(:paginate)
|
33
|
-
end
|
34
|
-
|
35
|
-
def expect_access_denied
|
36
|
-
@controller.expects(:render).with(has_entry(:status => 403))
|
37
|
-
end
|
38
|
-
|
39
|
-
def expect_success
|
40
|
-
expect_access_denied.never
|
41
|
-
end
|
42
|
-
|
43
|
-
test "GET index allows any user" do
|
44
|
-
expect_success
|
45
|
-
get :index
|
46
|
-
end
|
47
|
-
|
48
|
-
test "GET show allows any user" do
|
49
|
-
expect_success
|
50
|
-
get :show, :id => 5
|
51
|
-
end
|
52
|
-
|
53
|
-
test "GET new allows any user" do
|
54
|
-
expect_success
|
55
|
-
get :new
|
56
|
-
end
|
57
|
-
|
58
|
-
test "POST create allows any user" do
|
59
|
-
expect_success
|
60
|
-
post :create
|
61
|
-
end
|
62
|
-
|
63
|
-
test "GET version allows any user" do
|
64
|
-
expect_success
|
65
|
-
get :version, :id => 5, :version => 3
|
66
|
-
end
|
67
|
-
|
68
|
-
test "GET versions allows any user" do
|
69
|
-
expect_success
|
70
|
-
get :versions, :id => 5
|
71
|
-
end
|
72
|
-
|
73
|
-
test "GET usages allows any user" do
|
74
|
-
expect_success
|
75
|
-
get :usages, :id => 5
|
76
|
-
end
|
77
|
-
|
78
|
-
test "GET edit allows only users who are able to edit the block" do
|
79
|
-
@user.stubs(:able_to_edit?).with(@block).returns(false)
|
80
|
-
expect_access_denied
|
81
|
-
get :edit, :id => 5
|
82
|
-
|
83
|
-
@user.stubs(:able_to_edit?).with(@block).returns(true)
|
84
|
-
expect_success
|
85
|
-
get :edit, :id => 5
|
86
|
-
end
|
87
|
-
|
88
|
-
test "PUT update allows only users who are able to edit the block" do
|
89
|
-
@user.stubs(:able_to_edit?).with(@block).returns(false)
|
90
|
-
expect_access_denied
|
91
|
-
put :update, :id => 5
|
92
|
-
|
93
|
-
@user.stubs(:able_to_edit?).with(@block).returns(true)
|
94
|
-
expect_success
|
95
|
-
put :update, :id => 5
|
96
|
-
end
|
97
|
-
|
98
|
-
test "DELETE destroy allows only users who are able to publish the block" do
|
99
|
-
@user.stubs(:able_to_publish?).with(@block).returns(false)
|
100
|
-
expect_access_denied
|
101
|
-
delete :destroy, :id => 5
|
102
|
-
|
103
|
-
@user.stubs(:able_to_publish?).with(@block).returns(true)
|
104
|
-
expect_success
|
105
|
-
delete :destroy, :id => 5
|
106
|
-
end
|
107
|
-
|
108
|
-
test "PUT publish allows only users who are able to publish the block" do
|
109
|
-
@user.stubs(:able_to_publish?).with(@block).returns(false)
|
110
|
-
expect_access_denied
|
111
|
-
put :publish, :id => 5
|
112
|
-
|
113
|
-
@user.stubs(:able_to_publish?).with(@block).returns(true)
|
114
|
-
expect_success
|
115
|
-
put :publish, :id => 5
|
116
|
-
end
|
117
|
-
|
118
|
-
test "PUT revert_to allows only users who are able to publish the block" do
|
119
|
-
@user.stubs(:able_to_publish?).with(@block).returns(false)
|
120
|
-
expect_access_denied
|
121
|
-
put :revert_to, :id => 5, :version => 1
|
122
|
-
|
123
|
-
@user.stubs(:able_to_publish?).with(@block).returns(true)
|
124
|
-
expect_success
|
125
|
-
put :revert_to, :id => 5, :version => 1
|
126
|
-
end
|
127
|
-
end
|
@@ -1,351 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Cms
|
4
|
-
|
5
|
-
# This should be ported to features/content_pages.feature over time.
|
6
|
-
class ContentControllerTest < ActionController::TestCase
|
7
|
-
include Cms::ControllerTestHelper
|
8
|
-
|
9
|
-
def setup
|
10
|
-
given_there_is_a_guest_group
|
11
|
-
given_there_is_a_cmsadmin
|
12
|
-
given_there_is_a_sitemap
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_show_another_page
|
16
|
-
@page = Factory(:page, :section => root_section, :path => "/about", :name => "Test About", :template_file_name => "default.html.erb", :publish_on_save => true)
|
17
|
-
get :show, :path => "about"
|
18
|
-
assert_select "title", "Test About"
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_page_not_found_to_cms_admin
|
22
|
-
login_as_cms_admin
|
23
|
-
get :show, :path => "foo"
|
24
|
-
assert_response :not_found
|
25
|
-
assert_select "title", "Page Not Found"
|
26
|
-
assert_select "h2", "There is no page at /foo"
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_show_protected_page_to_privileged_user
|
30
|
-
create_protected_page
|
31
|
-
|
32
|
-
login_as @privileged_user
|
33
|
-
|
34
|
-
get :show, :path => "secret"
|
35
|
-
assert_response :success
|
36
|
-
assert_select "title", "Shhh... It's a Secret"
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_show_archived_page_to_user
|
40
|
-
create_archived_page
|
41
|
-
login_as_cms_admin
|
42
|
-
|
43
|
-
get :show, :path => "archived"
|
44
|
-
assert_response :success
|
45
|
-
assert_select "title", "Archived"
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_show_page_route
|
49
|
-
@page_template = Factory(:page_template, :name => "test_show_page_route")
|
50
|
-
@page = Factory(:page,
|
51
|
-
:section => root_section,
|
52
|
-
:template_file_name => "test_show_page_route.html.erb")
|
53
|
-
@portlet = DynamicPortlet.create!(:name => "Test",
|
54
|
-
:template => "<h1><%= @foo %></h1>",
|
55
|
-
:connect_to_page_id => @page.id, :connect_to_container => "main")
|
56
|
-
@page_route = @page.page_routes.create(:pattern => "/foo", :code => "@foo = params[:foo]")
|
57
|
-
|
58
|
-
reset(:page)
|
59
|
-
@page.publish!
|
60
|
-
|
61
|
-
get :show_page_route, :foo => "42", :_page_route_id => @page_route.id
|
62
|
-
assert_response :success
|
63
|
-
assert_select "h1", "42"
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_show_page_with_content
|
67
|
-
create_page_with_content
|
68
|
-
get :show, :path => "page_with_content"
|
69
|
-
assert_response :success
|
70
|
-
assert_select "h3", "TEST"
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_show_draft_page_with_content_as_editor
|
74
|
-
login_as_cms_admin
|
75
|
-
create_page_with_content
|
76
|
-
|
77
|
-
@block.update_attributes(:content => "<h3>I've been edited</h3>")
|
78
|
-
reset(:page, :block)
|
79
|
-
|
80
|
-
get :show, :path => "page_with_content"
|
81
|
-
assert_response :success
|
82
|
-
assert_select "h3", "I've been edited"
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_is_file
|
86
|
-
assert_is_file(true, "/system/file.pdf")
|
87
|
-
assert_is_file(true, "/system/file.txt")
|
88
|
-
assert_is_file(true, "/system/file.html")
|
89
|
-
assert_is_file(false, "/system/file")
|
90
|
-
end
|
91
|
-
|
92
|
-
protected
|
93
|
-
def assert_is_file(truth, path)
|
94
|
-
@request = mock()
|
95
|
-
@controller.expects(:request).returns(@request)
|
96
|
-
@request.expects(:url).returns(path)
|
97
|
-
assert_equal truth, @controller.send(:is_file?)
|
98
|
-
end
|
99
|
-
|
100
|
-
def create_protected_user_section_group
|
101
|
-
@protected_section = Factory(:section, :parent => root_section)
|
102
|
-
@secret_group = Factory(:group, :name => "Secret")
|
103
|
-
@secret_group.sections << @protected_section
|
104
|
-
@privileged_user = Factory(:user, :login => "privileged")
|
105
|
-
@privileged_user.groups << @secret_group
|
106
|
-
end
|
107
|
-
|
108
|
-
def create_protected_page
|
109
|
-
create_protected_user_section_group
|
110
|
-
@page = Factory(:page,
|
111
|
-
:section => @protected_section,
|
112
|
-
:path => "/secret",
|
113
|
-
:name => "Shhh... It's a Secret",
|
114
|
-
:template_file_name => "default.html.erb",
|
115
|
-
:publish_on_save => true)
|
116
|
-
end
|
117
|
-
|
118
|
-
def create_file
|
119
|
-
@file = mock_file(:content_type => "text/plain")
|
120
|
-
@file_block = Factory(:file_block, :attachment_section => root_section, :attachment_file => @file, :attachment_file_path => "/test.txt", :publish_on_save => true)
|
121
|
-
end
|
122
|
-
|
123
|
-
def create_protected_file
|
124
|
-
create_protected_user_section_group
|
125
|
-
create_file
|
126
|
-
reset(:file_block)
|
127
|
-
@file_block.update_attributes(:attachment_section => @protected_section)
|
128
|
-
reset(:file_block)
|
129
|
-
end
|
130
|
-
|
131
|
-
def create_archived_page
|
132
|
-
@page = Factory(:page,
|
133
|
-
:section => root_section,
|
134
|
-
:path => "/archived",
|
135
|
-
:name => "Archived",
|
136
|
-
:archived => true,
|
137
|
-
:template_file_name => "default.html.erb",
|
138
|
-
:publish_on_save => true)
|
139
|
-
end
|
140
|
-
|
141
|
-
def create_page_with_content
|
142
|
-
@page_template = Factory(:page_template, :name => "testing_editting_content")
|
143
|
-
|
144
|
-
@page = Factory(:page,
|
145
|
-
:section => root_section,
|
146
|
-
:path => "/page_with_content",
|
147
|
-
:template_file_name => "testing_editting_content.html.erb")
|
148
|
-
|
149
|
-
@block = HtmlBlock.create!(:name => "Test",
|
150
|
-
:content => "<h3>TEST</h3>",
|
151
|
-
:connect_to_page_id => @page.id,
|
152
|
-
:connect_to_container => "main")
|
153
|
-
|
154
|
-
reset(:page)
|
155
|
-
@page.publish!
|
156
|
-
|
157
|
-
end
|
158
|
-
|
159
|
-
end
|
160
|
-
|
161
|
-
# CMS Page Caching Enabled (Production Mode)
|
162
|
-
# Logged in as guest
|
163
|
-
# mysite.com/page -> serves cached page
|
164
|
-
# cms.mysite.com/page -> redirect to mysite.com/page
|
165
|
-
#
|
166
|
-
# Logged in as a registered user
|
167
|
-
# mysite.com/page -> serves cached page
|
168
|
-
# cms.mysite.com/page -> redirect to mysite.com/page
|
169
|
-
#
|
170
|
-
# Logged in as cms user
|
171
|
-
# mysite.com/page -> serves cached page
|
172
|
-
# cms.mysite.com/page -> renders cms page editor
|
173
|
-
class ContentCachingEnabledControllerTest < ActionController::TestCase
|
174
|
-
tests Cms::ContentController
|
175
|
-
include Cms::ControllerTestHelper
|
176
|
-
|
177
|
-
def setup
|
178
|
-
given_there_is_a_guest_group
|
179
|
-
given_there_is_a_cmsadmin
|
180
|
-
given_there_is_a_sitemap
|
181
|
-
ActionController::Base.perform_caching = true
|
182
|
-
@page = Factory(:page, :section => root_section, :name => "Test Page", :path => "/page", :publish_on_save => true)
|
183
|
-
@registered_user = Factory(:user)
|
184
|
-
@registered_user.groups << Group.guest
|
185
|
-
end
|
186
|
-
|
187
|
-
def teardown
|
188
|
-
ActionController::Base.perform_caching = false
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_guest_user_views_page_on_public_site
|
192
|
-
@request.host = "mysite.com"
|
193
|
-
get :show, :path => "page"
|
194
|
-
assert_response :success
|
195
|
-
assert_select "title", "Test Page"
|
196
|
-
end
|
197
|
-
|
198
|
-
def test_guest_user_views_page_on_cms_site
|
199
|
-
@request.host = "cms.mysite.com"
|
200
|
-
|
201
|
-
# Actually simulates http://cms.mysite.com/?path=page , but we can't test domains in functional specs
|
202
|
-
get :show, :path => "page", :use_route => false
|
203
|
-
|
204
|
-
# Really should go to "http://mysite.com/page" instead.
|
205
|
-
assert_redirected_to "http://mysite.com/?path=page"
|
206
|
-
end
|
207
|
-
|
208
|
-
def test_registered_user_views_page_on_public_site
|
209
|
-
login_as @registered_user
|
210
|
-
@request.host = "mysite.com"
|
211
|
-
|
212
|
-
get :show, :path => "page"
|
213
|
-
|
214
|
-
assert_response :success
|
215
|
-
assert_select "title", "Test Page"
|
216
|
-
end
|
217
|
-
|
218
|
-
def test_registered_user_views_page_on_cms_site
|
219
|
-
login_as @registered_user
|
220
|
-
@request.host = "cms.mysite.com"
|
221
|
-
|
222
|
-
# Simulates http://cms.mysite.com/?path=page rather than http://cms.mysite.com/page
|
223
|
-
get :show, :path => "page", :use_route => false
|
224
|
-
|
225
|
-
assert_redirected_to "http://mysite.com/?path=page"
|
226
|
-
end
|
227
|
-
|
228
|
-
def test_cms_user_views_page_on_public_site
|
229
|
-
login_as_cms_admin
|
230
|
-
@request.session[:page_mode] = "edit"
|
231
|
-
@request.host = "mysite.com"
|
232
|
-
|
233
|
-
get :show, :path => "page"
|
234
|
-
|
235
|
-
assert_response :success
|
236
|
-
assert_select "title", "Test Page"
|
237
|
-
assert_select "iframe", {:count => 0}
|
238
|
-
end
|
239
|
-
|
240
|
-
def test_cms_user_views_page_on_cms_site_with_caching
|
241
|
-
login_as_cms_admin
|
242
|
-
@request.session[:page_mode] = "edit"
|
243
|
-
@request.host = "cms.mysite.com"
|
244
|
-
|
245
|
-
get :show, :path => "page", :use_route => false
|
246
|
-
|
247
|
-
assert_response :success
|
248
|
-
assert_select "title", "Test Page"
|
249
|
-
assert_select "iframe"
|
250
|
-
end
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
# CMS Page Caching Disabled (Development Mode)
|
255
|
-
# Logged in as guest
|
256
|
-
# mysite.com/page -> renders page
|
257
|
-
# cms.mysite.com/page -> renders page
|
258
|
-
#
|
259
|
-
# Logged in as a registered user
|
260
|
-
# mysite.com/page -> renders page
|
261
|
-
# cms.mysite.com/page -> renders page
|
262
|
-
#
|
263
|
-
# Logged in as cms user
|
264
|
-
# mysite.com/page -> renders cms page editor
|
265
|
-
# cms.mysite.com/page -> renders cms page editor
|
266
|
-
class ContentCachingDisabledControllerTest < ActionController::TestCase
|
267
|
-
tests Cms::ContentController
|
268
|
-
include Cms::ControllerTestHelper
|
269
|
-
|
270
|
-
def setup
|
271
|
-
given_there_is_a_guest_group
|
272
|
-
given_there_is_a_cmsadmin
|
273
|
-
given_there_is_a_sitemap
|
274
|
-
ActionController::Base.perform_caching = false
|
275
|
-
@page = Factory(:page, :section => root_section, :name => "Test Page", :path => "/page", :publish_on_save => true)
|
276
|
-
@registered_user = Factory(:user)
|
277
|
-
@registered_user.groups << Group.guest
|
278
|
-
end
|
279
|
-
|
280
|
-
def test_guest_user_views_page_on_public_site
|
281
|
-
@request.host = "mysite.com"
|
282
|
-
get :show, :path => "page"
|
283
|
-
assert_response :success
|
284
|
-
assert_select "title", "Test Page"
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_guest_user_views_page_on_cms_site
|
288
|
-
@request.host = "mysite.com"
|
289
|
-
get :show, :path => "page"
|
290
|
-
assert_response :success
|
291
|
-
assert_select "title", "Test Page"
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_registered_user_views_page_on_public_site
|
295
|
-
login_as @registered_user
|
296
|
-
@request.host = "mysite.com"
|
297
|
-
|
298
|
-
get :show, :path => "page"
|
299
|
-
|
300
|
-
assert_response :success
|
301
|
-
assert_select "title", "Test Page"
|
302
|
-
end
|
303
|
-
|
304
|
-
def test_registered_user_views_page_on_cms_site
|
305
|
-
login_as @registered_user
|
306
|
-
@request.host = "mysite.com"
|
307
|
-
|
308
|
-
get :show, :path => "page"
|
309
|
-
|
310
|
-
assert_response :success
|
311
|
-
assert_select "title", "Test Page"
|
312
|
-
end
|
313
|
-
|
314
|
-
def test_cms_user_views_page_on_public_site
|
315
|
-
login_as_cms_admin
|
316
|
-
@request.session[:page_mode] = "edit"
|
317
|
-
@request.host = "mysite.com"
|
318
|
-
|
319
|
-
get :show, :path => "page"
|
320
|
-
|
321
|
-
assert_response :success
|
322
|
-
assert_select "title", "Test Page"
|
323
|
-
assert_select "iframe"
|
324
|
-
end
|
325
|
-
|
326
|
-
def test_cms_user_views_page_on_cms_site
|
327
|
-
login_as_cms_admin
|
328
|
-
@request.session[:page_mode] = "edit"
|
329
|
-
@request.host = "cms.mysite.com"
|
330
|
-
|
331
|
-
get :show, :path => "page", :use_route => false
|
332
|
-
|
333
|
-
assert_response :success
|
334
|
-
assert_select "title", "Test Page"
|
335
|
-
assert_select "iframe"
|
336
|
-
end
|
337
|
-
|
338
|
-
test "When portlets throw a generic error, the page should still render the other content." do
|
339
|
-
@page = Factory(:page, :section => root_section, :path => "/about", :name => "Test About", :template_file_name => "default.html.erb", :publish_on_save => true)
|
340
|
-
@portlet_render = DynamicPortlet.create!(:name => "Test", :connect_to_page_id => @page.id, :connect_to_container => "main", :template => '<p id="hi">hello</p>')
|
341
|
-
@portlet_raise_generic = DynamicPortlet.create!(:name => "Test", :connect_to_page_id => @page.id, :connect_to_container => "main", :code => 'raise')
|
342
|
-
reset(:page)
|
343
|
-
|
344
|
-
get :show, :path => "about"
|
345
|
-
|
346
|
-
|
347
|
-
assert_select "#hi", "hello"
|
348
|
-
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|