browsercms 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/app/controllers/cms/content_block_controller.rb +2 -2
  2. data/app/controllers/cms/section_nodes_controller.rb +6 -1
  3. data/app/controllers/cms/sections_controller.rb +1 -1
  4. data/app/helpers/cms/application_helper.rb +1 -1
  5. data/app/helpers/cms/content_block_helper.rb +27 -0
  6. data/app/helpers/cms/section_nodes_helper.rb +43 -5
  7. data/app/models/abstract_file_block.rb +16 -1
  8. data/app/models/attachment.rb +17 -35
  9. data/app/models/file_block.rb +0 -12
  10. data/app/models/image_block.rb +0 -12
  11. data/app/models/link.rb +4 -21
  12. data/app/models/page.rb +31 -34
  13. data/app/models/section.rb +82 -44
  14. data/app/models/section_node.rb +39 -24
  15. data/app/models/user.rb +5 -0
  16. data/app/views/cms/blocks/index.html.erb +4 -4
  17. data/app/views/cms/file_blocks/_form.html.erb +1 -1
  18. data/app/views/cms/image_blocks/_form.html.erb +1 -1
  19. data/app/views/cms/section_nodes/_link.html.erb +6 -3
  20. data/app/views/cms/section_nodes/_node.html.erb +11 -1
  21. data/app/views/cms/section_nodes/_page.html.erb +13 -7
  22. data/app/views/cms/section_nodes/_section.html.erb +24 -8
  23. data/app/views/cms/section_nodes/index.html.erb +28 -16
  24. data/app/views/layouts/templates/default.html.erb +17 -0
  25. data/browsercms.gemspec +28 -1413
  26. data/db/migrate/20120117144039_browsercms315.rb +94 -0
  27. data/db/migrate/{20081114172307_load_seed_data.rb → 20121114172307_load_seeds.rb} +8 -1
  28. data/lib/acts_as_list.rb +1 -1
  29. data/lib/browsercms.rb +2 -0
  30. data/lib/cms/addressable.rb +83 -0
  31. data/lib/cms/behaviors/attaching.rb +44 -24
  32. data/lib/cms/behaviors/connecting.rb +2 -1
  33. data/lib/cms/behaviors/publishing.rb +12 -3
  34. data/lib/cms/behaviors/versioning.rb +83 -53
  35. data/lib/cms/content_rendering_support.rb +3 -3
  36. data/lib/cms/error_pages.rb +8 -0
  37. data/lib/cms/init.rb +5 -3
  38. data/lib/cms/version.rb +1 -1
  39. data/templates/blank.rb +2 -0
  40. data/templates/demo.rb +2 -0
  41. data/templates/module.rb +2 -0
  42. data/test/custom_assertions.rb +7 -1
  43. data/test/factories.rb +3 -1
  44. data/test/factories/sitemap_factories.rb +28 -0
  45. data/test/fixtures/connectors.yml +97 -0
  46. data/test/fixtures/content_type_groups.yml +13 -0
  47. data/test/fixtures/content_types.yml +50 -0
  48. data/test/fixtures/dynamic_view_versions.yml +26 -0
  49. data/test/fixtures/dynamic_views.yml +26 -0
  50. data/test/fixtures/group_permissions.yml +16 -0
  51. data/test/fixtures/group_sections.yml +31 -0
  52. data/test/fixtures/group_type_permissions.yml +11 -0
  53. data/test/fixtures/group_types.yml +25 -0
  54. data/test/fixtures/groups.yml +25 -0
  55. data/test/fixtures/html_block_versions.yml +67 -0
  56. data/test/fixtures/html_blocks.yml +63 -0
  57. data/test/fixtures/page_versions.yml +265 -0
  58. data/test/fixtures/pages.yml +85 -0
  59. data/test/fixtures/permissions.yml +28 -0
  60. data/test/fixtures/section_nodes.yml +46 -0
  61. data/test/fixtures/sections.yml +19 -0
  62. data/test/fixtures/sites.yml +9 -0
  63. data/test/fixtures/user_group_memberships.yml +11 -0
  64. data/test/fixtures/users.yml +15 -0
  65. data/test/functional/cms/content_controller_test.rb +6 -1
  66. data/test/functional/cms/file_blocks_controller_test.rb +1 -0
  67. data/test/functional/cms/html_blocks_controller_test.rb +1 -0
  68. data/test/functional/cms/image_blocks_controller_test.rb +39 -32
  69. data/test/functional/cms/section_nodes_controller_test.rb +48 -20
  70. data/test/functional/cms/sections_controller_test.rb +3 -1
  71. data/test/functional/tests/pretend_controller_test.rb +6 -3
  72. data/test/integration/cms/ckeditor_test.rb +5 -2
  73. data/test/integration/sitemap_performance_test.rb +26 -0
  74. data/test/selenium-core/Blank.html +7 -0
  75. data/test/selenium-core/InjectedRemoteRunner.html +8 -0
  76. data/test/selenium-core/RemoteRunner.html +110 -0
  77. data/test/selenium-core/SeleniumLog.html +109 -0
  78. data/test/selenium-core/TestPrompt.html +145 -0
  79. data/test/selenium-core/TestRunner-splash.html +55 -0
  80. data/test/selenium-core/TestRunner.hta +176 -0
  81. data/test/selenium-core/TestRunner.html +176 -0
  82. data/test/selenium-core/domviewer/butmin.gif +0 -0
  83. data/test/selenium-core/domviewer/butplus.gif +0 -0
  84. data/test/selenium-core/domviewer/domviewer.css +298 -0
  85. data/test/selenium-core/domviewer/domviewer.html +16 -0
  86. data/test/selenium-core/domviewer/selenium-domviewer.js +205 -0
  87. data/test/selenium-core/icons/all.png +0 -0
  88. data/test/selenium-core/icons/continue.png +0 -0
  89. data/test/selenium-core/icons/continue_disabled.png +0 -0
  90. data/test/selenium-core/icons/pause.png +0 -0
  91. data/test/selenium-core/icons/pause_disabled.png +0 -0
  92. data/test/selenium-core/icons/selected.png +0 -0
  93. data/test/selenium-core/icons/step.png +0 -0
  94. data/test/selenium-core/icons/step_disabled.png +0 -0
  95. data/test/selenium-core/iedoc-core.xml +1515 -0
  96. data/test/selenium-core/iedoc.xml +1469 -0
  97. data/test/selenium-core/lib/cssQuery/cssQuery-p.js +6 -0
  98. data/test/selenium-core/lib/cssQuery/src/cssQuery-level2.js +142 -0
  99. data/test/selenium-core/lib/cssQuery/src/cssQuery-level3.js +150 -0
  100. data/test/selenium-core/lib/cssQuery/src/cssQuery-standard.js +53 -0
  101. data/test/selenium-core/lib/cssQuery/src/cssQuery.js +356 -0
  102. data/test/selenium-core/lib/prototype.js +2006 -0
  103. data/test/selenium-core/lib/scriptaculous/builder.js +101 -0
  104. data/test/selenium-core/lib/scriptaculous/controls.js +815 -0
  105. data/test/selenium-core/lib/scriptaculous/dragdrop.js +915 -0
  106. data/test/selenium-core/lib/scriptaculous/effects.js +958 -0
  107. data/test/selenium-core/lib/scriptaculous/scriptaculous.js +47 -0
  108. data/test/selenium-core/lib/scriptaculous/slider.js +283 -0
  109. data/test/selenium-core/lib/scriptaculous/unittest.js +383 -0
  110. data/test/selenium-core/scripts/find_matching_child.js +69 -0
  111. data/test/selenium-core/scripts/htmlutils.js +894 -0
  112. data/test/selenium-core/scripts/injection.html +72 -0
  113. data/test/selenium-core/scripts/js2html.js +70 -0
  114. data/test/selenium-core/scripts/narcissus-defs.js +175 -0
  115. data/test/selenium-core/scripts/narcissus-exec.js +1054 -0
  116. data/test/selenium-core/scripts/narcissus-parse.js +1003 -0
  117. data/test/selenium-core/scripts/se2html.js +63 -0
  118. data/test/selenium-core/scripts/selenium-api.js +2409 -0
  119. data/test/selenium-core/scripts/selenium-browserbot.js +2203 -0
  120. data/test/selenium-core/scripts/selenium-browserdetect.js +150 -0
  121. data/test/selenium-core/scripts/selenium-commandhandlers.js +377 -0
  122. data/test/selenium-core/scripts/selenium-executionloop.js +175 -0
  123. data/test/selenium-core/scripts/selenium-logging.js +147 -0
  124. data/test/selenium-core/scripts/selenium-remoterunner.js +571 -0
  125. data/test/selenium-core/scripts/selenium-testrunner.js +1333 -0
  126. data/test/selenium-core/scripts/selenium-version.js +5 -0
  127. data/test/selenium-core/scripts/user-extensions.js +3 -0
  128. data/test/selenium-core/scripts/user-extensions.js.sample +75 -0
  129. data/test/selenium-core/scripts/xmlextras.js +153 -0
  130. data/test/selenium-core/selenium-logo.png +0 -0
  131. data/test/selenium-core/selenium-test.css +43 -0
  132. data/test/selenium-core/selenium.css +299 -0
  133. data/test/selenium-core/xpath/dom.js +428 -0
  134. data/test/selenium-core/xpath/misc.js +252 -0
  135. data/test/selenium-core/xpath/xpath.js +2223 -0
  136. data/test/selenium/_login_as_cmsadmin.rsel +4 -0
  137. data/test/selenium/dashboard.rsel +5 -0
  138. data/test/selenium/html_blocks.rsel +4 -0
  139. data/test/selenium/login/failed_login.rsel +8 -0
  140. data/test/selenium/login/successful_login.rsel +9 -0
  141. data/test/selenium/page_templates.rsel +12 -0
  142. data/test/selenium/pages/edit_properties.rsel +5 -0
  143. data/test/selenium/site/view_home_page.rsel +4 -0
  144. data/test/selenium/sitemap/move_page.rsel +9 -0
  145. data/test/selenium/sitemap/open_section.rsel +6 -0
  146. data/test/selenium/sitemap/select_page.rsel +12 -0
  147. data/test/selenium/sitemap/select_section.rsel +17 -0
  148. data/test/test_helper.rb +30 -12
  149. data/test/unit/behaviors/attaching_test.rb +4 -6
  150. data/test/unit/behaviors/connectable_test.rb +29 -0
  151. data/test/unit/behaviors/publishable_test.rb +40 -9
  152. data/test/unit/behaviors/versioning_test.rb +36 -0
  153. data/test/unit/helpers/menu_helper_test.rb +5 -2
  154. data/test/unit/helpers/page_helper_test.rb +2 -0
  155. data/test/unit/lib/cms/sitemap_test.rb +206 -0
  156. data/test/unit/models/attachment_test.rb +51 -31
  157. data/test/unit/models/file_block_test.rb +74 -55
  158. data/test/unit/models/link_test.rb +44 -0
  159. data/test/unit/models/page_test.rb +290 -224
  160. data/test/unit/models/sections_test.rb +144 -44
  161. data/test/unit/models/user_test.rb +28 -18
  162. metadata +581 -350
  163. data/app/views/cms/section_nodes/_section_node.html.erb +0 -10
  164. data/test/unit/models/section_node_test.rb +0 -92
@@ -1,10 +0,0 @@
1
- <% r = defined?(root) %>
2
- <% if section_node.node && %w[Link Page Section].include?(section_node.node_type) %>
3
- <%= render :partial => section_node.node_type.underscore, :locals => {
4
- :section_node => section_node,
5
- :node => section_node.node,
6
- :display => display,
7
- :root => r
8
- }
9
- %>
10
- <% end %>
@@ -1,92 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '/../../test_helper')
2
-
3
- class SectionNodeTest < ActiveSupport::TestCase
4
- def setup
5
- @parent = Factory(:section, :parent => root_section, :name => "Parent")
6
- @a = Factory(:section, :parent => @parent, :name => "A")
7
- @a1 = Factory(:page, :section => @a, :name => "A1")
8
- @a2 = Factory(:page, :section => @a, :name => "A2")
9
- @a3 = Factory(:page, :section => @a, :name => "A3")
10
- @b = Factory(:section, :parent => @parent, :name => "B")
11
- @b1 = Factory(:page, :section => @b, :name => "B1")
12
- @b2 = Factory(:page, :section => @b, :name => "B2")
13
- @b3 = Factory(:page, :section => @b, :name => "B3")
14
-
15
- @node_a = @a.node
16
- @node_b = @b.node
17
- @node_a1 = @a1.section_node
18
- @node_a2 = @a2.section_node
19
- @node_a3 = @a3.section_node
20
- @node_b1 = @b1.section_node
21
- @node_b2 = @b2.section_node
22
- @node_b3 = @b3.section_node
23
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
24
- end
25
- def test_reorder_nodes_within_same_section
26
- @node_a2.move_to(@a, 1)
27
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
28
- log_table_without_stamps(SectionNode)
29
- assert_properties(@node_a, :section_id => @parent.id, :node_type => "Section", :node_id => @a.id, :position => 1)
30
- assert_properties(@node_b, :section_id => @parent.id, :node_type => "Section", :node_id => @b.id, :position => 2)
31
- assert_properties(@node_a1, :section_id => @a.id, :node_type => "Page", :node_id => @a1.id, :position => 2)
32
- assert_properties(@node_a2, :section_id => @a.id, :node_type => "Page", :node_id => @a2.id, :position => 1)
33
- assert_properties(@node_a3, :section_id => @a.id, :node_type => "Page", :node_id => @a3.id, :position => 3)
34
- assert_properties(@node_b1, :section_id => @b.id, :node_type => "Page", :node_id => @b1.id, :position => 1)
35
- assert_properties(@node_b2, :section_id => @b.id, :node_type => "Page", :node_id => @b2.id, :position => 2)
36
- assert_properties(@node_b3, :section_id => @b.id, :node_type => "Page", :node_id => @b3.id, :position => 3)
37
- end
38
- def test_move_nodes_to_different_section
39
- @node_a2.move_to(@b, 2)
40
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
41
- assert_properties(@node_a, :section_id => @parent.id, :node_type => "Section", :node_id => @a.id, :position => 1)
42
- assert_properties(@node_b, :section_id => @parent.id, :node_type => "Section", :node_id => @b.id, :position => 2)
43
- assert_properties(@node_a1, :section_id => @a.id, :node_type => "Page", :node_id => @a1.id, :position => 1)
44
- assert_properties(@node_a2, :section_id => @b.id, :node_type => "Page", :node_id => @a2.id, :position => 2)
45
- assert_properties(@node_a3, :section_id => @a.id, :node_type => "Page", :node_id => @a3.id, :position => 2)
46
- assert_properties(@node_b1, :section_id => @b.id, :node_type => "Page", :node_id => @b1.id, :position => 1)
47
- assert_properties(@node_b2, :section_id => @b.id, :node_type => "Page", :node_id => @b2.id, :position => 3)
48
- assert_properties(@node_b3, :section_id => @b.id, :node_type => "Page", :node_id => @b3.id, :position => 4)
49
- end
50
- def test_move_nodes_to_beginning_of_different_section
51
- @node_a2.move_to(@b, 1)
52
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
53
- assert_properties(@node_a, :section_id => @parent.id, :node_type => "Section", :node_id => @a.id, :position => 1)
54
- assert_properties(@node_b, :section_id => @parent.id, :node_type => "Section", :node_id => @b.id, :position => 2)
55
- assert_properties(@node_a1, :section_id => @a.id, :node_type => "Page", :node_id => @a1.id, :position => 1)
56
- assert_properties(@node_a2, :section_id => @b.id, :node_type => "Page", :node_id => @a2.id, :position => 1)
57
- assert_properties(@node_a3, :section_id => @a.id, :node_type => "Page", :node_id => @a3.id, :position => 2)
58
- assert_properties(@node_b1, :section_id => @b.id, :node_type => "Page", :node_id => @b1.id, :position => 2)
59
- assert_properties(@node_b2, :section_id => @b.id, :node_type => "Page", :node_id => @b2.id, :position => 3)
60
- assert_properties(@node_b3, :section_id => @b.id, :node_type => "Page", :node_id => @b3.id, :position => 4)
61
- end
62
- def test_move_nodes_to_end_of_different_section
63
- @node_a2.move_to(@b, 99)
64
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
65
- assert_properties(@node_a, :section_id => @parent.id, :node_type => "Section", :node_id => @a.id, :position => 1)
66
- assert_properties(@node_b, :section_id => @parent.id, :node_type => "Section", :node_id => @b.id, :position => 2)
67
- assert_properties(@node_a1, :section_id => @a.id, :node_type => "Page", :node_id => @a1.id, :position => 1)
68
- assert_properties(@node_a2, :section_id => @b.id, :node_type => "Page", :node_id => @a2.id, :position => 4)
69
- assert_properties(@node_a3, :section_id => @a.id, :node_type => "Page", :node_id => @a3.id, :position => 2)
70
- assert_properties(@node_b1, :section_id => @b.id, :node_type => "Page", :node_id => @b1.id, :position => 1)
71
- assert_properties(@node_b2, :section_id => @b.id, :node_type => "Page", :node_id => @b2.id, :position => 2)
72
- assert_properties(@node_b3, :section_id => @b.id, :node_type => "Page", :node_id => @b3.id, :position => 3)
73
- end
74
- def test_put_page_at_the_bottom_when_section_is_changed
75
- @a2.update_attributes(:section_id => @b.id)
76
- reset(:node_a, :node_a1, :node_a2, :node_a3, :node_b, :node_b1, :node_b2, :node_b3)
77
- assert_properties(@node_a, :section_id => @parent.id, :node_type => "Section", :node_id => @a.id, :position => 1)
78
- assert_properties(@node_b, :section_id => @parent.id, :node_type => "Section", :node_id => @b.id, :position => 2)
79
- assert_properties(@node_a1, :section_id => @a.id, :node_type => "Page", :node_id => @a1.id, :position => 1)
80
- assert_properties(@node_a2, :section_id => @b.id, :node_type => "Page", :node_id => @a2.id, :position => 4)
81
- assert_properties(@node_a3, :section_id => @a.id, :node_type => "Page", :node_id => @a3.id, :position => 2)
82
- assert_properties(@node_b1, :section_id => @b.id, :node_type => "Page", :node_id => @b1.id, :position => 1)
83
- assert_properties(@node_b2, :section_id => @b.id, :node_type => "Page", :node_id => @b2.id, :position => 2)
84
- assert_properties(@node_b3, :section_id => @b.id, :node_type => "Page", :node_id => @b3.id, :position => 3)
85
- end
86
- def test_find_ancestors
87
- assert root_section.ancestors.empty?
88
- assert_equal [root_section], @parent.ancestors
89
- assert_equal [root_section, @parent], @a.ancestors
90
- assert_equal [root_section, @parent, @a], @a1.ancestors
91
- end
92
- end