zena 1.0.0.rc2 → 1.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. data/History.txt +23 -0
  2. data/README.rdoc +1 -1
  3. data/app/controllers/columns_controller.rb +3 -31
  4. data/app/controllers/comments_controller.rb +8 -3
  5. data/app/controllers/data_entries_controller.rb +1 -1
  6. data/app/controllers/documents_controller.rb +2 -2
  7. data/app/controllers/nodes_controller.rb +29 -12
  8. data/app/controllers/relations_controller.rb +2 -2
  9. data/app/controllers/sites_controller.rb +1 -1
  10. data/app/controllers/user_sessions_controller.rb +6 -3
  11. data/app/controllers/users_controller.rb +18 -16
  12. data/app/controllers/versions_controller.rb +20 -18
  13. data/app/controllers/virtual_classes_controller.rb +103 -17
  14. data/app/helpers/users_helper.rb +1 -1
  15. data/app/models/column.rb +19 -50
  16. data/app/models/comment.rb +2 -1
  17. data/app/models/node.rb +45 -22
  18. data/app/models/relation.rb +13 -0
  19. data/app/models/relation_proxy.rb +3 -2
  20. data/app/models/role.rb +213 -4
  21. data/app/models/site.rb +18 -11
  22. data/app/models/template.rb +37 -35
  23. data/app/models/version.rb +1 -1
  24. data/app/models/virtual_class.rb +154 -86
  25. data/app/views/columns/_li.html.erb +1 -1
  26. data/app/views/columns/index.html.erb +1 -9
  27. data/app/views/comments/index.rhtml +10 -8
  28. data/app/views/documents/_crop.rhtml +5 -6
  29. data/app/views/documents/crop_form.rjs +3 -2
  30. data/app/views/groups/index.rhtml +1 -1
  31. data/app/views/iformats/index.rhtml +1 -1
  32. data/app/views/nodes/_import_results.rhtml +1 -1
  33. data/app/views/nodes/_parent.rhtml +1 -2
  34. data/app/views/nodes/update.rjs +3 -4
  35. data/app/views/relations/index.erb +1 -1
  36. data/app/views/sites/index.erb +1 -1
  37. data/app/views/templates/drive_tabs/_drive.rhtml +0 -2
  38. data/app/views/templates/edit_tabs/_image.rhtml +1 -1
  39. data/app/views/templates/edit_tabs/_title.rhtml +0 -6
  40. data/app/views/users/index.rhtml +1 -1
  41. data/app/views/users/preferences.html.erb +2 -2
  42. data/app/views/versions/backup.rjs +1 -1
  43. data/app/views/versions/custom_tab.rhtml +9 -4
  44. data/app/views/versions/destroy.rjs +2 -2
  45. data/app/views/versions/update.rjs +2 -9
  46. data/app/views/virtual_classes/_form.erb +3 -2
  47. data/app/views/virtual_classes/import_prepare.html.erb +13 -0
  48. data/app/views/virtual_classes/index.erb +28 -8
  49. data/app/views/zafu/default/Node-+adminLayout.zafu +1 -13
  50. data/app/views/zafu/default/Node-+login.zafu +1 -0
  51. data/app/views/zafu/default/Node-+notFound.zafu +1 -1
  52. data/app/views/zafu/default/Node-+popupLayout.zafu +1 -2
  53. data/app/views/zafu/default/Node-+search.zafu +1 -1
  54. data/app/views/zafu/default/Node-admin.zafu +205 -0
  55. data/app/views/zafu/default/Node.zafu +11 -11
  56. data/bricks/captcha/lib/bricks/captcha.rb +3 -2
  57. data/bricks/mongrel/zena/init.rb +2 -1
  58. data/bricks/pdf/README +5 -5
  59. data/bricks/pdf/lib/bricks/pdf/engine/prince.rb +2 -2
  60. data/bricks/pdf/lib/bricks/pdf/engine/xhtml2pdf.rb +2 -2
  61. data/bricks/pdf/lib/bricks/pdf/install.rb +5 -5
  62. data/bricks/pdf/lib/bricks/pdf.rb +11 -11
  63. data/bricks/pdf/test/engines/test_prince.rb +4 -4
  64. data/bricks/pdf/test/engines/test_xhtml2pdf.rb +4 -4
  65. data/bricks/pdf/test/shoulda_macros/shoulda_pdf.rb +2 -2
  66. data/bricks/pdf/zena/init.rb +2 -2
  67. data/bricks/pdf/zena/tasks.rb +2 -2
  68. data/bricks/sphinx/lib/bricks/sphinx.rb +6 -2
  69. data/bricks/sphinx/zena/{sphinx.yml → sphinx.yml.erb} +2 -2
  70. data/bricks/sphinx/zena/tasks.rb +28 -2
  71. data/bricks/tags/lib/bricks/tags.rb +16 -1
  72. data/bricks/tags/zena/test/unit/tags_test.rb +15 -0
  73. data/bricks/tags/zena/test/zafu/tags.yml +5 -1
  74. data/bricks/worker/lib/bricks/worker.rb +39 -0
  75. data/bricks/worker/zena/deploy.rb +0 -2
  76. data/bricks/worker/zena/init.rb +1 -0
  77. data/bricks/worker/zena/test/sites/zena/delayed_jobs.yml +16 -0
  78. data/bricks/worker/zena/test/zafu/worker.yml +8 -0
  79. data/bricks/zena/zena/migrate/01_base.rb +36 -60
  80. data/bricks/zena/zena/migrate/02_zerox1_schema.rb +388 -0
  81. data/bricks/zena/zena/migrate/03_zerox1_data.rb +380 -0
  82. data/bricks/zena/zena/migrate/20110315161158_add_reverse_scope_to_roles.rb +9 -0
  83. data/config/database_example.yml +1 -1
  84. data/config/environment.rb +1 -1
  85. data/config/gems.yml +17 -14
  86. data/db/init/base/skins/default/Node-+index.zafu +8 -1
  87. data/db/init/base/skins/default/Node-+login.zafu +1 -0
  88. data/db/init/base/skins/default/Node-+popupLayout.zafu +1 -2
  89. data/db/init/base/skins/default/Node-+search.zafu +2 -2
  90. data/db/init/base/skins/default/Node.zafu +9 -9
  91. data/db/init/base/skins/default/{favicon.png → img/favicon.png} +0 -0
  92. data/db/init/base/skins/default/{style.css → img/style.css} +0 -0
  93. data/db/init/base/skins/default/img/translations.yml +11 -0
  94. data/db/init/base/skins/default/notes.zafu +7 -9
  95. data/doc/zafu_changes.yml +12 -0
  96. data/lib/bricks/loader.rb +38 -15
  97. data/lib/tasks/zena.rake +74 -24
  98. data/lib/zena/acts/enrollable.rb +4 -1
  99. data/lib/zena/acts/secure.rb +2 -48
  100. data/lib/zena/acts/serializable.rb +13 -1
  101. data/lib/zena/app.rb +9 -0
  102. data/lib/zena/code_syntax.rb +154 -151
  103. data/lib/zena/console.rb +141 -0
  104. data/lib/zena/controller/test_case.rb +1 -1
  105. data/lib/zena/db_helper/abstract_db.rb +17 -5
  106. data/lib/zena/db_helper/mysql.rb +14 -12
  107. data/lib/zena/db_helper/postgresql.rb +1 -2
  108. data/lib/zena/db_helper/sqlite3.rb +6 -6
  109. data/lib/zena/deploy/awstats.conf.rhtml +1 -1
  110. data/lib/zena/deploy/httpd.rhtml +6 -1
  111. data/lib/zena/deploy/vhost.rhtml +9 -1
  112. data/lib/zena/deploy.rb +12 -7
  113. data/lib/zena/foxy_parser.rb +3 -1
  114. data/lib/zena/info.rb +1 -1
  115. data/lib/zena/parser/zafu_tags.rb +1 -0
  116. data/lib/zena/parser/zazen_rules.rb +1 -1
  117. data/lib/zena/remote/node.rb +15 -3
  118. data/lib/zena/remote/serializable_array.rb +19 -0
  119. data/lib/zena/remote.rb +1 -0
  120. data/lib/zena/routes.rb +7 -2
  121. data/lib/zena/site_worker.rb +11 -1
  122. data/lib/zena/unit/test_case.rb +68 -0
  123. data/lib/zena/use/action.rb +6 -2
  124. data/lib/zena/use/ajax.rb +127 -53
  125. data/lib/zena/use/ancestry.rb +11 -8
  126. data/lib/zena/use/calendar.rb +265 -129
  127. data/lib/zena/use/conditional.rb +1 -1
  128. data/lib/zena/use/context.rb +5 -5
  129. data/lib/zena/use/dates.rb +172 -60
  130. data/lib/zena/use/display.rb +70 -39
  131. data/lib/zena/use/error_rendering.rb +1 -3
  132. data/lib/zena/use/field_index.rb +4 -1
  133. data/lib/zena/use/forms.rb +94 -72
  134. data/lib/zena/use/fulltext.rb +16 -24
  135. data/lib/zena/use/html_tags.rb +20 -12
  136. data/lib/zena/use/i18n.rb +37 -37
  137. data/lib/zena/use/image_builder.rb +8 -1
  138. data/lib/zena/use/ml_index.rb +16 -16
  139. data/lib/zena/use/prop_eval.rb +10 -5
  140. data/lib/zena/use/query_builder.rb +55 -23
  141. data/lib/zena/use/query_node.rb +51 -25
  142. data/lib/zena/use/refactor.rb +2 -28
  143. data/lib/zena/use/relations.rb +1 -1
  144. data/lib/zena/use/rendering.rb +29 -0
  145. data/lib/zena/use/scope_index.rb +75 -14
  146. data/lib/zena/use/search.rb +5 -10
  147. data/lib/zena/use/test_helper.rb +2 -2
  148. data/lib/zena/use/urls.rb +125 -104
  149. data/lib/zena/use/workflow.rb +2 -1
  150. data/lib/zena/use/zafu_attributes.rb +2 -2
  151. data/lib/zena/use/zafu_safe_definitions.rb +20 -0
  152. data/lib/zena/use/zafu_templates.rb +20 -6
  153. data/lib/zena/use/zazen.rb +31 -20
  154. data/lib/zena/view/test_case.rb +5 -0
  155. data/lib/zena/zafu_compiler.rb +24 -2
  156. data/lib/zena.rb +12 -6
  157. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  158. data/locale/de/zena.po +1345 -1164
  159. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  160. data/locale/en/zena.po +1275 -1129
  161. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  162. data/locale/fr/zena.mo +0 -0
  163. data/locale/fr/zena.po +1617 -1441
  164. data/locale/log.txt +9 -0
  165. data/locale/zena.pot +957 -748
  166. data/public/javascripts/prototype.js +1 -1
  167. data/public/javascripts/zena.js +99 -44
  168. data/public/stylesheets/admin.css +6 -4
  169. data/public/stylesheets/backend.css +71 -0
  170. data/public/stylesheets/calendar.css +24 -25
  171. data/public/stylesheets/code.css +11 -6
  172. data/public/stylesheets/comment.css +2 -1
  173. data/public/stylesheets/popup.css +7 -8
  174. data/test/custom_queries/complex.host.yml +15 -1
  175. data/test/fixtures/files/Node-test.zafu +29 -28
  176. data/test/fixtures/files/translations_de.yml +12 -1
  177. data/test/fixtures/files/translations_fr.yml +12 -1
  178. data/test/functional/comments_controller_test.rb +9 -0
  179. data/test/functional/iformats_controller_test.rb +1 -1
  180. data/test/functional/nodes_controller_test.rb +124 -35
  181. data/test/functional/users_controller_test.rb +132 -3
  182. data/test/functional/virtual_classes_controller_test.rb +75 -4
  183. data/test/integration/navigation_test.rb +51 -9
  184. data/test/integration/query_node/basic.yml +19 -7
  185. data/test/integration/query_node/complex.yml +1 -1
  186. data/test/integration/query_node/dates.yml +27 -1
  187. data/test/integration/query_node/filters.yml +1 -1
  188. data/test/integration/query_node/relations.yml +13 -4
  189. data/test/integration/query_node_test.rb +4 -0
  190. data/test/integration/xml_api_test.rb +6 -1
  191. data/test/integration/zafu_compiler/action.yml +3 -3
  192. data/test/integration/zafu_compiler/ajax.yml +103 -22
  193. data/test/integration/zafu_compiler/basic.yml +0 -52
  194. data/test/integration/zafu_compiler/calendar.yml +44 -20
  195. data/test/integration/zafu_compiler/comments.yml +53 -0
  196. data/test/integration/zafu_compiler/complex.yml +11 -11
  197. data/test/integration/zafu_compiler/complex_ok.yml +16 -3
  198. data/test/integration/zafu_compiler/conditional.yml +15 -5
  199. data/test/integration/zafu_compiler/context.yml +9 -0
  200. data/test/integration/zafu_compiler/dates.yml +43 -15
  201. data/test/integration/zafu_compiler/display.yml +60 -6
  202. data/test/integration/zafu_compiler/errors.yml +6 -2
  203. data/test/integration/zafu_compiler/forms.yml +45 -6
  204. data/test/integration/zafu_compiler/i18n.yml +8 -1
  205. data/test/integration/zafu_compiler/meta.yml +38 -0
  206. data/test/integration/zafu_compiler/query.yml +43 -4
  207. data/test/integration/zafu_compiler/relations.yml +26 -33
  208. data/test/integration/zafu_compiler/rubyless.yml +10 -0
  209. data/test/integration/zafu_compiler/safe_definitions.yml +21 -1
  210. data/test/integration/zafu_compiler/urls.yml +75 -5
  211. data/test/integration/zafu_compiler/version.yml +2 -2
  212. data/test/integration/zafu_compiler/zafu_attributes.yml +5 -1
  213. data/test/integration/zafu_compiler/zazen.yml +14 -6
  214. data/test/integration/zafu_compiler_test.rb +5 -1
  215. data/test/sites/complex/columns.yml +5 -0
  216. data/test/sites/complex/roles.yml +4 -0
  217. data/test/sites/zena/nodes.yml +13 -2
  218. data/test/sites/zena/roles.yml +13 -5
  219. data/test/sites/zena/versions.yml +27 -9
  220. data/test/unit/column_test.rb +51 -5
  221. data/test/unit/iformat_test.rb +2 -2
  222. data/test/unit/node_test.rb +29 -17
  223. data/test/unit/note_test.rb +1 -1
  224. data/test/unit/relation_proxy_test.rb +4 -5
  225. data/test/unit/relation_test.rb +16 -0
  226. data/test/unit/remote_test.rb +2 -2
  227. data/test/unit/role_test.rb +292 -4
  228. data/test/unit/site_test.rb +12 -0
  229. data/test/unit/template_test.rb +1 -1
  230. data/test/unit/text_document_test.rb +1 -1
  231. data/test/unit/virtual_class_test.rb +200 -83
  232. data/test/unit/zena/acts/enrollable_test.rb +26 -31
  233. data/test/unit/zena/use/calendar_test.rb +90 -37
  234. data/test/unit/zena/use/field_index_test.rb +28 -0
  235. data/test/unit/zena/use/html_tags_test.rb +7 -3
  236. data/test/unit/zena/use/ml_index_test.rb +2 -16
  237. data/test/unit/zena/use/nested_attributes_alias_view_test.rb +2 -2
  238. data/test/unit/zena/use/prop_eval_test.rb +50 -8
  239. data/test/unit/zena/use/query_node_test.rb +11 -0
  240. data/test/unit/zena/use/rendering_test.rb +72 -0
  241. data/test/unit/zena/use/scope_index_test.rb +37 -2
  242. data/test/unit/zena/use/urls_test.rb +10 -0
  243. data/test/unit/zena/use/zazen_test.rb +3 -3
  244. data/vendor/plugins/gettext_i18n_rails/Gemfile +11 -0
  245. data/vendor/plugins/gettext_i18n_rails/Gemfile.lock +92 -0
  246. data/vendor/plugins/gettext_i18n_rails/Rakefile +12 -17
  247. data/vendor/plugins/gettext_i18n_rails/Readme.md +215 -0
  248. data/vendor/plugins/gettext_i18n_rails/VERSION +1 -1
  249. data/vendor/plugins/gettext_i18n_rails/gettext_i18n_rails.gemspec +38 -34
  250. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb +1 -1
  251. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/backend.rb +30 -14
  252. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/haml_parser.rb +1 -1
  253. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/html_safe_translations.rb +29 -0
  254. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/i18n_hacks.rb +29 -1
  255. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/model_attributes_finder.rb +7 -1
  256. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/railtie.rb +10 -0
  257. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/ruby_gettext_extractor.rb +6 -2
  258. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/string_interpolate_fix.rb +20 -0
  259. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/tasks.rb +120 -0
  260. data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails.rb +10 -3
  261. data/vendor/plugins/gettext_i18n_rails/lib/tasks/gettext_rails_i18n.rake +1 -74
  262. data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/active_record_spec.rb +51 -20
  263. data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/backend_spec.rb +12 -7
  264. data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/string_interpolate_fix_spec.rb +32 -0
  265. data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails_spec.rb +38 -1
  266. data/vendor/plugins/gettext_i18n_rails/spec/rails2/Gemfile +11 -0
  267. data/vendor/plugins/gettext_i18n_rails/spec/spec_helper.rb +1 -8
  268. data/zena.gemspec +2241 -2217
  269. metadata +123 -83
  270. data/.gitignore +0 -36
  271. data/app/views/nodes/_dates.rhtml +0 -13
  272. data/db/init/base/skins/default/Node-+adminLayout.zafu +0 -46
  273. data/db/init/base/skins/default/Node-tree.zafu +0 -19
  274. data/vendor/plugins/gettext_i18n_rails/README.markdown +0 -143
@@ -17,14 +17,42 @@ add:
17
17
 
18
18
  edit_not_each:
19
19
  src: "<li class='blah'>this is a post <r:edit>edit post</r:edit></li>"
20
- res: "/<li class='blah'>this is a post <a href='/nodes/22/edit'>edit</a></li>/"
20
+ res: "/<li class='blah'>this is a post <a href='/nodes/22/versions/0/edit'>edit</a></li>/"
21
+
22
+ edit_in_block:
23
+ src: "<li do='block'><r:title/> <r:edit/></li>"
24
+ res: "/Ajax.Request\(\"/nodes/22/zafu\?dom_id=list1&"
25
+ 'ajax/edit/in/block/en/list1_form.erb': "/f.text_field :title.*alt='cancel/"
26
+
27
+ edit_in_block_publish:
28
+ src: "<li do='block'><r:title/> <r:edit publish='true'/></li>"
29
+ res: "/Ajax.Request\(\"/nodes/22/zafu\?dom_id=list1/"
30
+ 'ajax/edit/in/block/publish/en/list1_form.erb': "/name='node\[v_status\]' value='50'/"
31
+
32
+ edit_in_block_cancel:
33
+ src: "<li do='block'><r:title/> <r:edit tcancel='en'/></li>"
34
+ res: "/Ajax.Request\(\"/nodes/22/zafu\?dom_id=list1/"
35
+ 'ajax/edit/in/block/cancel/en/list1_form.erb': "/link_to_remote\(\"english\"/"
36
+
37
+ form_in_block:
38
+ src: "<li do='block'><r:form>XYZ</r:form><r:title/> <r:edit/></li>"
39
+ res: "/XYZ/"
40
+ 'ajax/form/in/block/en/list1_form.erb': "/XYZ/"
41
+ 'ajax/form/in/block/en/list1.erb': "/XYZ/"
42
+
43
+ form_in_block_edit_only:
44
+ src: "<li do='block'><r:form on='edit'>XYZ</r:form><r:title/> <r:edit/></li>"
45
+ res: "!/XYZ/"
46
+ 'ajax/form/in/block/edit/only/en/list1_form.erb': "/XYZ/"
47
+ 'ajax/form/in/block/edit/only/en/list1.erb': "!/XYZ/"
21
48
 
22
49
  add_each_no_form:
23
50
  src: "<ul do='children' id='things'><li do='each'>I <p do='title'>blah</p></li><li do='add'/></ul>"
51
+ tem: "!/</ul><ul></ul>/" # bug in closing group with [add].
24
52
  res: "/<ul><li.*id='things_add'.*li.*class='form' id='things_form'.*form.*I <p><input id=.things_title. name=.node\[title\]. .*type=.text..*hidden/"
25
53
 
26
54
  add_each_no_form_date:
27
- src: "<ul do='children' id='things'><li do='each'>I <p do='show' date='event_at' tformat='short_date'>blah</p></li><li do='add'/></ul>"
55
+ src: "<ul do='children' id='things'><li do='each'>I <p do='show' attr='event_at' tformat='short_date'>blah</p></li><li do='add'/></ul>"
28
56
  res: "/<ul><li.*id='things_add'.*li.*id='things_form'.*form.*I <p>.*date_box.*name='node\[event_at\]' type='text' value.*hidden/"
29
57
 
30
58
  add_each_no_form_focus:
@@ -67,7 +95,7 @@ each_add_with_form_klass_set:
67
95
  res: "!/hidden.*node\[klass\].*Node.*select.*node\[klass\]/"
68
96
 
69
97
  each_add_with_select:
70
- src: "<r:children><r:each do='title'/><r:add/><r:form><select name='icon_id' nodes='images in project' selected='[main.icon_id]_abc'/></r:form></r:children>"
98
+ src: "<r:children><r:each do='title'/><r:add/><r:form><r:select name='icon_id' nodes='images in project' selected='[main.icon_id]_abc'/></r:form></r:children>"
71
99
  'ajax/each/add/with/select/en/list1_form.erb': '/map.|r| \[r.name, r.zip.to_s\]., \"#.@node.icon_zip._abc\"\)/'
72
100
  tem: "/nodes.kpath LIKE 'NDI%'/"
73
101
 
@@ -75,7 +103,20 @@ each_edit_with_form:
75
103
  context:
76
104
  node: 'wiki'
77
105
  src: "<r:children><li do='each'><r:show attr='title'>blah</r:show> <r:edit>edit</r:edit></li>\n<r:form><li><form>this is the form</form></li></r:form></r:children>"
78
- res: "/<li id='list1_30'>bird <a href='/nodes/30/edit' onclick='new Ajax.Request\(\"/nodes/30/edit\?.*t_url=ajax%2Feach%2Fedit%2Fwith%2Fform%2Flist1_form/"
106
+ res: "/<li id='list1_30'>bird <a href='/nodes/30/versions/0/edit' onclick='new Ajax.Request\(\"/nodes/30/zafu\?.*t_url=ajax%2Feach%2Fedit%2Fwith%2Fform%2Flist1_form/"
107
+
108
+ form_with_dictionary:
109
+ context:
110
+ node: 'wiki'
111
+ src: "<r:load dictionary='/Default skin/translations'><r:children><li do='each'><span do='t(\"foo#{origin}\")'/> <r:edit>edit</r:edit></li>\n<li do='form'><r:select name='origin' values=',en,fr,de' tshow=',en,fr,de'/></li></r:children></r:load>"
112
+ # Partial should lazy load dictionary
113
+ 'ajax/form/with/dictionary/en/list1_form.erb': "/_zdict = load_dictionary/"
114
+ 'ajax/form/with/dictionary/en/list1.erb': "/_zdict = load_dictionary.*_zdict.get\(\"foo\#\{@node.prop\['origin'\]\}\"\)/"
115
+
116
+ block_dictionary:
117
+ src: "<r:load dictionary='/Default skin/translations'><r:block>...</r:block></r:load>"
118
+ # Partial should lazy load dictionary
119
+ 'ajax/block/dictionary/en/list1.erb': "/_zdict = load_dictionary/"
79
120
 
80
121
  make_form:
81
122
  src: "<ul do='children'><li do='each' do='title'/><li do='add'/></ul>"
@@ -128,7 +169,8 @@ live_filter:
128
169
  context:
129
170
  node: cleanWater
130
171
  src: "<r:filter live='true'/><r:block><ol do='pages where title like \"#{params[:f]}%\"'><li do='each' do='title'/></ol></r:block>"
131
- tem: "/ml1.value LIKE \?.*, \"#\{params\[:f\]\}%\"/"
172
+ # Make sure a unique_name is set for the given block
173
+ tem: "/name='t_url' value='ajax/live/filter/list1'.*<% filter_form\(@node.*ml1.value LIKE \?.*, \"#\{params\[:f\]\}%\"/"
132
174
  'ajax/live/filter/en/list1.erb': "/<div id='list1.*, \"#\{params\[:f\]\}%\".*var2.prop\['title'\]/"
133
175
  res: "/<input type='text' name='f'.*<div id='list1'><ol><li>crocodiles</li><li>Keeping things clean !</li><li>status title</li></ol></div>/"
134
176
 
@@ -143,26 +185,26 @@ live_filter_single_element:
143
185
  live_filter_select_options:
144
186
  context:
145
187
  node: cleanWater
146
- src: "<r:filter live='true' do='select' name='f' values='1,2'/><r:block><ol do='pages where title like \"#{params[:f]}%\"'><li do='each' do='title'/></ol></r:block>"
188
+ src: "<r:filter live='true' do='select' param='f' values='1,2'/><r:block><ol do='pages where title like \"#{params[:f]}%\"'><li do='each' do='title'/></ol></r:block>"
147
189
  tem: "/select name=.f.><%= options_for_select\(\[.1., .2.\], params\[:f\].to_s/"
148
190
  'ajax/live/filter/select/options/en/list1.erb': "/<div id='list1'.*params\[:f\]/"
149
191
  res: "/<select name='f'.*<div id='list1'><ol><li>crocodiles</li><li>Keeping things clean !</li><li>status title</li></ol></div>/"
150
192
 
151
193
  draggable_do_syntax:
152
194
  src: "<r:images in='site' do='each' draggable='all' do='img' mode='pv'/>"
153
- tem: "/add_drag_id\(\"drag_#\{var2.zip\}\"/"
195
+ tem: "/add_drag_id\(%Q\{drag_#\{var2.zip\}\}/"
154
196
  res: "/id='drag_30'><img src='/en/image30_pv.jpg\?967816914293'/"
155
197
  js: '/"drag_24"\].each.*Zena.draggable\(item, false\)/'
156
198
 
157
199
  draggable_true:
158
200
  # should use 'drag_handle' class
159
201
  src: "<r:link draggable='true'><b do='title'/></r:link>"
160
- tem: "/span class='drag_handle'.*add_drag_id\(\"drag_\#\{@node.zip\}\", .*drag_handle/"
202
+ tem: "/span class='drag_handle'.*add_drag_id\(%Q\{drag_\#\{@node.zip\}\}, .*drag_handle/"
161
203
 
162
204
  draggable_on_each_with_id:
163
205
  src: "<ul do='pages in site'><li do='each'><b do='link' draggable='true'/> <r:edit/></li></ul>"
164
206
  # should not use each id
165
- tem: "/li id='<%= %Q\{list1_#\{var2.zip\}\}.*%Q\{drag_#\{var2.zip\}\}.*add_drag_id\(\"drag_#\{var2.zip\}\"/"
207
+ tem: "/li id='<%= %Q\{list1_#\{var2.zip\}\}.*%Q\{drag_#\{var2.zip\}\}.*add_drag_id\(%Q\{drag_#\{var2.zip\}\}/"
166
208
 
167
209
  drag_with_form:
168
210
  src: "<table do='pages in site'>
@@ -172,31 +214,48 @@ drag_with_form:
172
214
  <td class='edit'> <r:edit class='edit'>éditer</r:edit></td>
173
215
  </tr>
174
216
  </table>"
175
- tem: "/tr id='<%= %Q\{list1_#\{var2.zip\}\}.*<div[^>]+id='<%= %Q\{drag_#\{var2.zip\}\}.*add_drag_id\(\"drag_#\{var2.zip\}\"/"
217
+ tem: "/<span class='drag' id='<%= %Q\{drag_#\{var2.zip\}\}.*<% add_drag_id\(%Q\{drag_#\{var2.zip\}\}/"
218
+
219
+ drag_with_form_not_in_form:
220
+ src: "<table do='pages in site'>
221
+ <tr do='add'/>
222
+ <tr do='each'>
223
+ <td><r:link draggable='true'><b do='title'/></r:link></td>
224
+ <td class='edit'> <r:edit class='edit'>éditer</r:edit></td>
225
+ </tr>
226
+ </table>"
227
+ tem: "!/add_drag_id.*add_drag_id/"
228
+
229
+ drag_on_each_with_make_form:
230
+ src: "<ul do='pages in site'>
231
+ <li do='add'/>
232
+ <li do='each' draggable='true' do='link'/>
233
+ </ul>"
234
+ tem: "/add_drag_id\(%Q\{list1_#\{var2.zip\}\},/"
176
235
 
177
236
  draggable_existing_class:
178
237
  # should use 'drag_handle' class
179
238
  src: "<r:link draggable='true'><r:img class='drag_handle' mode='tiny'/> <r:title/></r:link>"
180
239
  tem: "!/span class='drag_handle'/"
181
- res: "/div class='drag' id='drag_22'><a href='.*22.*img src='/images/ext/page_tiny.png' .*class='drag_handle'/> status title/"
240
+ res: "/span class='drag' id='drag_22'><a href='.*22.*img src='/images/ext/page_tiny.png' .*class='drag_handle'/> status title/"
182
241
 
183
242
  draggable_existing_class_do:
184
243
  # should use 'drag_handle' class
185
244
  src: "<r:link draggable='drag_img'><b class='drag_img' do='img' mode='tiny'/> blah</r:link>"
186
245
  tem: "!/span class='drag_handle'|span class='drag_img'/"
187
- res: "/div class='drag' id='drag_22'><a href='.*22.*<b class='drag_img'.*img src='/images/ext/page_tiny.png'/"
246
+ res: "/span class='drag' id='drag_22'><a href='.*22.*<b class='drag_img'.*img src='/images/ext/page_tiny.png'/"
188
247
 
189
248
  draggable_in_block:
190
249
  # should use 'hooba' class
191
250
  src: "<r:block><r:link draggable='hooba'/></r:block>"
192
- tem: "/add_drag_id\(\"drag_\#\{@node.zip\}\", .*hooba/"
193
- res: "<div id='list1'><div class='drag' id='drag_22'><span class='hooba'>&nbsp;</span><a href='/oo/projects-list/Clean-Water-project/page22.html'>status title</a></div></div>"
251
+ tem: "/add_drag_id\(%Q\{drag_\#\{@node.zip\}\}, .*hooba/"
252
+ res: "<div id='list1'><span class='drag' id='drag_22'><span class='hooba'>&nbsp;</span><a href='/oo/projects-list/Clean-Water-project/page22.html'>status title</a></span></div>"
194
253
  js: "/Zena.draggable\(item, \"hooba\"\)/"
195
254
 
196
255
  draggable_with_id_set:
197
256
  # should not change original id
198
257
  src: "<h1 id='title' do='title' draggable='true'/>"
199
- tem: "/<h1 id='title'><span class='drag' id='<%= %Q\{drag_#\{@node.zip\}\} %>'><span class='drag_handle'>&nbsp;</span><% add_drag_id\(\"drag_#\{@node.zip\}/"
258
+ tem: "/<h1 id='title'><span class='drag' id='<%= %Q\{drag_#\{@node.zip\}\} %>'><span class='drag_handle'>&nbsp;</span><% add_drag_id\(%Q\{drag_#\{@node.zip\}/"
200
259
 
201
260
  unlink:
202
261
  context:
@@ -235,7 +294,7 @@ drop_add_link:
235
294
  # without the ugly inspect, this would be '#{id}' or "\#{id}"
236
295
  tem: "/drop_node_path.*\"node\[favorite_id\]\" => \"\\\\#\{id\}\"/"
237
296
  res: "<div class='drop' id='list1'>drop</div>"
238
- js: "/Droppables.add\('list1'.*/nodes/22/drop.*node%5Bfavorite_id%5D=%23%7Bid%7D"
297
+ js: "/Droppables.add\('list1'.*/nodes/22/drop.*node\[favorite_id\]=%23%7Bid%7D"
239
298
 
240
299
  drop_var_scope:
241
300
  src: "<div do='visitor.node'><div do='drop' add='favorite' change='receiver'><r:favorites>.</r:favorites></div></div>"
@@ -247,17 +306,17 @@ drop_done_remove:
247
306
 
248
307
  drop_param:
249
308
  src: "<r:drop change='params' d='foo'>params[:d] = <r:show eval='params[:d]'/></r:drop>"
250
- tem: "/<div class='drop' id='list1'><% add_drop_id\(\"list1\", :url => drop_node_path\(@node.*:change => \"params\", :d => \"foo\"/"
309
+ tem: "/<div class='drop' id='list1'><% add_drop_id\(%Q\{list1\}, :url => drop_node_path\(@node.*:change => \"params\", :d => \"foo\"/"
251
310
  res: "<div class='drop' id='list1'>params[:d] = </div>"
252
311
  js: '/Droppables.add\(.list1.*d=foo/'
253
312
 
254
313
  drop_param_in_each:
255
314
  src: "<r:pages do='each' do='drop' change='params' d='foo'><r:show eval='params[:d]'/></r:pages>"
256
- tem: "/<div class='drop' id='<%= %Q\{list1_#\{var2.zip\}\} %>'><% add_drop_id\(\"list1_#\{var2.zip\}\"/"
315
+ tem: "/<div class='drop' id='<%= %Q\{list1_#\{var2.zip\}\} %>'><% add_drop_id\(%Q\{list1_#\{var2.zip\}\}/"
257
316
 
258
317
  update_target:
259
318
  src: "UT: <div id='foo' do='block'>...</div> <r:link update='foo'/>"
260
- tem: "/UT: <div id='foo'>...</div> .*Ajax.Request.*:dom_id => \"foo\"/"
319
+ tem: "/UT: <div id='foo'>...</div> .*Ajax.Request.*:dom_id => %Q\{foo\}/"
261
320
 
262
321
  update_target_encode_params:
263
322
  context:
@@ -268,7 +327,7 @@ update_target_encode_params:
268
327
 
269
328
  include_update_target:
270
329
  src: "IUT: <r:include template='/ajax/update/target'><r:with part='foo'><r:show attr='title'/></r:with></r:include>"
271
- tem: "/IUT: UT: <div id='foo'><%= @node.prop\['title'\] %></div> <a .*zen_path.*onclick='new Ajax.Request/"
330
+ tem: "/IUT: UT: <div id='foo'><%= h @node.prop\['title'\] %></div> <a .*zen_path.*onclick='new Ajax.Request/"
272
331
 
273
332
  id_in_each_group_should_be_scoped:
274
333
  src: "<ul do='comments from nodes in site' do='group' by='discussion_id'><li do='each'><r:node do='block' do='title'/></li></ul>"
@@ -277,7 +336,7 @@ id_in_each_group_should_be_scoped:
277
336
  link_page_next:
278
337
  context:
279
338
  pak: 2
280
- src: "<div id='foo' do='block' do='nodes in site' limit='3' order='zip' paginate='pak'><r:link page='previous'/> | <r:pak/> | <r:link update='foo' page='next'/> || <r:each join=',' do='[id]'/></div>"
339
+ src: "<div id='foo' do='block' do='nodes in site' limit='3' order='zip' paginate='pak'><r:link page='previous'/> | <r:pak/> | <r:link update='foo' page='next'/></div>"
281
340
  res: "/<a href='/oo/projects-list/Clean-Water-project/page22.html\?pak=1'>1</a> \| 2 \| .*22/zafu\?dom_id=foo.*pak=3.*>3</a>/"
282
341
 
283
342
  link_page_list:
@@ -314,4 +373,26 @@ toggle_bad_rel:
314
373
  rel: bad
315
374
  src: "<ul do='pages'><li do='each' toggle='#{params[:rel]}' for='visitor.node' do='title'/></ul>"
316
375
  res: "/<ul><li class='toggle' id='list1_26'>crocodiles</li>/"
317
- js: "/list1_26.*each/"
376
+ js: "/list1_26.*each/"
377
+
378
+ js:
379
+ src: "x <r:js>alert('ho');</r:js> y"
380
+ tem: "x <% js_data << \"alert('ho');\" %> y"
381
+ res: "x y"
382
+ js: "<script type=\"text/javascript\">\n//<![CDATA[\nalert('ho');\n//]]>\n</script>"
383
+
384
+ js_dyn:
385
+ src: "x <r:js>alert('ho <r:title/>');</r:js> y"
386
+ tem: "x <% js_data << capture do %>alert('ho <%= @node.prop['title'] %>');<% end %> y"
387
+ res: "x y"
388
+ js: "<script type=\"text/javascript\">\n//<![CDATA[\nalert('ho status title');\n//]]>\n</script>"
389
+
390
+ filter_in_list:
391
+ # Should move to up node and not raise an error.
392
+ src: "<ul do='pages in site'><r:block></r:block><li do='filter' live='true'/></ul>"
393
+ tem: "/zafu_node_path\(@node\)/"
394
+ res: "/nodes/22/zafu/"
395
+
396
+ ajax:
397
+ src: "<r:ajax? do='js'>alert('ajax');</r:ajax?>"
398
+ tem: "<% if params[:s] %><% js_data << \"alert('ajax');\" %><% end %>"
@@ -9,21 +9,6 @@ default:
9
9
 
10
10
  #----------- fixed up to here
11
11
 
12
- flash_messages_both:
13
- src: "<r:flash_messages/>"
14
- tem: "/id.*messages.*notice.*flash.*notice.*error.*flash.*error/"
15
- res: "<div id='messages'></div>"
16
-
17
- flash_messages_error:
18
- src: "<r:flash_messages show='error'/>"
19
- tem: "/id.*messages.*error.*flash.*error/"
20
- res: "<div id='messages'></div>"
21
-
22
- flash_messages_notice:
23
- src: "<r:flash_messages show='notice'/>"
24
- tem: "/id.*messages.*notice.*flash.*notice/"
25
- res: "<div id='messages'></div>"
26
-
27
12
  show_author_short:
28
13
  src: "<div class='subtitle' do='show_author'><b>SI</b> - 05.12</div>"
29
14
  tem: "<div class='subtitle'><b><%= @node.version.author.initials %></b> - <%= format_date(@node.version.updated_at, :format => \"%m.%d\") %></div>"
@@ -196,34 +181,6 @@ do_ignore:
196
181
  src: "<ul do='ignore' do='children' do='each' tag='li'><r:link/></ul>"
197
182
  res: ""
198
183
 
199
- name_title:
200
- src: "title: <h1 id='lala' do='show' name='title' attr='title'>blah</h1>"
201
- res: "title: <h1 id='lala'>status title</h1>"
202
-
203
- include_with:
204
- src: "include_with: <r:include template='/basic/name/title'><h1 do='with' part='title' attr='id'/>"
205
- res: "include_with: title: <h1 id='lala'>22</h1>"
206
-
207
- include_with_empty:
208
- src: "include_with: <r:include template='/basic/name/title'><r:with part='title'/>"
209
- res: "include_with: title: "
210
-
211
- id_name:
212
- src: "name_with_name: My name is <b do='void' name='bob'>Bob</b>.<r:void id='comment'> I am happy.</r:void>"
213
- res: "name_with_name: My name is <b>Bob</b>. I am happy."
214
-
215
- include_named:
216
- src: "include_named: <r:include template='/id/name'><r:with part='bob'>John</r:with></r:include>"
217
- res: "include_named: name_with_name: My name is <b>John</b>. I am happy."
218
-
219
- # this test is a dummy used by include_context
220
- context_dummy:
221
- src: "CD: <r:pages in='site' where='title like \"s%\"' name='pages'><r:each join=', ' do='title'/></r:pages>"
222
- res: "CD: skins, status"
223
-
224
- include_context:
225
- src: "IC: <r:include template='/context/dummy'><r:with part='pages'><r:each join=' / ' do='title'/></r:with></r:include>"
226
- res: "IC: CD: skins / status"
227
184
 
228
185
  content_for_layout:
229
186
  src: "<r:content_for_layout>blah blah</r:content_for_layout>"
@@ -316,15 +273,6 @@ design_by_options:
316
273
  src: "<li do='design' skin='dark' by='vador' href='http://teti.ch'></li>"
317
274
  res: "<li><i>dark</i>, design by <a href='http://teti.ch'>vador</a></li>"
318
275
 
319
- #comments_with_params:
320
- # src: "<r:comments order='date desc'><r:each join=', ' do='[title]'/></r:comments>"
321
- # tem: "."
322
-
323
- comments_shown_if_empty_but_can_comment:
324
- src: "<r:comments><r:each do='[title]'/><r:add/></r:comments>"
325
- tem: "/if \(list1 = @node.comments\) \|\| \(@node.can_comment\? && list1=\[\]\) %>/"
326
-
327
-
328
276
 
329
277
  captcha:
330
278
  context:
@@ -7,29 +7,53 @@ default:
7
7
 
8
8
  calendar:
9
9
  context:
10
- ref_date: "2006-03-18"
11
- src: "<div do='calendar' select='notes in site'/>"
12
- res: "/<td class='sat ref'><span>18</span><ul><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>opening</a></li></ul><\/td>/"
10
+ date: "2006-03-18"
11
+ src: "<div do='calendar' attr='date' select='posts where #{cal_start} <= date and date < #{cal_end} in project'/>"
12
+ res: "/<td><p>15</p><ol><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>parc openi…</a></li></ol><\/td>.*<td class='sat ref'>18</td>/"
13
13
 
14
- calendar_default_else:
14
+ calendar_tz:
15
15
  context:
16
- # no notes here
17
- ref_date: "2008-01-30"
18
- src: "<div do='calendar'>---</div>"
19
- res: "/<td class='sun'>27<\/td>/"
16
+ date: "2006-03-18"
17
+ src: "<div do='calendar' attr='date' tz='America/New_York' select='posts where #{cal_start} <= date and date < #{cal_end} in project'/>"
18
+ res: "/<td><p>14</p><ol><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>parc openi…</a></li></ol><\/td>.*<td class='sat ref'>18</td>/"
20
19
 
21
- calendar_l_date:
20
+ calendar_with_blocks:
22
21
  context:
23
- ref_date: "2009-7-17"
24
- node: 'zena'
25
- src: "<div do='calendar' select='added_notes' date='l_date' />"
26
- res: "/<td class='ref'><span>17</span><ul><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>opening</a></li></ul></td>/"
22
+ date: "2006-03-18"
23
+ src: "<div do='calendar' attr='date' select='posts where #{cal_start} <= date and date < #{cal_end} in project'>
24
+ <h3 do='header'>
25
+ <r:link date='#{date.advance(:months =&gt; -1).strftime(\"%Y-%m-%d\", tz)}' text='PREV'/>
26
+ <r:date format='%B'/>
27
+ <r:link date='#{date.advance(:months =&gt; 1).strftime(\"%Y-%m-%d\", tz)}' text='NEXT'/>
28
+ </h3><r:cell><b do='date' format='%e.%m'/></r:cell></div>"
29
+ res: "/date=2006-02-18'>PREV.*date=2006-04-18'>NEXT.*<b>15.03</b>/"
27
30
 
28
- calendar_hours:
31
+ calendar_node_attr:
29
32
  context:
30
- ref_date: "2009-7-17"
31
- node: 'zena'
32
- # I do not like the way we do this, the 'else' thing is not helping. Maybe we need some
33
- # extra zafu tags because it' messy: we have 3 lists (days, hours, nodes) ...
34
- src: "<div do='calendar' select='added_notes' date='l_date' split_hours='12'><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]' do='each' do='title' join=', '/><r:else><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]'></div></r:else></div>"
35
- res: "/<td class='ref'>17<div class='hour_0'></div><div class='hour_12'>opening</div></td>/"
33
+ date: '2006-03-10'
34
+ src: "<div do='calendar' attr='created_at' select='nodes where #{cal_start} <= created_at and created_at < #{cal_end} in project'/>"
35
+ res: "/p>10</p>.*Keeping th…/"
36
+
37
+ calendar_bad_query:
38
+ src: "<div do='calendar' attr='date' select='posts where #{cal_start} <= starsky and hutch < #{cal_end} in project'/>"
39
+ res: "/<span class='method'>calendar</span> <span class='message'>Unknown field 'starsky'/"
40
+
41
+ calendar_bad_attr:
42
+ src: "<div do='calendar' attr='date' select='posts where #{cal_start} <= starsky and hutch < #{cal_end} in project'/>"
43
+ res: "/<span class='method'>calendar</span> <span class='message'>Unknown field 'starsky'/"
44
+
45
+ #calendar_l_date:
46
+ # context:
47
+ # ref_date: "2009-7-17"
48
+ # node: 'zena'
49
+ # src: "<div do='calendar' select='added_notes' date='l_date' />"
50
+ # res: "/<td class='ref'><span>17</span><ol><li><a href='/oo/projects-list/Clean-Water-project/post27.html'>opening</a></li></ol></td>/"
51
+ #
52
+ #calendar_hours:
53
+ # context:
54
+ # ref_date: "2009-7-17"
55
+ # node: 'zena'
56
+ # # I do not like the way we do this, the 'else' thing is not helping. Maybe we need some
57
+ # # extra zafu tags because it' messy: we have 3 lists (days, hours, nodes) ...
58
+ # src: "<div do='calendar' select='added_notes' date='l_date' split_hours='12'><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]' do='each' do='title' join=', '/><r:else><r:if test='hour eq 0' do='[current_date]' format='%d'/><div do='void' set_class='hour_[hour]'></div></r:else></div>"
59
+ # res: "/<td class='ref'>17<div class='hour_0'></div><div class='hour_12'>opening</div></td>/"
@@ -0,0 +1,53 @@
1
+ default:
2
+ context:
3
+ lang: 'en'
4
+ visitor: 'ant'
5
+ node: 'status'
6
+
7
+ #comments_with_params:
8
+ # src: "<r:comments order='date desc'><r:each join=', ' do='[title]'/></r:comments>"
9
+ # tem: "."
10
+
11
+ comments_shown_if_empty_but_can_comment:
12
+ src: "<r:comments><r:each do='[title]'/><r:add/></r:comments>"
13
+ tem: "/if \(var1 = @node.comments\) \|\| \(@node.can_comment\? && var1=\[\]\) %>/"
14
+
15
+ discussion:
16
+ src: "<r:discussion do='comments' do='title'></r:discussion>"
17
+ tem: "<% if var1 = @node.discussion %><% if var2 = var1.comments %><%= var2.first.title %><% end %><% end %>"
18
+ # no error
19
+ res: "What about rivers ?"
20
+
21
+ comments_order_desc:
22
+ context:
23
+ visitor: ant
24
+ # tz='UTC'
25
+ src: "<r:comments order='created_at desc'><r:each join=', '><r:show attr='created_at' format='%Y-%m-%d'/>:<b do='[title]'/></r:each></r:comments>"
26
+ res: "2008-05-21:<b>re: What about rivers ?</b>, 2006-12-20:<b>What about rivers ?</b>, 2006-12-20:<b>Nice site</b>"
27
+
28
+ comments_where_title:
29
+ src: "<r:comments where='title like \"%rivers%\"'><r:each join=', '><r:show attr='created_at' format='%Y-%m-%d'/>:<b do='title'/></r:each></r:comments>"
30
+ tem: '/var1 = Comment.do_find/'
31
+ res: "2006-12-20:<b>What about rivers ?</b>, 2008-05-21:<b>re: What about rivers ?</b>"
32
+
33
+ comments_no_discussion:
34
+ context:
35
+ node: letter
36
+ src: "<r:comments order='created_at desc'><r:each join=', '><r:show attr='created_at' format='%Y-%m-%d'/>:<b do='[title]'/></r:each><r:else>-- no comment yet --</r:else></r:comments>"
37
+ res: "-- no comment yet --"
38
+
39
+ comments_previous_node:
40
+ src: "<r:comments><r:each do='zazen' attr='text'/></r:comments>"
41
+ tem: "/zazen\(var2.text, :node => @node/"
42
+
43
+ comments_in_site_node:
44
+ src: "<r:comments from='nodes in site' order='created_at desc' limit='2' do='each' join=', '><r:node do='title'/>: <r:show attr='title'/></r:comments>"
45
+ res: "status title: re: What about rivers ?, status title: What about rivers ?"
46
+
47
+ author_name:
48
+ src: "<r:comments from='nodes in site' order='status desc' limit='2' do='each' join=', '><r:title/> (<r:author_name/>)</r:comments>"
49
+ res: "Nice site (Super casinos), re: What about rivers ? (simpson)"
50
+
51
+ form:
52
+ src: "<r:comments><r:add/><r:each></r:each><r:form>xxx</r:form></r:comments>"
53
+ tem: "/name='node_id' value='<%= @node.zip %>'/"
@@ -60,33 +60,33 @@ default:
60
60
  visitor: complex_admin
61
61
  site: complex
62
62
  ref_date: 2004-09-01
63
- src: "<r:emp_form_dates where='repeat_every is not null' do='each' join=', '><r:show attr='title'/>(<r:show attr='priority'/>, <r:show date='last_date' format='%Y-%m-%d'/>, <r:show date='next_date' format='%Y-%m-%d'/>)</r:emp_form_dates>"
63
+ src: "<r:emp_form_dates where='repeat_every is not null' do='each' join=', '><r:show attr='title'/>(<r:show attr='priority'/>, <r:show attr='last_date' format='%Y-%m-%d'/>, <r:show attr='next_date' format='%Y-%m-%d'/>)</r:emp_form_dates>"
64
64
  res: "secure_a_site(10, , ), winch_usage(10, , ), dangerous_transportations(10, 2004-03-15, 2006-03-15), engine(5, , ), transmit_information(5, 2002-05-05, 2003-05-05), fiber_junction(5, 2003-03-03, 2005-03-03), radio_usage(1, , )"
65
65
 
66
66
  courses_in_the_next_6_months:
67
67
  # custom_a = repetition interval
68
- src: "<r:emp_form_dates where='last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' order='last_date asc, title ASC' do='each' join=', '><r:show attr='title'/>: <r:show date='next_date' format='%Y-%m-%d'/></r:emp_form_dates>"
68
+ src: "<r:emp_form_dates where='last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' order='last_date asc, title ASC' do='each' join=', '><r:show attr='title'/>: <r:show attr='next_date' format='%Y-%m-%d'/></r:emp_form_dates>"
69
69
  res: "engine: , radio_usage: , secure_a_site: , winch_usage: , transmit_information: 2003-05-05"
70
70
 
71
71
  courses_in_the_next_6_months_do_syntax:
72
72
  context:
73
73
  ref_date: 2005-03-01
74
74
  # before 2005-06-01
75
- src: "<ol do='emp_form_dates where last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' do='group' by='priority'><li set_class='priority[priority]' do='each_group' do='each' join=', '><r:show attr='title'/>: <r:show date='next_date' format='%Y-%m-%d'/></li></ol>"
75
+ src: "<ol do='emp_form_dates where last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' do='group' by='priority'><li set_class='priority[priority]' do='each_group' do='each' join=', '><r:show attr='title'/>: <r:show attr='next_date' format='%Y-%m-%d'/></li></ol>"
76
76
  res: "<ol><li class='priority10'>secure_a_site: , winch_usage: </li><li class='priority5'>engine: , transmit_information: 2003-05-05, fiber_junction: 2005-03-03</li><li class='priority1'>radio_usage: </li></ol>"
77
77
 
78
78
  all_formations:
79
- src: "<r:formations in='site' do='each' join=', '><r:show attr='title'/>: <r:show date='event_at'/></r:formations>"
79
+ src: "<r:formations in='site' do='each' join=', '><r:show attr='title'/>: <r:show attr='event_at'/></r:formations>"
80
80
  res: "fiber2002: 2002-02-02, fiber2003: 2003-03-03, form2005: 2005-03-20, form2006: 2006-03-20, transm2001: 2001-06-15, transm2002: 2002-05-05, transm2003: 2003-03-20, transp2004: 2004-03-15, transp2006: 2006-04-21, vision2003: 2003-04-05"
81
81
 
82
82
  all_formations_with_people:
83
- src: "<r:formations in='site' do='each' join=', '><r:show attr='title'/>: <r:show date='event_at'/> (<r:formation_for find='all' do='each' join=', ' do='title'/>)</r:formations>"
83
+ src: "<r:formations in='site' do='each' join=', '><r:show attr='title'/>: <r:show attr='event_at'/> (<r:formation_for find='all' do='each' join=', ' do='title'/>)</r:formations>"
84
84
  res: "fiber2002: 2002-02-02 (mike), fiber2003: 2003-03-03 (joe, roger), form2005: 2005-03-20 (roger), form2006: 2006-03-20 (roger), transm2001: 2001-06-15 (roger), transm2002: 2002-05-05 (roger), transm2003: 2003-03-20 (joe), transp2004: 2004-03-15 (roger), transp2006: 2006-04-21 (roger), vision2003: 2003-04-05 (mike)"
85
85
 
86
86
  all_people_related_to_a_course:
87
87
  context:
88
88
  node: transmit_information
89
- src: "<r:course_emp_dates do='each' join=', '><r:show attr='title'/> (last:<r:show date='last_date'/>, next:<r:show date='next_date'/>)</r:course_emp_dates>"
89
+ src: "<r:course_emp_dates do='each' join=', '><r:show attr='title'/> (last:<r:show attr='last_date'/>, next:<r:show attr='next_date'/>)</r:course_emp_dates>"
90
90
  res: "joe (last:2003-03-20, next:2004-03-20), mike (last:, next:), roger (last:2002-05-05, next:2003-05-05)"
91
91
 
92
92
  all_people_related_to_a_course_group_by_priority:
@@ -96,7 +96,7 @@ all_people_related_to_a_course_group_by_priority:
96
96
  <ol do='course_emp_dates' where='last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' order='priority desc, last_date asc, title ASC' do='group' by='priority'>
97
97
  <li set_class='priority[priority]' do='each_group'>
98
98
  <ol>
99
- <li do='each'><r:show attr='title'/> (last:<r:show date='last_date'/>, next:<r:show date='next_date'/>)</li>
99
+ <li do='each'><r:show attr='title'/> (last:<r:show attr='last_date'/>, next:<r:show attr='next_date'/>)</li>
100
100
  </ol>
101
101
  </li>
102
102
  </ol>
@@ -118,7 +118,7 @@ all_people_related_to_a_course_in_6_month:
118
118
  context:
119
119
  node: transmit_information
120
120
  ref_date: 2003-04-04
121
- src: "<r:course_emp_dates where='last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='title'/> (last:<r:show date='last_date'/>, next:<r:show date='next_date'/>)</r:course_emp_dates>"
121
+ src: "<r:course_emp_dates where='last_date is null or (repeat_every is not null and next_date lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='title'/> (last:<r:show attr='last_date'/>, next:<r:show attr='next_date'/>)</r:course_emp_dates>"
122
122
  res: "mike (last:, next:), roger (last:2002-05-05, next:2003-05-05)"
123
123
 
124
124
  all_course_emp_date:
@@ -127,7 +127,7 @@ all_course_emp_date:
127
127
  <r:group by='priority'>
128
128
  <li do='each_group' set_class='priority[priority]'>
129
129
  <ol>
130
- <li do='each'><r:if test='min_next_date'><r:show date='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
130
+ <li do='each'><r:if test='min_next_date'><r:show attr='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
131
131
  </ol>
132
132
  </li>
133
133
  </r:group>
@@ -170,7 +170,7 @@ all_course_emp_dates_in_six_months:
170
170
  <r:group by='priority'>
171
171
  <li do='each_group' set_class='priority[priority]'>
172
172
  <ol>
173
- <li do='each'><r:if test='min_next_date'><r:show date='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
173
+ <li do='each'><r:if test='min_next_date'><r:show attr='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
174
174
  </ol>
175
175
  </li>
176
176
  </r:group>
@@ -210,7 +210,7 @@ all_course_emp_dates_in_six_months_later:
210
210
  <r:group by='priority'>
211
211
  <li do='each_group' set_class='priority[priority]'>
212
212
  <ol>
213
- <li do='each'><r:if test='min_next_date'><r:show date='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
213
+ <li do='each'><r:if test='min_next_date'><r:show attr='min_next_date' tformat='%Y-%m-%d'/><r:else>ASAP</r:else></r:if> <r:show attr='title'/> (<r:show attr='emp_count'/>)</li>
214
214
  </ol>
215
215
  </li>
216
216
  </r:group>
@@ -5,8 +5,9 @@ it_should_compile_custom_select:
5
5
  visitor: complex_admin
6
6
  site: complex
7
7
  ref_date: 2004-09-01
8
- src: "<r:emp_form_dates do='each' join=', '><r:show attr='title'/>(<r:priority/>)</r:emp_form_dates>"
9
- res: 'how to use the winch(10), secure a site(10), dangerous transportations(10), engine maintenance(5), information transmission(5), fiber junction(5), problem formulation(5), how to use the radio(1)'
8
+ src: "<r:emp_form_dates do='each' join=', '><r:show attr='title'/>(<r:priority/>)[<r:last_date format='%Y-%m'/>]</r:emp_form_dates>"
9
+ tem: '/var2.attributes\["priority"\].*\[<%= format_date\(var2.attributes\["last_date"\], :format => "%Y-%m"\) %>\]/'
10
+ res: 'how to use the winch(10)[], secure a site(10)[], dangerous transportations(10)[2004-03], engine maintenance(5)[], information transmission(5)[2002-05], fiber junction(5)[2003-03], problem formulation(5)[2006-03], how to use the radio(1)[]'
10
11
 
11
12
  it_should_group_by_custom_select:
12
13
  context:
@@ -16,4 +17,16 @@ it_should_group_by_custom_select:
16
17
  site: complex
17
18
  ref_date: 2004-09-01
18
19
  src: "<r:emp_form_dates do='group' by='priority' do='each_group' join=', '><r:show attr='priority'/></r:emp_form_dates>"
19
- res: '10, 5, 1'
20
+ res: '10, 5, 1'
21
+
22
+ it_should_secure_table:
23
+ context:
24
+ node_name: '@node'
25
+ node: roger
26
+ visitor: complex_admin
27
+ site: complex
28
+ ref_date: 2004-09-01
29
+ src: "<r:secure_tables do='count'/>"
30
+ tem: "/secure_scope\('other'\)/"
31
+ # Only show nodes from the 'complex' site
32
+ res: '41'
@@ -97,13 +97,13 @@ if_has_discussion:
97
97
  res: "status title:yes zena enhancements:no"
98
98
 
99
99
  case_ancestor:
100
- src: "<r:root><r:pages><r:each join=', '><r:case><r:when eval='ancestor?(main)'><b><r:show attr='title'/></b></r:when><r:else><r:show attr='title'/></r:else></r:case></r:each></r:pages></r:root>"
100
+ src: "<r:root><r:pages><r:each join=', '><r:case><r:when eval='is_ancestor?(main)'><b><r:show attr='title'/></b></r:when><r:else><r:show attr='title'/></r:else></r:case></r:each></r:pages></r:root>"
101
101
  res: "Collections, Nature, people, <b>projects list</b>, Skins (layout themes)"
102
102
 
103
103
  on_if_ancestor_no_class:
104
104
  old_src: "<r:root><r:pages><li do='each' on_if_node='ancestor' join=', '><r:show attr='title'/></li></r:pages></r:root>"
105
- src: "<r:root><r:pages><li do='each' on_if='ancestor?(main)' join=', '><r:show attr='title'/></li></r:pages></r:root>"
106
- tem: '/var3.ancestor\?\(@node\)/'
105
+ src: "<r:root><r:pages><li do='each' on_if='is_ancestor?(main)' join=', '><r:show attr='title'/></li></r:pages></r:root>"
106
+ tem: '/var3.is_ancestor\?\(@node\)/'
107
107
  res: "<li class=''>Collections</li>, <li class=''>Nature</li>, <li class=''>people</li>, <li class=' on'>projects list</li>, <li class=''>Skins (layout themes)</li>"
108
108
 
109
109
  multiple_class_conditions:
@@ -117,8 +117,8 @@ multiple_class_conditions_true_in_middle:
117
117
 
118
118
  # var1 = stored 'papa'
119
119
  test_ancestor_with_stored:
120
- src: "<r:parent do='parent' set_papa='this' do='pages'><div do='each' super_if='papa.ancestor?(this)' do='title'/></r:parent>"
121
- tem: "/_zpapa = var1.*\(_zpapa\.ancestor\?\(var4\)\)/"
120
+ src: "<r:parent do='parent' set_papa='this' do='pages'><div do='each' super_if='papa.is_ancestor?(this)' do='title'/></r:parent>"
121
+ tem: "/_zpapa = var1.*\(_zpapa\.is_ancestor\?\(var4\)\)/"
122
122
  res: "<div class=''>a wiki with Zena</div><div class=' super'>Clean Water project</div>"
123
123
 
124
124
  on_if_kind_of:
@@ -180,3 +180,13 @@ test_in_each:
180
180
  src: "<ul do='pages'><li do='each' on_if='this.title == \"Keeping things clean !\"' do='title'/></ul>"
181
181
  tem: "/var2.prop\['title'\]==\"Keeping things clean !\"/"
182
182
  res: "<ul><li class=''>crocodiles</li><li class=' on'>Keeping things clean !</li><li class=''>status title</li></ul>"
183
+
184
+ render_test:
185
+ src: "<r:can_write?>hello</r:can_write?>"
186
+ tem: "<% if @node.can_write? %>hello<% end %>"
187
+
188
+
189
+ do_complex_clause:
190
+ src: "<div do='log_at &gt; now'>future<r:else>past</r:else></div>"
191
+ tem: "<% if (@node.log_at ? (@node.log_at>Time.now) : nil) %><div>future</div><% elsif true %><div>past</div><% end %>"
192
+ res: "<div>past</div>"