zena 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. data/History.txt +28 -0
  2. data/README.rdoc +6 -6
  3. data/Rakefile +3 -0
  4. data/app/controllers/users_controller.rb +4 -2
  5. data/app/models/acl.rb +6 -0
  6. data/app/models/cached_page.rb +2 -1
  7. data/app/models/document.rb +3 -4
  8. data/app/models/node.rb +8 -5
  9. data/app/models/site.rb +1 -1
  10. data/app/models/template.rb +2 -2
  11. data/app/models/user.rb +5 -3
  12. data/app/views/acls/_add.rhtml +2 -1
  13. data/app/views/acls/_form.rhtml +15 -7
  14. data/app/views/acls/_li.rhtml +2 -0
  15. data/app/views/acls/index.rhtml +3 -1
  16. data/app/views/acls/show.html.erb +1 -1
  17. data/app/views/links/destroy.rjs +16 -2
  18. data/app/views/versions/destroy.rjs +1 -1
  19. data/app/views/zafu/default/Node-admin.zafu +1 -1
  20. data/bin/zena +5 -3
  21. data/bricks/acls/lib/bricks/acls.rb +11 -4
  22. data/bricks/acls/zena/migrate/20110627193757_add_allowed_mode_and_format_to_acl.rb +11 -0
  23. data/bricks/acls/zena/test/integration/acl_integration_test.rb +42 -0
  24. data/bricks/acls/zena/test/sites/erebus/acls.yml +8 -0
  25. data/bricks/mongrel/zena/deploy.rb +19 -0
  26. data/bricks/single/lib/bricks/single.rb +15 -0
  27. data/bricks/single/zena/init.rb +1 -0
  28. data/bricks/sphinx/zena/tasks.rb +1 -1
  29. data/bricks/static/lib/bricks/static.rb +151 -0
  30. data/bricks/static/zena/init.rb +1 -0
  31. data/bricks/static/zena/migrate/20110702010330_add_static_to_idx_templates.rb +12 -0
  32. data/bricks/static/zena/skins/blog/Image-edit.zafu +6 -0
  33. data/bricks/static/zena/skins/blog/Image.zafu +19 -0
  34. data/bricks/static/zena/skins/blog/Node-+index.zafu +1 -0
  35. data/bricks/static/zena/skins/blog/Node-+notFound.zafu +7 -0
  36. data/bricks/static/zena/skins/blog/Node-+search.zafu +19 -0
  37. data/bricks/static/zena/skins/blog/Node.zafu +66 -0
  38. data/bricks/static/zena/skins/blog/Post.zafu +12 -0
  39. data/bricks/static/zena/skins/blog/Project--kml.zafu +30 -0
  40. data/bricks/static/zena/skins/blog/Project.zafu +45 -0
  41. data/bricks/static/zena/skins/blog/comments.zafu +30 -0
  42. data/bricks/static/zena/skins/blog/dict.yml +11 -0
  43. data/bricks/static/zena/skins/blog/img/dateBg.jpg +0 -0
  44. data/bricks/static/zena/skins/blog/img/header.png +0 -0
  45. data/bricks/static/zena/skins/blog/img/mapPin.png +0 -0
  46. data/bricks/static/zena/skins/blog/img/menu.gif +0 -0
  47. data/bricks/static/zena/skins/blog/img/menuover.gif +0 -0
  48. data/bricks/static/zena/skins/blog/img/style.css +110 -0
  49. data/bricks/static/zena/test/integration/static_integration_test.rb +30 -0
  50. data/bricks/static/zena/test/unit/static_test.rb +33 -0
  51. data/bricks/zena/zena/migrate/01_base.rb +1 -2
  52. data/bricks/zena/zena/migrate/20110623072048_fix_cached_path_index.rb +10 -0
  53. data/bricks/zena/zena/migrate/20110710113731_remove_icon_field.rb +18 -0
  54. data/config/bricks.yml +4 -0
  55. data/config/deploy.rb +17 -2
  56. data/config/gems.yml +9 -7
  57. data/config/selenium.yml +38 -0
  58. data/lib/bricks/requirements_validation.rb +8 -2
  59. data/lib/gettext_strings.rb +2 -1
  60. data/lib/tasks/zena.rake +5 -0
  61. data/lib/zena/app.rb +12 -0
  62. data/lib/zena/console.rb +9 -1
  63. data/lib/zena/core_ext/string.rb +7 -2
  64. data/lib/zena/deploy.rb +60 -6
  65. data/lib/zena/deploy/app_init.rhtml +56 -0
  66. data/lib/zena/deploy/haproxy.cnf.rhtml +34 -0
  67. data/lib/zena/deploy/httpd.rhtml +6 -0
  68. data/lib/zena/deploy/start_stop.rhtml +35 -0
  69. data/lib/zena/info.rb +1 -1
  70. data/lib/zena/remote/connection.rb +1 -1
  71. data/lib/zena/site_worker.rb +9 -5
  72. data/lib/zena/use.rb +1 -1
  73. data/lib/zena/use/action.rb +2 -2
  74. data/lib/zena/use/ajax.rb +22 -9
  75. data/lib/zena/use/conditional.rb +5 -0
  76. data/lib/zena/use/context.rb +6 -1
  77. data/lib/zena/use/dates.rb +17 -2
  78. data/lib/zena/use/display.rb +14 -3
  79. data/lib/zena/use/forms.rb +37 -47
  80. data/lib/zena/use/html_tags.rb +3 -0
  81. data/lib/zena/use/node_context.rb +17 -17
  82. data/lib/zena/use/rendering.rb +1 -1
  83. data/lib/zena/use/urls.rb +11 -2
  84. data/lib/zena/use/zafu_attributes.rb +1 -0
  85. data/lib/zena/use/zafu_safe_definitions.rb +16 -1
  86. data/lib/zena/use/zafu_templates.rb +39 -24
  87. data/lib/zena/use/zazen.rb +1 -0
  88. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  89. data/locale/de/zena.po +105 -89
  90. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  91. data/locale/en/zena.mo +0 -0
  92. data/locale/en/zena.po +188 -253
  93. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  94. data/locale/fr/zena.mo +0 -0
  95. data/locale/fr/zena.po +200 -257
  96. data/locale/zena.pot +95 -85
  97. data/public/javascripts/zena.js +2 -2
  98. data/test/fixtures/files/{Node-test.zafu → TestNode.zafu} +206 -4
  99. data/test/functional/nodes_controller_test.rb +2 -2
  100. data/test/integration/navigation_test.rb +9 -3
  101. data/test/integration/query_node/basic.yml +4 -4
  102. data/test/integration/query_node/filters.yml +2 -2
  103. data/test/integration/zafu_compiler/ajax.yml +6 -6
  104. data/test/integration/zafu_compiler/basic.yml +1 -1
  105. data/test/integration/zafu_compiler/calendar.yml +4 -3
  106. data/test/integration/zafu_compiler/conditional.yml +3 -10
  107. data/test/integration/zafu_compiler/context.yml +1 -1
  108. data/test/integration/zafu_compiler/dates.yml +9 -1
  109. data/test/integration/zafu_compiler/display.yml +7 -1
  110. data/test/integration/zafu_compiler/eval.yml +12 -46
  111. data/test/integration/zafu_compiler/forms.yml +1 -1
  112. data/test/integration/zafu_compiler/query.yml +2 -2
  113. data/test/integration/zafu_compiler/relations.yml +19 -9
  114. data/test/integration/zafu_compiler/roles.yml +12 -0
  115. data/test/integration/zafu_compiler/safe_definitions.yml +1 -1
  116. data/test/integration/zafu_compiler/urls.yml +13 -5
  117. data/test/integration/zafu_compiler/version.yml +6 -0
  118. data/test/integration/zafu_compiler/zafu_attributes.yml +4 -4
  119. data/test/integration/zafu_compiler_test.rb +1 -1
  120. data/test/selenium.readme +8 -0
  121. data/test/selenium/Add/0setup.rsel +12 -0
  122. data/test/selenium/Add/add1.rsel +22 -0
  123. data/test/selenium/Add/add2.rsel +22 -0
  124. data/test/selenium/Add/add3.rsel +22 -0
  125. data/test/selenium/Drop/0setup.rsel +12 -0
  126. data/test/selenium/Drop/drop1.rsel +25 -0
  127. data/test/selenium/Drop/drop2.rsel +25 -0
  128. data/test/selenium/Drop/drop3.rsel +51 -0
  129. data/test/selenium/Drop/drop4.rsel +44 -0
  130. data/test/selenium/Drop/drop5.rsel +16 -0
  131. data/test/selenium/Edit/0setup.rsel +12 -0
  132. data/test/selenium/Edit/edit1.rsel +31 -0
  133. data/test/selenium/Edit/edit2.rsel +39 -0
  134. data/test/selenium/Edit/edit3.rsel +40 -0
  135. data/test/selenium/Form/0setup.rsel +12 -0
  136. data/test/selenium/Form/form1.rsel +9 -0
  137. data/test/selenium/Form/form2.rsel +9 -0
  138. data/test/selenium/Paginate/0setup.rsel +12 -0
  139. data/test/selenium/Paginate/paginate1.rsel +24 -0
  140. data/test/selenium/Toggle/0setup.rsel +12 -0
  141. data/test/selenium/Toggle/toggle1.rsel +21 -0
  142. data/test/sites/zena/nodes.yml +4 -4
  143. data/test/sites/zena/roles.yml +3 -2
  144. data/test/sites/zena/versions.yml +12 -11
  145. data/test/unit/core_ext_test.rb +23 -5
  146. data/test/unit/document_test.rb +6 -2
  147. data/test/unit/node_test.rb +2 -2
  148. data/test/unit/remote_test.rb +1 -2
  149. data/test/unit/role_test.rb +2 -2
  150. data/test/unit/user_test.rb +48 -1
  151. data/test/unit/virtual_class_test.rb +7 -7
  152. data/test/unit/zena/acts/secure_test.rb +1 -1
  153. data/test/unit/zena/use/rendering_test.rb +1 -1
  154. data/test/unit/zena/use/urls_test.rb +3 -3
  155. data/zena.gemspec +65 -101
  156. metadata +67 -103
  157. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run 2.tmCommand +0 -24
  158. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Context.tmCommand +0 -58
  159. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run Focused Should.tmCommand +0 -88
  160. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/Run.tmCommand +0 -27
  161. data/vendor/TextMate/Ruby Shoulda.tmbundle/Commands/YAML to Shoulda.tmCommand +0 -23
  162. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Context.tmPreferences +0 -19
  163. data/vendor/TextMate/Ruby Shoulda.tmbundle/Preferences/Symbol List: Should.tmPreferences +0 -19
  164. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory attributes for.tmSnippet +0 -16
  165. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory build.tmSnippet +0 -16
  166. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory.tmSnippet +0 -16
  167. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define with class.tmSnippet +0 -18
  168. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_define.tmSnippet +0 -18
  169. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_next.tmSnippet +0 -16
  170. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/Factory_sequence.tmSnippet +0 -18
  171. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_bad_value.tmSnippet +0 -16
  172. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_contains.tmSnippet +0 -16
  173. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_does_not_contain.tmSnippet +0 -16
  174. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_good_value.tmSnippet +0 -16
  175. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_same_elements.tmSnippet +0 -16
  176. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_save.tmSnippet +0 -16
  177. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_sent_email.tmSnippet +0 -18
  178. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/assert_valid.tmSnippet +0 -16
  179. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/association.tmSnippet +0 -17
  180. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/attribute.tmSnippet +0 -17
  181. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/before_should block.tmSnippet +0 -18
  182. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block get.tmSnippet +0 -22
  183. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block post.tmSnippet +0 -23
  184. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/context block with setup.tmSnippet +0 -25
  185. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/setup.tmSnippet +0 -18
  186. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block with before proc.tmSnippet +0 -18
  187. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should block.tmSnippet +0 -18
  188. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_allow_values_for.tmSnippet +0 -16
  189. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_assign_to.tmSnippet +0 -16
  190. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful denied.tmSnippet +0 -20
  191. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_be_restful.tmSnippet +0 -20
  192. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_belong_to.tmSnippet +0 -16
  193. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change by.tmSnippet +0 -16
  194. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_change from to.tmSnippet +0 -16
  195. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_at_least.tmSnippet +0 -16
  196. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_in_range.tmSnippet +0 -16
  197. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_length_is.tmSnippet +0 -16
  198. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_ensure_value_in_range.tmSnippet +0 -16
  199. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_eventually.tmSnippet +0 -18
  200. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_filter_params.tmSnippet +0 -16
  201. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_and_belong_to_many.tmSnippet +0 -16
  202. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_class_methods.tmSnippet +0 -16
  203. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_column.tmSnippet +0 -16
  204. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_db_columns.tmSnippet +0 -16
  205. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_index.tmSnippet +0 -16
  206. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_indices.tmSnippet +0 -16
  207. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_instance_methods.tmSnippet +0 -16
  208. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_many.tmSnippet +0 -16
  209. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_named_scope.tmSnippet +0 -16
  210. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_one.tmSnippet +0 -16
  211. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_have_readonly_attributes.tmSnippet +0 -16
  212. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_mass_assignment_of.tmSnippet +0 -16
  213. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_allow_values_for.tmSnippet +0 -16
  214. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_assign_to.tmSnippet +0 -16
  215. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_change.tmSnippet +0 -16
  216. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_not_set_the_flash.tmSnippet +0 -16
  217. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_redirect_to.tmSnippet +0 -16
  218. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_a_form.tmSnippet +0 -16
  219. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_template.tmSnippet +0 -16
  220. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_with_layout.tmSnippet +0 -16
  221. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_render_without_layout.tmSnippet +0 -16
  222. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with.tmSnippet +0 -16
  223. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_respond_with_content_type.tmSnippet +0 -16
  224. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_return_from_session.tmSnippet +0 -16
  225. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_route.tmSnippet +0 -16
  226. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_set_the_flash_to.tmSnippet +0 -16
  227. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_acceptance_of.tmSnippet +0 -16
  228. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_numericality_of.tmSnippet +0 -16
  229. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_presence_of.tmSnippet +0 -16
  230. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of with scope.tmSnippet +0 -16
  231. data/vendor/TextMate/Ruby Shoulda.tmbundle/Snippets/should_validate_uniqueness_of.tmSnippet +0 -16
  232. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  233. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/run_script.rb +0 -104
  234. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  235. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/test.rb +0 -17
  236. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/RubyMate/todo.txt +0 -13
  237. data/vendor/TextMate/Ruby Shoulda.tmbundle/Support/bin/yaml_to_shoulda.rb +0 -25
  238. data/vendor/TextMate/Ruby Shoulda.tmbundle/Syntaxes/Ruby on Rails (Shoulda).tmLanguage +0 -166
  239. data/vendor/TextMate/Ruby Shoulda.tmbundle/info.plist +0 -304
  240. data/vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand +0 -37
  241. data/vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand +0 -52
  242. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb +0 -39
  243. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb +0 -118
  244. data/vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb +0 -14
  245. data/vendor/TextMate/Zena.tmbundle/info.plist +0 -17
@@ -6,7 +6,7 @@ default:
6
6
 
7
7
  each_group:
8
8
  src: "<r:nodes do='group' by='kpath'><p do='each_group'><r:kpath/>: <r:each join=', ' do='title'/></p></r:nodes>"
9
- res: "<p>NP: crocodiles, status title</p><p>NDI: it's a lake</p><p>NPA: Keeping things clean !</p><p>NRC: The lake we love</p><p>NNP: parc opening</p><p>ND: water</p>"
9
+ res: "<p>NP: crocodiles, status title</p><p>NDI: it's a lake</p><p>NRC: The lake we love</p><p>NNP: parc opening</p><p>ND: water</p>"
10
10
 
11
11
  set_var:
12
12
  context:
@@ -122,12 +122,20 @@ date_context:
122
122
  src: "<r:show eval='parse_date(\"2008-03-02\")' format='%A %d.%m.%Y'/>"
123
123
  res: "Sunday 02.03.2008"
124
124
 
125
+ parse_date:
126
+ src: "<r:void do='parse_date(\"2011-06-16\")'/>"
127
+ tem: "/parse_date\(\"2011-06-16\", \"%Y-%m-%d %H:%M\", visitor.tz\) %>"
128
+
129
+ parse_date_in_tz:
130
+ src: "<r:default tz='Asia/Jakarta' do='parse_date(\"2011-06-16\")'/>"
131
+ tem: "/parse_date\(\"2011-06-16\", \"%Y-%m-%d %H:%M\", _ztz\) %>"
132
+
125
133
  date_from_params:
126
134
  context:
127
135
  year: 1975
128
136
  old_src: "<r:date select='[param:year]-01-01'><r:show attr='current_date' format='%A %d.%m.%Y'/></r:date>"
129
137
  src: "<r:show eval='parse_date(\"#{params[:year]}-01-01\")' format='%A %d.%m.%Y'/>"
130
- tem: "<%= format_date(parse_date(\"#{params[:year]}-01-01\"), :format => \"%A %d.%m.%Y\") %>"
138
+ tem: "<%= format_date(parse_date(\"#{params[:year]}-01-01\", \"%Y-%m-%d %H:%M\", visitor.tz), :format => \"%A %d.%m.%Y\") %>"
131
139
  res: "Wednesday 01.01.1975"
132
140
 
133
141
  date_from_params_in_query:
@@ -297,6 +297,12 @@ render_h_label:
297
297
  src: "<r:default label='t'><li do='show' attr='title'/></r:default>"
298
298
  res: "<li><label>titre</label> <span>Etat des travaux</span></li>"
299
299
 
300
+ render_label_false:
301
+ context:
302
+ lang: fr
303
+ src: "<r:default label='t'><li do='show' label='false' attr='title'/></r:default>"
304
+ res: "<li>Etat des travaux</li>"
305
+
300
306
  render_h_disabled:
301
307
  src: "<r:default h='false'><r:show attr='title'/></r:default>"
302
308
  tem: "<%= @node.prop['title'] %>"
@@ -326,7 +332,7 @@ each_whitespace:
326
332
  src: |
327
333
  <r:pages in='site' order='id asc' limit='3'><r:each><r:id/><r:node></r:node></r:each>
328
334
  </r:pages>.
329
- res: "53\n12\n34\n.\n"
335
+ res: "53\n37\n12\n.\n"
330
336
 
331
337
  set_class_before_query:
332
338
  # Should use previous node (not list context)
@@ -3,53 +3,19 @@ default:
3
3
  lang: 'en'
4
4
  visitor: 'ant'
5
5
  node: 'status'
6
- src: "simple text"
7
- tem: "simple text"
8
- res: "simple text"
9
-
10
- sprintf:
11
- src: "<b do='eval'>sprintf('%.2f', id)</b>"
12
- res: "<b>22.00</b>"
13
-
14
- set_var:
15
- src: "<r:set var='foo'>I am <r:show attr='title'/></r:set> <p do='show' var='foo'/>"
16
- tem: "<% set_foo = capture do %>I am <%= @node.name %><% end %> <p><%= set_foo %></p>"
17
- res: " <p>I am status</p>"
18
-
19
- eval_mult:
20
- src: "<r:set var='foo'>134</r:set><r:show eval='foo * 0.1'/>"
21
- tem: "<% set_foo = capture do %>134<% end %><%= (set_foo.to_f * 0.1) %>"
22
- res: "13.4"
23
-
24
- eval_with_attr:
25
- src: "<r:show eval='[id] * 10'/>"
26
- tem: "<%= (@node.zip.to_f * 10) %>"
27
- res: "220.0"
28
-
29
- eval_data:
30
- context:
31
- lang: 'en'
32
- visitor: 'ant'
33
- node: 'cleanWater'
34
- src: "<r:data><r:set var='count' do='stat' find='count'/><r:set var='sum' do='stat' find='sum'/><b do='show' eval='sum / count' format='%.3f'/></r:data>"
35
- res: "<b>32.250</b>"
36
-
37
- eval_or:
38
- src: "<r:set var='price'><r:show attr='d_boz'/> 20.3</r:set><r:show eval='price * 10'/>"
39
- res: "203.0"
40
-
41
- eval_or_value_exists:
42
- src: "<r:set var='price'><r:show attr='id'/> 20.3</r:set><r:show eval='price * 10'/>"
43
- res: "220.0"
44
-
45
- show_var:
46
- src: "<r:set var='foo'>12345</r:set><b do='[foo]'/>"
47
- res: "<b>12345</b>"
48
6
 
49
7
  show_var_overwrites_attribute:
50
- src: "<r:set var='name'>12345</r:set><b do='title'/>"
8
+ src: "<r:set title='12345'><b do='title'/></r:set>"
51
9
  res: "<b>12345</b>"
52
10
 
53
- test_var:
54
- src: "<r:set var='hours'>3</r:set><r:if test='hours gt 0'>you have: <r:show attr='hours'/></r:if>"
55
- res: "you have: 3"
11
+ test_set_in_scope:
12
+ src: "<r:set hours='3'><r:if test='hours &gt; 0'>you have: <r:show eval='hours' format='%.2f'/></r:if></r:set>"
13
+ res: "you have: 3.00"
14
+
15
+ test_set_for_siblings:
16
+ src: "<r:set hours='3'/><r:if test='hours &gt; 0'>you have: <r:show eval='hours' format='%.2f'/></r:if>"
17
+ res: "you have: 3.00"
18
+
19
+ test_set_for_siblings_overwrite:
20
+ src: "<r:set hours='3'/><r:set hours='%{hello}'/><r:if test='!hours.blank?'>you have: <r:eval>hours.gsub(/o/,'')</r:eval></r:if>"
21
+ res: "you have: hell"
@@ -36,7 +36,7 @@ new:
36
36
  # Should accept allowed params (from class and roles) and transform ids to zip (back and forth)
37
37
  src: "<r:new klass='Letter' title='%q{Joe}' parent_id='project.id' paper='%q{white}' origin='%q{Mars}' bad='%q{value}'><r:form><r:input name='title'/> <r:input name='parent_id'/></r:form></r:new>"
38
38
  tem: "/:title => \"Joe\", :parent_id => .*@node.project.zip.*, :paper => \"white\", :origin => \"Mars\"/"
39
- res: "/<input type='text' name='node\[title\]' value='Joe'/> <input type='text' name='node\[parent_id\]' value='21'/><div class='hidden'><input type='hidden' name='node\[klass\]' value='Letter'/><input type='hidden' name='node\[paper\]' value='white'/><input type='hidden' name='node\[origin\]' value='Mars'/></div>/"
39
+ res: "/<input type='text' name='node\[title\]' value='Joe'/> <input type='text' name='node\[parent_id\]' value='21'/><div class='hidden'><input type='hidden' name='node\[klass\]' value='Letter'/><input type='submit'/><input type='hidden' name='node\[paper\]' value='white'/><input type='hidden' name='node\[origin\]' value='Mars'/></div>/"
40
40
 
41
41
  translate_id_to_zip:
42
42
  src: "<b do='hot_id'/><i do='parent_id'/>"
@@ -165,7 +165,7 @@ query_with_default:
165
165
  visitor: lion
166
166
  node: cleanWater
167
167
  src: "<r:query default='nodes in project' do='each' join=', ' do='title'/>"
168
- res: "crocodiles, it's a lake, Keeping things clean !, The lake we love, Nice Bananas, parc opening, status title, water"
168
+ res: "crocodiles, it's a lake, The lake we love, Nice Bananas, parc opening, status title, water"
169
169
 
170
170
  query_with_param:
171
171
  # Live compile and query from params
@@ -184,7 +184,7 @@ query_eval:
184
184
  node: cleanWater
185
185
  scope: 'self'
186
186
  src: "<r:query select='pages in #{params[:scope] || \"project\"}' default='pages in project' do='each' join=', ' do='title'/>"
187
- res: 'crocodiles, Keeping things clean !, Nice Bananas, status title'
187
+ res: 'crocodiles, Nice Bananas, status title'
188
188
 
189
189
  query_with_parse:
190
190
  context:
@@ -37,9 +37,9 @@ icon:
37
37
 
38
38
  pages:
39
39
  context:
40
- node: 'cleanWater'
40
+ node: 'zena'
41
41
  src: "<r:pages><r:each join=', '><r:show attr='title'/></r:each></r:pages>"
42
- res: "Keeping things clean !, status title"
42
+ res: "Collections, Kill the bugs, people, projects list, Skins (layout themes)"
43
43
 
44
44
  root:
45
45
  src: "<r:root do='title'/>"
@@ -79,9 +79,9 @@ pages_do_syntax:
79
79
 
80
80
  pages_limit:
81
81
  context:
82
- node: 'cleanWater'
82
+ node: 'zena'
83
83
  src: "<r:pages limit='2' order='title DESC'><r:each join=', '><r:show attr='title'/></r:each></r:pages>"
84
- res: "status title, Keeping things clean !"
84
+ res: "Skins (layout themes), projects list"
85
85
 
86
86
  pages_random:
87
87
  context:
@@ -91,11 +91,11 @@ pages_random:
91
91
 
92
92
  nodes_in_project:
93
93
  src: "<r:nodes in='project' limit='2'><r:each join=', '><r:show attr='title'/></r:each></r:nodes>"
94
- res: "it's a lake, Keeping things clean !"
94
+ res: "it's a lake, Lake Tanganyika"
95
95
 
96
96
  nodes_in_project_stored:
97
97
  src: "<r:void set_foo='this'><r:node where='id = 29 in site'>from <r:show attr='title'/>, look at <r:foo do='title'/>: <r:foo do='pages in project' do='each' join=', ' do='title'/></r:node></r:void>"
98
- res: "from a wiki with Zena, look at status title: Keeping things clean !, status title"
98
+ res: "from a wiki with Zena, look at status title: status title"
99
99
 
100
100
  nodes_in_site:
101
101
  src: "<r:nodes in='site' limit='3'><r:each join=', ' do='show' attr='title'/></r:nodes>"
@@ -289,7 +289,7 @@ projects:
289
289
 
290
290
  nodes:
291
291
  src: "<r:nodes in='project'><r:each join=', ' do='show' attr='title'/></r:nodes>"
292
- res: "it's a lake, Keeping things clean !, Lake Tanganyika, parc opening, status title, water"
292
+ res: "it's a lake, Lake Tanganyika, parc opening, status title, water"
293
293
 
294
294
  menu_with_favorites:
295
295
  context:
@@ -363,7 +363,7 @@ where_not:
363
363
  context:
364
364
  node: 'cleanWater'
365
365
  src: "<r:nodes where='title ne \"status title\"' do='each' join=',' do='title'/>"
366
- res: "it's a lake,Keeping things clean !,Lake Tanganyika,parc opening,water"
366
+ res: "it's a lake,Lake Tanganyika,parc opening,water"
367
367
 
368
368
  where_two_attributes:
369
369
  src: "<r:nodes where='log_at ne event_at' in='site' do='each' join=', ' do='title'/>"
@@ -424,7 +424,7 @@ find_count:
424
424
  context:
425
425
  node: 'cleanWater'
426
426
  src: "<div do='count(\"nodes\")'/>"
427
- res: '<div>6</div>'
427
+ res: '<div>5</div>'
428
428
 
429
429
  same_name_as_class:
430
430
  # we create a relation with 'page' role from Letter.
@@ -464,6 +464,16 @@ array_count:
464
464
  src: "<r:pages in='site' do='count'/>"
465
465
  res: "16"
466
466
 
467
+ first:
468
+ src: "<div do='nodes in site'><r:first do='link'/></div>"
469
+ tem: "/if var2 = var1.first %><a href='<%= zen_path\(var2\) %>'><%= var2.prop\['title'\] %>/"
470
+ res: '/a href.*a wiki with Zena/'
471
+
472
+ rubyless_first:
473
+ src: "<div do='nodes in site'><span do='first.title'/></div>"
474
+ tem: "/span><%= \(var1.first \? var1.first.prop\['title'\] : nil\) %>/"
475
+ res: '<div><span>a wiki with Zena</span></div>'
476
+
467
477
  query_in_array:
468
478
  src: "<div do='posts' do='find(\"posts in site\")'/>"
469
479
  tem: "/Node\.do_find.*Node\.do_find"
@@ -62,6 +62,18 @@ vclass_name:
62
62
  tem: "<% var1 = @node.virtual_class %><%= var1.name %>"
63
63
  res: "Letter"
64
64
 
65
+ vclass_icon:
66
+ src: " <r:Letter do='icon'/>"
67
+ tem: "<% if var1 = VirtualClass[\"Letter\"] %> <%= var1.prop['icon'] %><% end %>"
68
+ res: " /images/page.png"
69
+
70
+ vclass_img:
71
+ context:
72
+ node: letter
73
+ src: "<r:vclass do='img'/>"
74
+ tem: "<% var1 = @node.virtual_class %><img src='<%= var1.prop['icon'] %>'/>"
75
+ res: "<img src='/images/page.png'/>"
76
+
65
77
  vclass_roles:
66
78
  context:
67
79
  node: letter
@@ -96,7 +96,7 @@ map_join:
96
96
  node: 'cleanWater'
97
97
  src: "<r:children do='map(:title).join(\",\")'/>"
98
98
  tem: "/var1.map\{\|_map_obj\| _map_obj.prop\['title'\]\}/"
99
- res: "crocodiles,it's a lake,Keeping things clean !,The lake we love,parc opening,status title,water"
99
+ res: "crocodiles,it's a lake,The lake we love,parc opening,status title,water"
100
100
 
101
101
  map_on_can_be_nil:
102
102
  context:
@@ -129,7 +129,7 @@ link_anchor:
129
129
 
130
130
  link_anchor_title:
131
131
  old_src: "<r:link anchor='[name]'/>"
132
- src: "<r:link anchor='#{title.urlencode}'/>"
132
+ src: "<r:link anchor='#{title.url_name}'/>"
133
133
  res: "<a href='#status-title'>status title</a>"
134
134
 
135
135
  link_anchor_in:
@@ -138,7 +138,7 @@ link_anchor_in:
138
138
 
139
139
  link_anchor_name_in:
140
140
  old_src: "<r:link anchor='[name]' in='parent'/>"
141
- src: "<r:link anchor='#{title.urlencode}' href='parent'/>"
141
+ src: "<r:link anchor='#{title.url_name}' href='parent'/>"
142
142
  res: "<a href='/oo/projects-list/Clean-Water-project#status-title'>status title</a>"
143
143
 
144
144
  link_stored:
@@ -222,13 +222,21 @@ live_link_data_mode:
222
222
  res: "<h2><a id='_title30' href='/en/image30_pv.jpg?967816914293'>bird</a></h2>"
223
223
 
224
224
  url_with_lang:
225
+ context:
226
+ visitor: lion
225
227
  src: "window.location = \"<r:url lang='fr'/>\";"
226
- res: "/\\?lang=fr/"
228
+ res: "/\?lang=fr/"
229
+
230
+ url_with_prefix:
231
+ context:
232
+ visitor: lion
233
+ src: "window.location = \"<r:url prefix='fr'/>\";"
234
+ res: "/test.host/fr"
227
235
 
228
236
  link_in_list_context:
229
237
  src: "<div do='nodes in site'><r:link/></div>"
230
- tem: "/zen_path\(var1.first\).*var1.first.prop\['title'\]/"
231
- res: '/a href.*a wiki with Zena/'
238
+ tem: "/zen_path\(@node\).*@node.prop\['title'\]/"
239
+ res: '/a href.*page22.html.*status title/'
232
240
 
233
241
  link_trans:
234
242
  src: "<r:link t='img_next_page'/>"
@@ -45,3 +45,9 @@ created_at:
45
45
  updated_at:
46
46
  src: "<p do='show' eval='v.updated_at' format='%d %b %y'/>"
47
47
  res: "<p>11 Apr 06</p>"
48
+
49
+ versions:
50
+ context:
51
+ node: 'opening'
52
+ src: "<r:versions do='each' join=', '>[<r:updated_at format='%Y-%m-%d'/>/<r:author do='title'/>/<r:lang/>] <r:title/></r:versions>"
53
+ res: "[2006-04-16/Panthera Tigris Sumatran/fr] super ouverture, [2006-04-15/Panthera Tigris Sumatran/en] parc opening, [2006-04-11/Solenopsis Invicta/fr] ouverture du parc"
@@ -134,11 +134,11 @@ on_if_on_each:
134
134
  # We use 'this' to make sure we are not in a list context.
135
135
  src: "<r:pages><p do='each' on_if='this.title == \"status title\"' do='title'/></r:pages>"
136
136
  tem: "/var2.prop\['title'\]==\"status title\"/"
137
- res: "<p class=''>crocodiles</p><p class=''>Keeping things clean !</p><p class=' on'>status title</p>"
137
+ res: "<p class=''>crocodiles</p><p class=' on'>status title</p>"
138
138
 
139
139
  on_if_ancestor:
140
140
  src: "<r:root><r:pages><li do='each' on_if='is_ancestor?(main)' class='hello' join=', ' do='title'/></r:pages></r:root>"
141
- res: "<li class='hello'>Collections</li>, <li class='hello'>Nature</li>, <li class='hello'>people</li>, <li class='hello on'>projects list</li>, <li class='hello'>Skins (layout themes)</li>"
141
+ res: "<li class='hello'>Collections</li>, <li class='hello'>Kill the bugs</li>, <li class='hello'>Nature</li>, <li class='hello'>people</li>, <li class='hello on'>projects list</li>, <li class='hello'>Skins (layout themes)</li>"
142
142
 
143
143
  on_if_empty:
144
144
  src: "<li do='void' on_if='custom_a.blank?'>hello</li>"
@@ -151,7 +151,7 @@ test_negative_value:
151
151
 
152
152
  anchor_attribute:
153
153
  # Use to_s so that the method executed replaces the dummy text.
154
- src: "<p do='id.to_s' anchor='#{title.urlencode}'>hello</p>"
154
+ src: "<p do='id.to_s' anchor='#{title.url_name}'>hello</p>"
155
155
  res: "<a class='anchor' name='status-title'></a><p>22</p>"
156
156
 
157
157
  anchor_true:
@@ -167,7 +167,7 @@ anchor_in_link:
167
167
  res: "<a class='xx' href='#node22'>status title</a>"
168
168
 
169
169
  anchor_tag:
170
- src: "<r:anchor/> <r:anchor anchor='#{title.urlencode}'/>"
170
+ src: "<r:anchor/> <r:anchor anchor='#{title.url_name}'/>"
171
171
  res: "<a class='anchor' name='node22'></a> <a class='anchor' name='status-title'></a>"
172
172
 
173
173
  live_with_show:
@@ -35,6 +35,7 @@ class ZafuCompilerTest < Zena::Controller::TestCase
35
35
  'meta',
36
36
  'context',
37
37
  'comments',
38
+ 'eval',
38
39
  ]
39
40
 
40
41
  BUG = [
@@ -42,7 +43,6 @@ class ZafuCompilerTest < Zena::Controller::TestCase
42
43
  'basic',
43
44
  'complex',
44
45
  'data',
45
- 'eval',
46
46
  'complex',
47
47
  ]
48
48
 
@@ -0,0 +1,8 @@
1
+ In order to run these tests, you must install the selenium on rails plugin, start the server and visit the selenium test page or run the rake task:
2
+
3
+ 1. script/plugin http://svn.openqa.org/svn/selenium-on-rails/stable/selenium-on-rails
4
+ 2. zena test_server
5
+ 3. launch tests with
6
+ $ rake test:acceptance
7
+ or by visiting
8
+ http://test.host:3000/selenium
@@ -0,0 +1,12 @@
1
+ # See also the RDoc for SeleniumOnRails::TestBuilder.
2
+ # View result in browser: http://test.host:3000/selenium
3
+
4
+ setup :fixtures => :all
5
+
6
+ # Setup code
7
+ open '/login'
8
+ type 'user_login', 'lion'
9
+ type 'password', 'lion'
10
+ click_and_wait 'commit'
11
+ click_and_wait 'link=Kill the bugs'
12
+ verify_text '_title37', 'Kill the bugs'
@@ -0,0 +1,22 @@
1
+ # Add first element
2
+ open '/oo/testnode37.html?test=add1'
3
+ assert_not_visible 'add11_title'
4
+ click 'css=img[alt=add]'
5
+ assert_visible 'add11_title'
6
+ type 'add11_title', 'add1'
7
+ click 'css=input[type=submit]'
8
+ wait_for_not_visible 'add11_title'
9
+ verify_text 'css=.add1 a', 'add1'
10
+ # should have correct parent
11
+ verify_text 'css=.add1 span', 'Kill the bugs'
12
+
13
+ # Add a second element
14
+ assert_not_visible 'add11_title'
15
+ click 'css=img[alt=add]'
16
+ assert_visible 'add11_title'
17
+ type 'add11_title', 'add1_2'
18
+ click 'css=input[type=submit]'
19
+ wait_for_not_visible 'add11_title'
20
+ verify_text 'css=.add1_2 a', 'add1_2'
21
+ # should have correct parent
22
+ verify_text 'css=.add1_2 span', 'Kill the bugs'
@@ -0,0 +1,22 @@
1
+ # Add first element
2
+ open '/oo/testnode37.html?test=add2'
3
+ assert_not_visible 'add21_title'
4
+ click 'css=img[alt=add]'
5
+ assert_visible 'add21_title'
6
+ type 'add21_title', 'add2'
7
+ click 'css=input[type=submit]'
8
+ wait_for_not_visible 'add21_title'
9
+ verify_text 'css=.add2 a', 'add2'
10
+ # should have set parent
11
+ verify_text 'css=.add2 span', 'Zena the wild CMS'
12
+
13
+ # Add a second element
14
+ assert_not_visible 'add21_title'
15
+ click 'css=img[alt=add]'
16
+ assert_visible 'add21_title'
17
+ type 'add21_title', 'add2_2'
18
+ click 'css=input[type=submit]'
19
+ wait_for_not_visible 'add21_title'
20
+ verify_text 'css=.add2_2 a', 'add2_2'
21
+ # should have set parent
22
+ verify_text 'css=.add2_2 span', 'Zena the wild CMS'
@@ -0,0 +1,22 @@
1
+ # Add first element
2
+ open '/oo/testnode37.html?test=add3'
3
+ assert_not_visible 'add31_title'
4
+ click 'css=img[alt=add]'
5
+ assert_visible 'add31_title'
6
+ type 'add31_title', 'add3'
7
+ click 'css=input[type=submit]'
8
+ wait_for_not_visible 'add31_title'
9
+ verify_text 'css=.add3 a', 'add3'
10
+ # should have correct parent
11
+ verify_text 'css=.add3 span', 'Kill the bugs'
12
+
13
+ # Add a second element
14
+ assert_not_visible 'add31_title'
15
+ click 'css=img[alt=add]'
16
+ assert_visible 'add31_title'
17
+ type 'add31_title', 'add3_2'
18
+ click 'css=input[type=submit]'
19
+ wait_for_not_visible 'add31_title'
20
+ verify_text 'css=.add3_2 a', 'add3_2'
21
+ # should have correct parent
22
+ verify_text 'css=.add3_2 span', 'Kill the bugs'