zena 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (407) hide show
  1. data/History.txt +80 -25
  2. data/Rakefile +2 -2
  3. data/app/controllers/columns_controller.rb +2 -2
  4. data/app/controllers/nodes_controller.rb +22 -29
  5. data/app/controllers/user_sessions_controller.rb +35 -10
  6. data/app/controllers/users_controller.rb +2 -2
  7. data/app/controllers/versions_controller.rb +2 -2
  8. data/app/models/group.rb +15 -1
  9. data/app/models/node.rb +109 -8
  10. data/app/models/role.rb +4 -0
  11. data/app/models/site.rb +64 -58
  12. data/app/models/template.rb +1 -1
  13. data/app/models/user.rb +135 -29
  14. data/app/models/user_session.rb +0 -1
  15. data/app/models/virtual_class.rb +11 -6
  16. data/app/views/columns/_form.html.erb +3 -1
  17. data/app/views/columns/_li.html.erb +1 -1
  18. data/app/views/columns/create.rjs +1 -1
  19. data/app/views/groups/_form.rhtml +16 -13
  20. data/app/views/relations/_form.erb +18 -6
  21. data/app/views/sites/_form.erb +12 -6
  22. data/app/views/users/_form.rhtml +23 -8
  23. data/app/views/users/_li.rhtml +14 -3
  24. data/app/views/users/index.rhtml +1 -1
  25. data/app/views/virtual_classes/_form.erb +12 -2
  26. data/app/views/zafu/default/Node-+login.zafu +8 -1
  27. data/app/views/zafu/default/Node-+search.zafu +1 -1
  28. data/bricks/acls/lib/bricks/acls.rb +1 -0
  29. data/bricks/acls/zena/migrate/20130903150356_longer_names_for_acl.rb +9 -0
  30. data/bricks/acls/zena/test/integration/acl_integration_test.rb +2 -2
  31. data/bricks/currency/lib/bricks/currency.rb +120 -0
  32. data/bricks/currency/zena/test/unit/currency_test.rb +43 -0
  33. data/bricks/fs_skin/lib/bricks/fs_skin.rb +1 -1
  34. data/bricks/fs_skin/zena/skins/blog/Node-+search.zafu +1 -1
  35. data/bricks/fs_skin/zena/skins/blog/Node.zafu +1 -1
  36. data/bricks/fs_skin/zena/test/unit/fs_skin_view_test.rb +35 -0
  37. data/bricks/pdf/lib/bricks/pdf.rb +1 -1
  38. data/bricks/sphinx/lib/bricks/sphinx.rb +2 -0
  39. data/bricks/sphinx/zena/init.rb +14 -0
  40. data/bricks/tags/zena/test/zafu/tags.yml +5 -1
  41. data/bricks/worker/lib/bricks/worker.rb +3 -2
  42. data/bricks/zena/zena/migrate/20130829093753_add_versioned_flag_to_column.rb +10 -0
  43. data/bricks/zena/zena/migrate/20130903084909_count_login_attempts.rb +11 -0
  44. data/bricks/zena/zena/migrate/20131104153126_index_fullpath.rb +10 -0
  45. data/bricks/zena/zena/migrate/20131104210011_rebuild_fullpath_after_change.rb +10 -0
  46. data/bricks/zena/zena/migrate/20131105160420_add_skin_id_to_sites.rb +9 -0
  47. data/bricks/zena/zena/migrate/20131105175822_add_profile_to_users.rb +11 -0
  48. data/bricks/zena/zena/migrate/20140213120038_fix_idx_scope.rb +13 -0
  49. data/bricks/zena/zena/migrate/20140628140247_add_site_readonly.rb +9 -0
  50. data/config/bricks.yml +8 -4
  51. data/config/gems.yml +5 -3
  52. data/db/init/base/skins/default/Node-+login.zafu +8 -1
  53. data/db/init/base/skins/default/Node-+search.zafu +1 -1
  54. data/lib/bricks/loader.rb +5 -5
  55. data/lib/gettext_strings.rb +3 -0
  56. data/lib/tasks/zena.rake +25 -22
  57. data/lib/zafu/process/context.rb +4 -0
  58. data/lib/zena/acts/secure_node.rb +3 -3
  59. data/lib/zena/app.rb +1 -0
  60. data/lib/zena/deploy.rb +1 -1
  61. data/lib/zena/deploy/template.rb +1 -1
  62. data/lib/zena/foxy_parser.rb +5 -2
  63. data/lib/zena/info.rb +1 -1
  64. data/lib/zena/site_worker.rb +2 -2
  65. data/lib/zena/test_controller.rb +5 -2
  66. data/lib/zena/use/action.rb +9 -2
  67. data/lib/zena/use/ajax.rb +20 -4
  68. data/lib/zena/use/ancestry.rb +89 -15
  69. data/lib/zena/use/authlogic.rb +8 -2
  70. data/lib/zena/use/context.rb +1 -0
  71. data/lib/zena/use/display.rb +1 -97
  72. data/lib/zena/use/forms.rb +28 -8
  73. data/lib/zena/use/html_tags.rb +16 -7
  74. data/lib/zena/use/i18n.rb +1 -1
  75. data/lib/zena/use/prop_eval.rb +6 -1
  76. data/lib/zena/use/query_node.rb +69 -4
  77. data/lib/zena/use/recursion.rb +1 -1
  78. data/lib/zena/use/refactor.rb +5 -2
  79. data/lib/zena/use/relations.rb +1 -0
  80. data/lib/zena/use/rendering.rb +7 -4
  81. data/lib/zena/use/test_helper.rb +8 -4
  82. data/lib/zena/use/upload.rb +14 -0
  83. data/lib/zena/use/urls.rb +39 -23
  84. data/lib/zena/use/version_hash.rb +5 -2
  85. data/lib/zena/use/workflow.rb +116 -70
  86. data/lib/zena/use/zafu_eval.rb +41 -0
  87. data/lib/zena/use/zafu_safe_definitions.rb +1 -0
  88. data/lib/zena/use/zafu_templates.rb +32 -26
  89. data/lib/zena/use/zazen.rb +8 -7
  90. data/locale/app.pot +5 -1
  91. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  92. data/locale/de/zena.po +385 -281
  93. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  94. data/locale/en/zena.po +378 -271
  95. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  96. data/locale/fr/zena.po +387 -272
  97. data/locale/it/LC_MESSAGES/zena.mo +0 -0
  98. data/locale/it/zena.po +433 -404
  99. data/locale/zena.pot +362 -268
  100. data/public/javascripts/grid.js +280 -104
  101. data/public/javascripts/zena.js +43 -15
  102. data/public/stylesheets/admin.css +8 -2
  103. data/public/stylesheets/grid.css +5 -2
  104. data/public/stylesheets/popup.css +1 -1
  105. data/test/fixtures/files/TestNode.zafu +51 -0
  106. data/test/functional/nodes_controller_test.rb +20 -5
  107. data/test/functional/user_sessions_controller_test.rb +41 -6
  108. data/test/functional/users_controller_test.rb +1 -2
  109. data/test/integration/navigation_test.rb +22 -4
  110. data/test/integration/query_node/basic.yml +7 -0
  111. data/test/integration/query_node/complex.yml +1 -1
  112. data/test/integration/query_node/errors.yml +1 -1
  113. data/test/integration/query_node/filters.yml +34 -1
  114. data/test/integration/query_node/relations.yml +6 -13
  115. data/test/integration/query_node_test.rb +22 -3
  116. data/test/integration/zafu_compiler/action.yml +1 -1
  117. data/test/integration/zafu_compiler/alias_site.yml +52 -0
  118. data/test/integration/zafu_compiler/complex.yml +1 -1
  119. data/test/integration/zafu_compiler/complex_ok.yml +5 -5
  120. data/test/integration/zafu_compiler/context.yml +1 -1
  121. data/test/integration/zafu_compiler/display.yml +56 -5
  122. data/test/integration/zafu_compiler/forms.yml +35 -2
  123. data/test/integration/zafu_compiler/meta.yml +4 -0
  124. data/test/integration/zafu_compiler/rubyless.yml +1 -1
  125. data/test/integration/zafu_compiler/safe_definitions.yml +4 -0
  126. data/test/integration/zafu_compiler/security.yml +10 -0
  127. data/test/integration/zafu_compiler/site.yml +5 -1
  128. data/test/integration/zafu_compiler/urls.yml +8 -2
  129. data/test/integration/zafu_compiler/zafu_attributes.yml +2 -1
  130. data/test/integration/zafu_compiler/zazen.yml +4 -0
  131. data/test/integration/zafu_compiler_test.rb +47 -4
  132. data/test/selenium/Grid/grid1.rsel +8 -8
  133. data/test/sites/complex/sites.yml +2 -2
  134. data/test/sites/complex/users.yml +1 -0
  135. data/test/sites/zena/columns.yml +4 -0
  136. data/test/sites/zena/sites.yml +1 -0
  137. data/test/sites/zena/users.yml +1 -0
  138. data/test/unit/node_test.rb +53 -5
  139. data/test/unit/note_test.rb +1 -1
  140. data/test/unit/relation_proxy_test.rb +20 -0
  141. data/test/unit/role_test.rb +2 -0
  142. data/test/unit/site_test.rb +28 -6
  143. data/test/unit/user_test.rb +332 -1
  144. data/test/unit/virtual_class_test.rb +55 -0
  145. data/test/unit/workflow_test.rb +175 -0
  146. data/test/unit/zena/use/ancestry_test.rb +52 -10
  147. data/test/unit/zena/use/prop_eval_test.rb +44 -0
  148. data/test/unit/zena/use/rendering_test.rb +48 -2
  149. data/test/unit/zena/use/upload_test.rb +15 -13
  150. data/test/unit/zena/use/urls_test.rb +1 -0
  151. data/vendor/plugins/ar_mysql_full_text/lib/ar_mysql_full_text.rb +39 -25
  152. data/zena.gemspec +69 -307
  153. metadata +143 -368
  154. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +0 -24
  155. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +0 -58
  156. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +0 -88
  157. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +0 -27
  158. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +0 -23
  159. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +0 -19
  160. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +0 -19
  161. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +0 -16
  162. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +0 -16
  163. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +0 -16
  164. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +0 -18
  165. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +0 -18
  166. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +0 -16
  167. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +0 -18
  168. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +0 -16
  169. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +0 -16
  170. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +0 -16
  171. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +0 -16
  172. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +0 -16
  173. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +0 -16
  174. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +0 -18
  175. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +0 -16
  176. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +0 -17
  177. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +0 -17
  178. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +0 -18
  179. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +0 -22
  180. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +0 -23
  181. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +0 -25
  182. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +0 -18
  183. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +0 -18
  184. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +0 -18
  185. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +0 -16
  186. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +0 -16
  187. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +0 -20
  188. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +0 -20
  189. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +0 -16
  190. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +0 -16
  191. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +0 -16
  192. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +0 -16
  193. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +0 -16
  194. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +0 -16
  195. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +0 -16
  196. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +0 -18
  197. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +0 -16
  198. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +0 -16
  199. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +0 -16
  200. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +0 -16
  201. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +0 -16
  202. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +0 -16
  203. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +0 -16
  204. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +0 -16
  205. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +0 -16
  206. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +0 -16
  207. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +0 -16
  208. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +0 -16
  209. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +0 -16
  210. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +0 -16
  211. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +0 -16
  212. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +0 -16
  213. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +0 -16
  214. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +0 -16
  215. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +0 -16
  216. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +0 -16
  217. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +0 -16
  218. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +0 -16
  219. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +0 -16
  220. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +0 -16
  221. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +0 -16
  222. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +0 -16
  223. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +0 -16
  224. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +0 -16
  225. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +0 -16
  226. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +0 -16
  227. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +0 -16
  228. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +0 -16
  229. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  230. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +0 -104
  231. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  232. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +0 -17
  233. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +0 -13
  234. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +0 -25
  235. data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +0 -166
  236. data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +0 -304
  237. data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +0 -37
  238. data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +0 -52
  239. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  240. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +0 -118
  241. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  242. data/vendor/TextMate/Zena.tmbundle/info.plist +0 -17
  243. data/vendor/plugins/selenium-on-rails/CHANGELOG +0 -125
  244. data/vendor/plugins/selenium-on-rails/LICENSE-2.0.txt +0 -202
  245. data/vendor/plugins/selenium-on-rails/README.md +0 -202
  246. data/vendor/plugins/selenium-on-rails/Rakefile +0 -38
  247. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumController.html +0 -265
  248. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumHelper.html +0 -148
  249. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails.html +0 -126
  250. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/FixtureLoader.html +0 -231
  251. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/PartialsSupport.html +0 -195
  252. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Paths.html +0 -295
  253. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/RSelenese.html +0 -219
  254. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Renderer.html +0 -156
  255. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/Selenese.html +0 -179
  256. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/SuiteRenderer.html +0 -223
  257. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilder.html +0 -441
  258. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderAccessors.html +0 -3098
  259. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderActions.html +0 -2080
  260. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserAccessors.html +0 -116
  261. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRails/TestBuilderUserActions.html +0 -116
  262. data/vendor/plugins/selenium-on-rails/doc/classes/SeleniumOnRailsConfig.html +0 -150
  263. data/vendor/plugins/selenium-on-rails/doc/files/CHANGELOG.html +0 -422
  264. data/vendor/plugins/selenium-on-rails/doc/files/README.html +0 -321
  265. data/vendor/plugins/selenium-on-rails/doc/files/lib/controllers/selenium_controller_rb.html +0 -108
  266. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_helper_rb.html +0 -101
  267. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/acceptance_test_runner_rb.html +0 -222
  268. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/fixture_loader_rb.html +0 -109
  269. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/partials_support_rb.html +0 -111
  270. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/paths_rb.html +0 -101
  271. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/renderer_rb.html +0 -101
  272. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/rselenese_rb.html +0 -118
  273. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/selenese_rb.html +0 -101
  274. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/suite_renderer_rb.html +0 -101
  275. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_accessors_rb.html +0 -114
  276. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_actions_rb.html +0 -113
  277. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails/test_builder_rb.html +0 -120
  278. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_config_rb.html +0 -108
  279. data/vendor/plugins/selenium-on-rails/doc/files/lib/selenium_on_rails_rb.html +0 -115
  280. data/vendor/plugins/selenium-on-rails/doc/fr_class_index.html +0 -42
  281. data/vendor/plugins/selenium-on-rails/doc/fr_file_index.html +0 -43
  282. data/vendor/plugins/selenium-on-rails/doc/fr_method_index.html +0 -182
  283. data/vendor/plugins/selenium-on-rails/doc/index.html +0 -24
  284. data/vendor/plugins/selenium-on-rails/doc/rdoc-style.css +0 -208
  285. data/vendor/plugins/selenium-on-rails/generators/selenium/USAGE +0 -19
  286. data/vendor/plugins/selenium-on-rails/generators/selenium/selenium_generator.rb +0 -50
  287. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rhtml.rhtml +0 -16
  288. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/rselenese.rhtml +0 -14
  289. data/vendor/plugins/selenium-on-rails/generators/selenium/templates/selenese.rhtml +0 -11
  290. data/vendor/plugins/selenium-on-rails/init.rb +0 -15
  291. data/vendor/plugins/selenium-on-rails/lib/controllers/selenium_controller.rb +0 -122
  292. data/vendor/plugins/selenium-on-rails/lib/controllers/switch_environment_controller.rb +0 -16
  293. data/vendor/plugins/selenium-on-rails/lib/selenium_helper.rb +0 -8
  294. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails.rb +0 -11
  295. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/acceptance_test_runner.rb +0 -215
  296. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/fixture_loader.rb +0 -57
  297. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/partials_support.rb +0 -36
  298. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/paths.rb +0 -61
  299. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/renderer.rb +0 -20
  300. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/rselenese.rb +0 -44
  301. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/selenese.rb +0 -87
  302. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/suite_renderer.rb +0 -56
  303. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder.rb +0 -116
  304. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_accessors.rb +0 -1002
  305. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_actions.rb +0 -514
  306. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_accessors.rb.example +0 -91
  307. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails/test_builder_user_actions.rb.example +0 -24
  308. data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb +0 -30
  309. data/vendor/plugins/selenium-on-rails/lib/views/layouts/layout.rhtml +0 -18
  310. data/vendor/plugins/selenium-on-rails/lib/views/record.rhtml +0 -5
  311. data/vendor/plugins/selenium-on-rails/lib/views/selenium_helper.rb +0 -9
  312. data/vendor/plugins/selenium-on-rails/lib/views/setup.rhtml +0 -67
  313. data/vendor/plugins/selenium-on-rails/lib/views/test_suite.rhtml +0 -26
  314. data/vendor/plugins/selenium-on-rails/routes.rb +0 -24
  315. data/vendor/plugins/selenium-on-rails/selenium-core/Blank.html +0 -7
  316. data/vendor/plugins/selenium-on-rails/selenium-core/InjectedRemoteRunner.html +0 -8
  317. data/vendor/plugins/selenium-on-rails/selenium-core/RemoteRunner.html +0 -110
  318. data/vendor/plugins/selenium-on-rails/selenium-core/SeleniumLog.html +0 -109
  319. data/vendor/plugins/selenium-on-rails/selenium-core/TestPrompt.html +0 -145
  320. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner-splash.html +0 -55
  321. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.hta +0 -177
  322. data/vendor/plugins/selenium-on-rails/selenium-core/TestRunner.html +0 -177
  323. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butmin.gif +0 -0
  324. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/butplus.gif +0 -0
  325. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.css +0 -298
  326. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/domviewer.html +0 -16
  327. data/vendor/plugins/selenium-on-rails/selenium-core/domviewer/selenium-domviewer.js +0 -205
  328. data/vendor/plugins/selenium-on-rails/selenium-core/icons/all.png +0 -0
  329. data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue.png +0 -0
  330. data/vendor/plugins/selenium-on-rails/selenium-core/icons/continue_disabled.png +0 -0
  331. data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause.png +0 -0
  332. data/vendor/plugins/selenium-on-rails/selenium-core/icons/pause_disabled.png +0 -0
  333. data/vendor/plugins/selenium-on-rails/selenium-core/icons/selected.png +0 -0
  334. data/vendor/plugins/selenium-on-rails/selenium-core/icons/step.png +0 -0
  335. data/vendor/plugins/selenium-on-rails/selenium-core/icons/step_disabled.png +0 -0
  336. data/vendor/plugins/selenium-on-rails/selenium-core/iedoc-core.xml +0 -1759
  337. data/vendor/plugins/selenium-on-rails/selenium-core/iedoc.xml +0 -1800
  338. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/cssQuery-p.js +0 -6
  339. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level2.js +0 -142
  340. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-level3.js +0 -150
  341. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery-standard.js +0 -53
  342. data/vendor/plugins/selenium-on-rails/selenium-core/lib/cssQuery/src/cssQuery.js +0 -356
  343. data/vendor/plugins/selenium-on-rails/selenium-core/lib/prototype.js +0 -2006
  344. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/builder.js +0 -101
  345. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/controls.js +0 -815
  346. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/dragdrop.js +0 -915
  347. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/effects.js +0 -958
  348. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/scriptaculous.js +0 -47
  349. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/slider.js +0 -283
  350. data/vendor/plugins/selenium-on-rails/selenium-core/lib/scriptaculous/unittest.js +0 -383
  351. data/vendor/plugins/selenium-on-rails/selenium-core/lib/snapsie.js +0 -91
  352. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/find_matching_child.js +0 -69
  353. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/htmlutils.js +0 -1616
  354. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/injection.html +0 -72
  355. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-api.js +0 -3184
  356. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserbot.js +0 -2300
  357. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-browserdetect.js +0 -153
  358. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-commandhandlers.js +0 -377
  359. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-executionloop.js +0 -175
  360. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-logging.js +0 -148
  361. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-remoterunner.js +0 -695
  362. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-testrunner.js +0 -1362
  363. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/selenium-version.js +0 -5
  364. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-doc.html +0 -803
  365. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-element.js +0 -1537
  366. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/ui-map-sample.js +0 -979
  367. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js +0 -3
  368. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/user-extensions.js.sample +0 -75
  369. data/vendor/plugins/selenium-on-rails/selenium-core/scripts/xmlextras.js +0 -153
  370. data/vendor/plugins/selenium-on-rails/selenium-core/selenium-logo.png +0 -0
  371. data/vendor/plugins/selenium-on-rails/selenium-core/selenium-test.css +0 -43
  372. data/vendor/plugins/selenium-on-rails/selenium-core/selenium.css +0 -316
  373. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/dom.js +0 -566
  374. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/javascript-xpath-0.1.11.js +0 -2816
  375. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/util.js +0 -549
  376. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xmltoken.js +0 -149
  377. data/vendor/plugins/selenium-on-rails/selenium-core/xpath/xpath.js +0 -2450
  378. data/vendor/plugins/selenium-on-rails/tasks/test_acceptance.rake +0 -8
  379. data/vendor/plugins/selenium-on-rails/test/fixtures/config.yml +0 -37
  380. data/vendor/plugins/selenium-on-rails/test/fixtures/selenium.yml +0 -27
  381. data/vendor/plugins/selenium-on-rails/test/paths_test.rb +0 -72
  382. data/vendor/plugins/selenium-on-rails/test/renderer_test.rb +0 -157
  383. data/vendor/plugins/selenium-on-rails/test/rselenese_test.rb +0 -708
  384. data/vendor/plugins/selenium-on-rails/test/selenese_test.rb +0 -242
  385. data/vendor/plugins/selenium-on-rails/test/selenium_controller_test.rb +0 -67
  386. data/vendor/plugins/selenium-on-rails/test/selenium_on_rails_config_test.rb +0 -43
  387. data/vendor/plugins/selenium-on-rails/test/selenium_support_test.rb +0 -35
  388. data/vendor/plugins/selenium-on-rails/test/setup_test.rb +0 -31
  389. data/vendor/plugins/selenium-on-rails/test/suite_renderer_test.rb +0 -109
  390. data/vendor/plugins/selenium-on-rails/test/switch_environment_controller_test.rb +0 -17
  391. data/vendor/plugins/selenium-on-rails/test/test_builder_functions_authortest.rb +0 -51
  392. data/vendor/plugins/selenium-on-rails/test/test_helper.rb +0 -101
  393. data/vendor/plugins/selenium-on-rails/test_data/_partial.rsel +0 -1
  394. data/vendor/plugins/selenium-on-rails/test_data/own_layout.html +0 -12
  395. data/vendor/plugins/selenium-on-rails/test_data/partials/_html.html +0 -6
  396. data/vendor/plugins/selenium-on-rails/test_data/partials/_nesting.rsel +0 -2
  397. data/vendor/plugins/selenium-on-rails/test_data/partials/_rhtml.rhtml +0 -6
  398. data/vendor/plugins/selenium-on-rails/test_data/partials/_rsel.rsel +0 -1
  399. data/vendor/plugins/selenium-on-rails/test_data/partials/_sel.sel +0 -5
  400. data/vendor/plugins/selenium-on-rails/test_data/partials/all_partials.rsel +0 -5
  401. data/vendor/plugins/selenium-on-rails/test_data/rhtml.rhtml +0 -7
  402. data/vendor/plugins/selenium-on-rails/test_data/rselenese.rsel +0 -8
  403. data/vendor/plugins/selenium-on-rails/test_data/selenese.sel +0 -7
  404. data/vendor/plugins/selenium-on-rails/test_data/suite_one/subsuite/suite_one_subsuite_testcase.sel +0 -1
  405. data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase1.sel +0 -1
  406. data/vendor/plugins/selenium-on-rails/test_data/suite_one/suite_one_testcase2.sel +0 -1
  407. data/vendor/plugins/selenium-on-rails/test_data/suite_two/suite_two_testcase.sel +0 -1
@@ -17,6 +17,28 @@ Grid.log = function(what, msg) {
17
17
  log.innerHTML = log.innerHTML + '<br/><b>' + what + '</b> ' + msg
18
18
  }
19
19
 
20
+ Grid.showValue = function(grid, attr, value) {
21
+ var show_h = grid.show[attr]
22
+ if (show_h == undefined) {
23
+ // try to find value from select
24
+ if (grid.helper) {
25
+ var pos = grid.pos[attr]
26
+ var input = grid.helper[pos]
27
+ if (input && input.tagName == 'SELECT') {
28
+ show_h = {}
29
+ grid.show[attr] = show_h
30
+ input.select('option').each(function(el) {
31
+ show_h[el.value] = el.innerHTML
32
+ })
33
+ }
34
+ }
35
+ if (!show_h) grid.show[attr] = false;
36
+ }
37
+
38
+ // cell.setAttribute('data-v', value)
39
+ return show_h ? show_h[value] : undefined
40
+ }
41
+
20
42
  Grid.changed = function(cell, val, prev, skip_html) {
21
43
  var row = cell.up('tr')
22
44
  var table = row.up('table')
@@ -27,7 +49,7 @@ Grid.changed = function(cell, val, prev, skip_html) {
27
49
  var attr, id
28
50
  if (grid.attr_name) {
29
51
  attr = pos;
30
- id = Grid.pos(row) - 1;
52
+ id = Grid.pos(row);
31
53
  } else {
32
54
  attr = grid.attr[pos];
33
55
  id = row.id;
@@ -38,9 +60,8 @@ Grid.changed = function(cell, val, prev, skip_html) {
38
60
  }
39
61
 
40
62
  if (!skip_html) {
41
- var show_h = grid.show[attr] || {}
42
- if (cell.hasAttribute('data-v')) cell.setAttribute('data-v', val.value)
43
- cell.innerHTML = show_h[val.value] || val.show
63
+ var show = Grid.showValue(grid, attr, val.value)
64
+ cell.innerHTML = show || val.show
44
65
  }
45
66
 
46
67
  if (grid.onChange) {
@@ -53,8 +74,9 @@ Grid.changed = function(cell, val, prev, skip_html) {
53
74
  if (cell.hasAttribute('data-v')) cell.setAttribute('data-v', val.value)
54
75
  }
55
76
  }
56
-
77
+
57
78
  if (prev.value == val.value) return;
79
+
58
80
  if (cell.orig_value == val.value) {
59
81
  cell.removeClassName('changed')
60
82
  if (row.select('.changed').length == 0) {
@@ -112,9 +134,26 @@ Grid.buildObj = function(grid, row) {
112
134
  return id
113
135
  }
114
136
 
137
+ Grid.selectAll = function(elem) {
138
+ var range, selection;
139
+ if (document.body.createTextRange) {
140
+ range = document.body.createTextRange()
141
+ range.moveToElementText(elem)
142
+ range.select()
143
+ } else if (window.getSelection) {
144
+ selection = window.getSelection()
145
+ range = document.createRange()
146
+ range.selectNodeContents(elem)
147
+ selection.removeAllRanges()
148
+ selection.addRange(range)
149
+ }
150
+ }
151
+
115
152
  Grid.closeCell = function(e) {
116
153
  if (Grid.no_blur) return
117
- var cell = e.tagName ? e : e.element().up()
154
+ var cell = e.tagName ? e : e.element()
155
+ if (cell.tagName != 'TD' && cell.tagName != 'TH') cell = cell.up('td') || cell.up('th')
156
+ if (!cell.hasClassName('in')) return
118
157
  var table = cell.up('table')
119
158
  var prev = cell.prev_value
120
159
  var val = Grid.getValue(cell)
@@ -126,7 +165,10 @@ Grid.closeCell = function(e) {
126
165
  cell.removeClassName('on')
127
166
  }
128
167
  }
168
+ // 'input' is added when we have a form element
129
169
  cell.removeClassName('input')
170
+ // 'in' is added during edit
171
+ cell.removeClassName('in')
130
172
 
131
173
  Grid.changed(cell, val, prev)
132
174
 
@@ -145,9 +187,14 @@ Grid.pos = function(elem) {
145
187
  }
146
188
  }
147
189
 
148
- Grid.paste = function(event) {
190
+ Grid.pasteTable = function(event) {
149
191
  var input = event.element();
150
- var start_cell = input.up();
192
+ var start_cell
193
+ if (input.tagName == 'TD') {
194
+ start_cell = input
195
+ } else {
196
+ start_cell = input.up();
197
+ }
151
198
  var row = start_cell.up();
152
199
  var table = row.up('table');
153
200
  var row_offset = Grid.pos(row);
@@ -182,7 +229,11 @@ Grid.paste = function(event) {
182
229
  }
183
230
  if (lines.length == 1 && lines[0].length == 1) {
184
231
  // simple case
185
- input.value = lines[0][0];
232
+ if (input == start_cell) {
233
+ start_cell.innerHTML = lines[0][0]
234
+ } else {
235
+ input.value = lines[0][0]
236
+ }
186
237
  } else {
187
238
  // copy/paste from spreadsheet
188
239
  table.grid.changes.push('start')
@@ -212,7 +263,11 @@ Grid.paste = function(event) {
212
263
  }
213
264
  var val = {value:tabs[j], show:tabs[j]}
214
265
  if (i==0 && j==0) {
215
- input.value = val.value
266
+ if (input == cell) {
267
+ cell.innerHTML = lines[0][0]
268
+ } else {
269
+ input.value = val.value
270
+ }
216
271
  Grid.changed(cell, val, cell.prev_value, true)
217
272
  cell.prev_value = val
218
273
  } else if (!Grid.isReadOnly(cell)) {
@@ -234,7 +289,14 @@ Grid.paste = function(event) {
234
289
  Grid.keydown = function(event) {
235
290
  var input = event.element()
236
291
  var key = event.keyCode
237
- var cell = input.up()
292
+ var cell
293
+ if (input.tagName == 'TD' || input.tagName == 'TH') {
294
+ // contenteditable
295
+ cell = input
296
+ } else {
297
+ cell = input.up()
298
+ }
299
+
238
300
  var grid = cell.up('table').grid
239
301
  if (grid.keydown && grid.keydown(event, key)) {
240
302
  event.stop()
@@ -247,34 +309,54 @@ Grid.keydown = function(event) {
247
309
  // wrap around on tab
248
310
  var row = cell.up('tr').nextSiblings()[0];
249
311
  if (!row) {
250
- row = cell.up('tbody').childElements()[1];
312
+ row = cell.up('tbody').childElements()[grid.firstRow];
251
313
  }
252
314
  next = row.childElements()[0];
253
315
  }
254
- Grid.openCell(next);
255
316
  event.stop();
317
+ Grid.openCell(next, false, true);
256
318
  } else if ((false && key == 37) || (key == 9 && event.shiftKey)) {
257
319
  // shift-tab + left key
258
320
  var prev = cell.previousSiblings()[0];
259
321
  if (!prev) {
260
322
  // wrap back around on shift+tab
261
323
  var row = cell.up('tr').previousSiblings()[0]
262
- if (!row || row.hasClassName('action')) {
324
+ if (!row || (row.hasClassName('header') && !grid.attr_name) || row.hasClassName('action')) {
263
325
  row = cell.up('tbody').childElements().last();
264
326
  }
265
327
  prev = row.childElements().last();
266
328
  if (prev.hasClassName('action'))
267
329
  prev = prev.previousSiblings()[0];
268
330
  }
269
- Grid.openCell(prev);
331
+ Grid.openCell(prev, true, true);
332
+ event.stop();
333
+ } else if ((key == 13 && event.shiftKey)) {
334
+ // insert return
335
+ return true;
336
+ } else if ((false && key == 38)) {
337
+ // up
338
+ if (cell.childElements().first().tagName == 'SELECT' && event.shiftKey) {
339
+ return
340
+ }
341
+ var row = cell.up();
342
+ if (Grid.pos(row) == 1) {
343
+ // stop
344
+ } else {
345
+ var pos = Grid.pos(cell);
346
+ // move up
347
+ row = row.previousSiblings().first();
348
+ var next = row.childElements()[pos];
349
+ Grid.openCell(next, false, true);
350
+ }
270
351
  event.stop();
271
- } else if ((key == 40 && event.altKey) || (key == 13 && !event.shiftKey)) {
352
+ } else if ((key == 40 && event.altKey) || (key == 13)) {
272
353
  // down
354
+ var input = cell.childElements().first()
273
355
  if (event.altKey) {
274
356
  Grid.copy(cell, 'down')
275
357
  event.stop()
276
358
  return false
277
- } else if (cell.childElements().first().tagName == 'SELECT' && event.shiftKey) {
359
+ } else if (input && input.tagName == 'SELECT' && event.shiftKey) {
278
360
  return
279
361
  } else if (grid.autoSave) {
280
362
  // this will close cell
@@ -294,28 +376,12 @@ Grid.keydown = function(event) {
294
376
  row = crow.nextSiblings().first();
295
377
  var next = row.childElements()[0];
296
378
  setTimeout(function() {
297
- Grid.openCell(next);
379
+ Grid.openCell(next, false, true);
298
380
  }, 100);
299
381
  }
300
382
  } else {
301
383
  next = row.childElements()[pos];
302
- Grid.openCell(next);
303
- }
304
- event.stop();
305
- } else if ((false && key == 38) || (key == 13 && event.shiftKey)) {
306
- // up
307
- if (cell.childElements().first().tagName == 'SELECT' && event.shiftKey) {
308
- return
309
- }
310
- var row = cell.up();
311
- if (Grid.pos(row) == 1) {
312
- // stop
313
- } else {
314
- var pos = Grid.pos(cell);
315
- // move up
316
- row = row.previousSiblings().first();
317
- var next = row.childElements()[pos];
318
- Grid.openCell(next);
384
+ Grid.openCell(next, false, true);
319
385
  }
320
386
  event.stop();
321
387
  }
@@ -323,7 +389,20 @@ Grid.keydown = function(event) {
323
389
  }
324
390
 
325
391
  Grid.isReadOnly = function(cell) {
326
- return cell.select('a').length > 0 || cell.getAttribute('data-m') == 'r' || cell.hasClassName('action')
392
+ return Grid.cellMode(cell) == 'r'
393
+ }
394
+
395
+ Grid.cellMode = function(cell) {
396
+ if (cell.hasAttribute('data-m')) return cell.getAttribute('data-m');
397
+
398
+ if (cell.select('a').length > 0 || cell.hasClassName('action') || cell.up('tr').hasClassName('action')) {
399
+ return 'r'
400
+ }
401
+ var col = Grid.pos(cell)
402
+ var head = cell.up('table').select('th')[col]
403
+ var attr = head.getAttribute('data-a')
404
+ if (attr && (parseInt(attr) + '' == attr)) return 'a'; // column contains id to link
405
+ return head.getAttribute('data-m');
327
406
  }
328
407
 
329
408
  Grid.closeCheckbox = function() {
@@ -332,16 +411,82 @@ Grid.closeCheckbox = function() {
332
411
  Grid.need_close = false
333
412
  }
334
413
  }
335
- Grid.openCell = function(cell, get_next) {
414
+
415
+ Grid.makeInput = function(cell, table, value) {
416
+ var w = cell.getWidth() - 5
417
+ var h = cell.getHeight() - 5
418
+ cell.addClassName('in')
419
+
420
+ // Try to find a form for the cell
421
+ var input
422
+ if (table.grid.helper && cell.tagName != 'TH') {
423
+ var pos = Grid.pos(cell)
424
+ input = table.grid.helper[pos]
425
+ if (input) {
426
+ input = Element.clone(input, true)
427
+ cell.update(input)
428
+ if (input.type == 'checkbox') {
429
+ if (value == input.value) {
430
+ input.checked = true
431
+ }
432
+ } else {
433
+ if (value && value.strip() != '') input.value = value
434
+ }
435
+ }
436
+ }
437
+
438
+ if (!input && !table.grid.contenteditable) {
439
+ // default input field
440
+ cell.update(Grid.default_input)
441
+ input = cell.childElements()[0]
442
+ input.value = value
443
+ }
444
+
445
+ if (input) {
446
+ cell.setAttribute('contenteditable', false)
447
+ // need blur on input field, etc...
448
+ cell.addClassName('input')
449
+ input.setStyle({
450
+ width: w + 'px',
451
+ height: h + 'px'
452
+ })
453
+
454
+ if (input.type == 'checkbox') {
455
+ Grid.need_close = cell
456
+ // we cannot use 'blur' on checkbox because a click on the input does:
457
+ // BLUR + CLICK
458
+ } else {
459
+ input.observe('blur', Grid.closeCell)
460
+ }
461
+ input.observe('keydown', Grid.keydown)
462
+ if (table.grid.pasteTable) {
463
+ input.observe('paste', Grid.pasteTable)
464
+ }
465
+ input.focus()
466
+ input.select()
467
+ } else {
468
+ // contenteditable listener
469
+ if (table.grid.contenteditable) {
470
+ cell.setAttribute('contenteditable', true)
471
+ }
472
+ cell.observe('keydown', Grid.keydown)
473
+ if (table.grid.pasteTable) {
474
+ cell.observe('paste', Grid.pasteTable)
475
+ }
476
+ cell.observe('blur', Grid.closeCell)
477
+ }
478
+ }
479
+
480
+ Grid.openCell = function(cell, get_next, focus, event) {
336
481
  var get_next = get_next == undefined ? true : get_next
337
482
  Grid.closeCheckbox()
338
483
 
339
- if (cell.hasClassName('input')) return;
484
+ if (cell.hasClassName('in')) return;
340
485
  if (Grid.isReadOnly(cell)) {
341
486
  if (get_next) {
342
487
  var n = Element.next(cell) || cell.up().nextSiblings().first().childElements()[0]
343
488
  if (n) {
344
- return Grid.openCell(n)
489
+ return Grid.openCell(n, false, focus)
345
490
  } else {
346
491
  return false
347
492
  }
@@ -355,57 +500,23 @@ Grid.openCell = function(cell, get_next) {
355
500
  var value = val.value
356
501
  var table = cell.up('table')
357
502
 
358
- if (table.grid.is_list) {
503
+ if (table.grid.is_list && Grid.cellMode(cell) == 'a') {
359
504
  if (value == 'on') {
360
505
  cell.setAttribute('data-v', 'off')
361
506
  } else {
362
507
  cell.setAttribute('data-v', 'on')
363
508
  }
509
+ cell.addClassName('in')
364
510
  Grid.closeCell(cell)
365
- } else {
366
- var w = cell.getWidth() - 5
367
- var h = cell.getHeight() - 5
368
- cell.addClassName('input')
369
-
370
- // Try to find a form for the cell
371
- var input
372
- if (table.grid.helper && cell.tagName != 'TH') {
373
- var pos = Grid.pos(cell)
374
- input = table.grid.helper[pos]
375
- if (input) {
376
- input = Element.clone(input, true)
377
- cell.update(input)
378
- if (input.type == 'checkbox') {
379
- if (value == input.value) {
380
- input.checked = true
381
- }
382
- } else {
383
- if (value && value.strip() != '') input.value = value
384
- }
385
- }
386
- }
387
-
388
- if (!input) {
389
- // default input field
390
- cell.update(Grid.default_input)
391
- input = cell.childElements()[0]
392
- input.value = value
393
- }
394
-
395
- input.setStyle({
396
- width: w + 'px',
397
- height: h + 'px'
398
- })
399
-
400
- if (input.type == 'checkbox') {
401
- Grid.need_close = cell
402
- } else {
403
- input.observe('blur', Grid.closeCell)
511
+ if (event.altKey) {
512
+ Grid.copy(cell, 'down', true)
404
513
  }
405
- input.observe('keydown', Grid.keydown)
406
- input.observe('paste', Grid.paste)
407
- input.focus()
408
- input.select()
514
+ } else {
515
+ Grid.makeInput(cell, table, val.value)
516
+ }
517
+ if (focus && cell.up('table').grid.contenteditable) {
518
+ cell.focus()
519
+ Grid.selectAll(cell)
409
520
  }
410
521
  return true
411
522
  }
@@ -425,20 +536,27 @@ Grid.click = function(event) {
425
536
  Grid.sort(cell)
426
537
  Event.stop(event)
427
538
  } else {
428
- if (event.element().tagName == 'INPUT') return;
429
- if (Grid.openCell(cell, false)) {
539
+ if (cell.hasClassName('in')) {
540
+ if (event.element().tagName == 'INPUT') {
541
+ // keep focus on checkbox
542
+ event.element().focus()
543
+ }
544
+ return;
545
+ }
546
+ if (Grid.openCell(cell, false, false, event)) {
430
547
  Event.stop(event)
431
548
  }
432
549
  }
433
550
  }
434
551
 
435
- Grid.valueFromInput = function(input) {
552
+ Grid.valueFromInput = function(input, cell) {
436
553
  var val = {}
437
554
  if (input.tagName == 'SELECT') {
438
555
  val.value = input.value
439
556
  val.show = input.select('option[value="'+val.value+'"]').first().innerHTML
440
557
  } else {
441
558
  if (input.type == 'checkbox') {
559
+ var cell = cell || input.up('td')
442
560
  val.value = input.checked ? input.value : (input.getAttribute('data-off') || cell.getAttribute('data-v'))
443
561
  } else {
444
562
  val.value = input.value
@@ -450,16 +568,18 @@ Grid.valueFromInput = function(input) {
450
568
 
451
569
  Grid.getValue = function(cell) {
452
570
  if (cell.hasClassName('input')) {
453
- return Grid.valueFromInput(cell.childElements()[0])
571
+ return Grid.valueFromInput(cell.childElements()[0], cell)
454
572
  }
455
573
  var val = {}
456
574
  val.show = cell.innerHTML
457
575
  val.value = cell.getAttribute('data-v') || val.show
458
- if (!cell.orig_value) cell.orig_value = val.value
576
+ if (cell.orig_value == undefined) {
577
+ cell.orig_value = val.value
578
+ }
459
579
  return val
460
580
  }
461
581
 
462
- Grid.copy = function(cell) {
582
+ Grid.copy = function(cell, dir, is_list) {
463
583
  var table = cell.up('table')
464
584
  var row = cell.up()
465
585
  var pos = Grid.pos(cell)
@@ -476,9 +596,20 @@ Grid.copy = function(cell) {
476
596
  var len = rows.length
477
597
  for (var i = 0; i < len; i++) {
478
598
  var c = rows[i].childElements()[pos]
479
- if (!Grid.isReadOnly(c)) {
599
+ if (c && !Grid.isReadOnly(c)) {
480
600
  var prev = Grid.getValue(c)
481
- if (prev.value != val.value) Grid.changed(c, val, prev)
601
+ if (prev.value != val.value) {
602
+ if (is_list) {
603
+ if (val.value == 'on') {
604
+ c.addClassName('on')
605
+ c.setAttribute('data-v', 'on')
606
+ } else {
607
+ c.removeClassName('on')
608
+ c.setAttribute('data-v', 'off')
609
+ }
610
+ }
611
+ Grid.changed(c, val, prev)
612
+ }
482
613
  }
483
614
  }
484
615
  table.grid.changes.push('end')
@@ -495,8 +626,9 @@ Grid.addRow = function(table, row) {
495
626
  row_str = row_str + $(grid.newRow).innerHTML
496
627
  } else {
497
628
  var cells = row.childElements()
629
+ var td = grid.contenteditable ? '<td contenteditable="true"></td>' : '<td></td>'
498
630
  for (var i = 0; i < cells.length -1; i++) {
499
- row_str = row_str + '<td></td>'
631
+ row_str = row_str + td
500
632
  }
501
633
  }
502
634
  row_str = row_str + Grid.Buttons(table.grid) + '</tr>';
@@ -527,9 +659,10 @@ Grid.addCol = function(table, cell) {
527
659
  after: "<th>[title]</th>"
528
660
  });
529
661
  } else {
662
+ var td = table.grid.contenteditable ? '<td contenteditable="true"></td>' : '<td></td>'
530
663
  cells = rows[i].select('td');
531
664
  cells[pos].insert({
532
- after: "<td></td>"
665
+ after: td
533
666
  });
534
667
  }
535
668
  }
@@ -563,6 +696,11 @@ Grid.delRow = function(grid, row) {
563
696
 
564
697
  Grid.action = function(event, cell, row, is_col) {
565
698
  var span = event.findElement('span')
699
+ if (!span) {
700
+ Grid.closeCheckbox()
701
+ return
702
+ }
703
+
566
704
  var table = event.findElement('table')
567
705
  var grid = table.grid
568
706
  if (span.hasClassName('add')) {
@@ -570,7 +708,8 @@ Grid.action = function(event, cell, row, is_col) {
570
708
  Grid.addCol(table, cell);
571
709
  } else {
572
710
  var new_row = Grid.addRow(table, row);
573
- Grid.openCell(new_row.childElements()[0]);
711
+ var cell = new_row.childElements()[0]
712
+ Grid.openCell(cell, false, true)
574
713
  }
575
714
  } else if (span.hasClassName('del')) {
576
715
  if (is_col) {
@@ -732,6 +871,12 @@ Grid.addButtons = function(table) {
732
871
  return data
733
872
  }
734
873
 
874
+ Grid.onSuccess = function(grid, id, method, done_count, todo_count) {
875
+ $$('.grid_done_'+grid.id).each(function(e) {
876
+ e.update(grid.msg.saved + ' ' + done_count + '/' + todo_count)
877
+ })
878
+ }
879
+
735
880
  Grid.onFailure = function(grid, id, errors) {
736
881
  var cells = $(id).select('td')
737
882
  errors.each(function(pair) {
@@ -786,7 +931,7 @@ Grid.make = function(table, opts) {
786
931
  fdate: opts.fdate || table.getAttribute('data-fdate'),
787
932
  newRow: opts.newRow,
788
933
  counter: 0, // Used to create dom_ids for new objects
789
- onSuccess: opts.onSuccess,
934
+ onSuccess: opts.onSuccess || Grid.onSuccess,
790
935
  onFailure: opts.onFailure || Grid.onFailure,
791
936
  onStart: opts.onStart || Grid.onStart,
792
937
  onChange: opts.onChange,
@@ -797,6 +942,9 @@ Grid.make = function(table, opts) {
797
942
  remove: opts.remove || opts.remove == undefined,
798
943
  keydown: opts.keydown,
799
944
  show: opts.show || {},
945
+ msg: opts.msg || {saved:'Saved'},
946
+ pasteTable: opts.pasteTable == undefined ? true : opts.pasteTable,
947
+ contenteditable: opts.contenteditable == undefined ? true : opts.contenteditable,
800
948
  };
801
949
  table.grid = grid
802
950
  grid.table = table
@@ -815,11 +963,15 @@ Grid.make = function(table, opts) {
815
963
  table.innerHTML = "<tr><th>" + msg + "</th></tr><tr><td></td></tr>";
816
964
  }
817
965
 
966
+ // Make sure header row has 'header' class
967
+ table.select('tr').first().addClassName('header')
818
968
  Grid.makeAttrPos(table)
819
969
  Grid.addButtons(table)
820
970
 
821
971
 
822
972
  if (grid.attr_name) {
973
+ // action buttons, header (editable), first row
974
+ grid.firstRow = 1
823
975
  table.insert({
824
976
  after: "<p class='grid_btn'><a class='undo' href='javascript:' onclick='Grid.undo(" + Grid.grid_c + ")'>undo</a></p>"
825
977
  });
@@ -831,6 +983,8 @@ Grid.make = function(table, opts) {
831
983
  grid.input = $("grid_a_" + Grid.grid_c);
832
984
  if (!empty) grid.input.value = Grid.serialize(table);
833
985
  } else {
986
+ // header, first row
987
+ grid.firstRow = 1
834
988
  // Otherwise each row is a new object and each column
835
989
  // corresponds to a different attribute (defined in the
836
990
  // 'th' of the table).
@@ -844,11 +998,19 @@ Grid.make = function(table, opts) {
844
998
  }
845
999
  if (!grid.autoSave) {
846
1000
  table.insert({
847
- after: "<p class='grid_btn'><a class='save' href='javascript:' onclick='Grid.save(" + Grid.grid_c + ")'>save</a> <a class='undo' href='javascript:' onclick='Grid.undo(" + Grid.grid_c + ")'>undo</a></p>"
1001
+ after: "<p class='grid_done grid_done_"+Grid.grid_c+"'></p><p class='grid_btn'><a class='save' href='javascript:' onclick='Grid.save(" + Grid.grid_c + ")'>save</a> <a class='undo' href='javascript:' onclick='Grid.undo(" + Grid.grid_c + ")'>undo</a></p>"
848
1002
  });
849
1003
  }
850
1004
  }
851
1005
 
1006
+ if (grid.contenteditable) {
1007
+ table.select('td').each(function(cell) {
1008
+ var mode = Grid.cellMode(cell);
1009
+ if (mode != 'r' && mode != 'a') {
1010
+ cell.setAttribute('contenteditable', true)
1011
+ }
1012
+ })
1013
+ }
852
1014
  table.observe('click', Grid.click);
853
1015
  }
854
1016
 
@@ -958,7 +1120,7 @@ Grid.save = function(grid_id) {
958
1120
  Grid.notify(table, attrs)
959
1121
  Grid.clearChanges(grid.changes, id)
960
1122
  if (grid.onSuccess) {
961
- grid.onSuccess(id, 'put', done_count, todo_count)
1123
+ grid.onSuccess(grid, id, 'put', done_count, todo_count)
962
1124
  }
963
1125
  },
964
1126
  method: 'put'
@@ -985,7 +1147,14 @@ Grid.undo = function(grid_id, skip_undone) {
985
1147
  var old = change._old
986
1148
  for (attr in change) {
987
1149
  if (attr == 'id' || attr == '_old') continue
988
- var cell = $(change.id).childElements()[grid.pos[attr]]
1150
+ var cell
1151
+ if (grid.attr_name) {
1152
+ // id = row position, attr = cell position
1153
+ var row = grid.table.select('tr')[change.id]
1154
+ cell = row.childElements()[attr]
1155
+ } else {
1156
+ cell = $(change.id).childElements()[grid.pos[attr]]
1157
+ }
989
1158
  var val = old
990
1159
  var value = old.value
991
1160
  cell.innerHTML = val.show || ''
@@ -1139,7 +1308,7 @@ Grid.notify = function(table, changes) {
1139
1308
  var row
1140
1309
  if (grid.attr_name) {
1141
1310
  // attr table
1142
- row = rows[parseInt(obj_id)+1]
1311
+ row = rows[parseInt(obj_id)]
1143
1312
  } else {
1144
1313
  row = $(obj_id)
1145
1314
  }
@@ -1201,7 +1370,8 @@ Grid.notify = function(table, changes) {
1201
1370
  cell.removeClassName('changed')
1202
1371
  cell.removeClassName('error')
1203
1372
  if (cell.getAttribute('data-v') != change[attr]) {
1204
- cell.innerHTML = change[attr]
1373
+ var show = Grid.showValue(grid, attr, change[attr])
1374
+ cell.innerHTML = show || change[attr]
1205
1375
  }
1206
1376
  cell.orig_value = change[attr]
1207
1377
  cell.prev_value = undefined
@@ -1232,6 +1402,7 @@ Grid.simulateClick = function(l) {
1232
1402
  }
1233
1403
 
1234
1404
  Grid.sort = function(cell) {
1405
+ var numeric = cell.hasClassName('numeric')
1235
1406
  var table = cell.up('table')
1236
1407
  var desc = false
1237
1408
  if (cell.hasClassName('asc')) {
@@ -1242,15 +1413,21 @@ Grid.sort = function(cell) {
1242
1413
  table.select('.asc, .desc').each(function(e) { e.removeClassName('asc').removeClassName('desc') })
1243
1414
  cell.addClassName('asc')
1244
1415
  }
1416
+ // TODO move buttons, headers in theaders and simply select('tbody').first()
1417
+ // no need for splice then.
1245
1418
  var body = table.childElements()[0]
1246
1419
  var rows = body.select('tr')
1247
1420
  rows.splice(0,1)
1248
1421
  var col_i = Grid.pos(cell)
1249
1422
 
1250
1423
  rows.sort(function(a, b) {
1251
- var atxt = a.childElements()[col_i].innerHTML.stripTags().toLowerCase()
1252
- var btxt = b.childElements()[col_i].innerHTML.stripTags().toLowerCase()
1253
- return atxt.localeCompare(btxt) * (desc ? -1 : 1)
1424
+ var atxt = a.childElements()[col_i].innerHTML.stripTags().strip().toLowerCase()
1425
+ var btxt = b.childElements()[col_i].innerHTML.stripTags().strip().toLowerCase()
1426
+ if (numeric) {
1427
+ return ((parseFloat(atxt)||0) - (parseFloat(btxt)||0)) * (desc ? -1 : 1)
1428
+ } else {
1429
+ return atxt.localeCompare(btxt) * (desc ? -1 : 1)
1430
+ }
1254
1431
  }).each(Element.prototype.appendChild, body)
1255
1432
  }
1256
1433
 
@@ -1303,4 +1480,3 @@ Tags.make = function(elem, opts) {
1303
1480
  })
1304
1481
  }
1305
1482
 
1306
-