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
@@ -0,0 +1,9 @@
1
+ default:
2
+ context:
3
+ lang: 'en'
4
+ visitor: 'ant'
5
+ node: 'cleanWater'
6
+
7
+ each_group:
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>"
@@ -53,19 +53,24 @@ show_date_foo:
53
53
  context:
54
54
  date: '2010-05-16'
55
55
  lang: fr
56
- src: "<r:show eval='main_date' format='%A %d.%m.%Y'/>"
56
+ src: "<r:show eval='date' format='%A %d.%m.%Y'/>"
57
57
  tem: "/main_date/"
58
58
  res: 'dimanche 16.05.2010'
59
59
 
60
60
  strftime:
61
- src: "<p do='log_at.strftime(\"%d-%m\")'/>"
62
- res: "<p>05-04</p>"
61
+ src: "<p do='log_at.strftime(\"%d-%m %H:%M\")'/>"
62
+ tem: "/strftime_tz/"
63
+ res: "<p>05-04 02:00</p>"
64
+
65
+ strftime_with_timezone:
66
+ src: "<p do='log_at.strftime(\"%d-%m %H:%M\", \"Asia/Jakarta\")'/>"
67
+ res: "<p>05-04 07:00</p>"
63
68
 
64
69
  date_tformat:
65
70
  context:
66
71
  node: 'people'
67
72
  lang: 'fr'
68
- src: "<r:show date='created_at' tformat='%d %B %Y'/>"
73
+ src: "<r:show attr='created_at' tformat='%d %B %Y'/>"
69
74
  tem: "<%= format_date(@node.created_at, :format => \"%d %B %Y\") %>"
70
75
  res: "10 mars 2006"
71
76
 
@@ -74,39 +79,53 @@ date_tz:
74
79
  visitor: 'ant'
75
80
  node: 'people'
76
81
  lang: 'en'
77
- src: "<r:show date='created_at' format='%H:%M'/> / <r:show date='created_at' format='%H:%M' tz='Asia/Jakarta'/>"
82
+ src: "<r:show attr='created_at' format='%H:%M'/> / <r:show attr='created_at' format='%H:%M' tz='Asia/Jakarta'/>"
78
83
  res: "01:00 / 07:00"
79
84
 
80
85
  date_tz_field:
81
86
  context:
82
87
  node: nature
83
- src: "<r:nodes do='each' join=', '><r:show attr='title'/>: <r:show date='created_at' format='%H:%M' tz='#{tz || \"Europe/Zurich\"}'/> | <r:show date='created_at' format='%H:%M' tz='UTC'/></r:nodes>"
88
+ src: "<r:nodes do='each' join=', '><r:show attr='title'/>: <r:show attr='created_at' format='%H:%M' tz='#{this.tz || \"Europe/Zurich\"}'/> | <r:show attr='created_at' format='%H:%M' tz='UTC'/></r:nodes>"
84
89
  res: "Autumn Tree: 07:00 | 00:00, Forest: 01:00 | 00:00"
85
90
 
91
+ default_tz:
92
+ context:
93
+ visitor: 'ant'
94
+ node: 'people'
95
+ lang: 'en'
96
+ src: "<r:default tz='Asia/Jakarta'><r:show attr='created_at' format='%H:%M'/> <r:tz/></r:default>"
97
+ tem: "/_ztz = TZInfo::Timezone.get.*Asia/Jakarta.*:tz => _ztz/"
98
+ res: "07:00 Asia - Jakarta"
99
+
100
+ date_date_tz:
101
+ context:
102
+ src: "<r:default tz='Asia/Jakarta'><ul do='notes where created_at.date = #{date(tz)} in site'></ul></r:default>"
103
+ tem: "/Timezone.get\(\"Asia/Jakarta\"\).*main_date\(_ztz\)/"
104
+
86
105
  date_fr:
87
106
  context:
88
107
  visitor: ant
89
108
  lang: 'fr'
90
- src: "<r:show date='created_at' format='%a'/>"
109
+ src: "<r:show attr='created_at' format='%a'/>"
91
110
  res: "ven"
92
111
 
93
112
  date_fr_lang:
94
113
  context:
95
114
  lang: 'fr'
96
- old_src: "<r:show date='created_at' format='%a' lang='en'/>"
115
+ old_src: "<r:show attr='created_at' format='%a' lang='en'/>"
97
116
  src: "<r:show attr='created_at' format='%a' lang='en'/>"
98
117
  tem: "<%= format_date(@node.created_at, :lang => \"en\", :format => \"%a\") %>"
99
118
  res: "Fri"
100
119
 
101
120
  date_context:
102
- old_src: "<r:date select='2008-03-02'><r:show date='current_date' format='%A %d.%m.%Y'/></r:date>"
121
+ old_src: "<r:date select='2008-03-02'><r:show attr='current_date' format='%A %d.%m.%Y'/></r:date>"
103
122
  src: "<r:show eval='parse_date(\"2008-03-02\")' format='%A %d.%m.%Y'/>"
104
123
  res: "Sunday 02.03.2008"
105
124
 
106
125
  date_from_params:
107
126
  context:
108
127
  year: 1975
109
- old_src: "<r:date select='[param:year]-01-01'><r:show date='current_date' format='%A %d.%m.%Y'/></r:date>"
128
+ old_src: "<r:date select='[param:year]-01-01'><r:show attr='current_date' format='%A %d.%m.%Y'/></r:date>"
110
129
  src: "<r:show eval='parse_date(\"#{params[:year]}-01-01\")' format='%A %d.%m.%Y'/>"
111
130
  tem: "<%= format_date(parse_date(\"#{params[:year]}-01-01\"), :format => \"%A %d.%m.%Y\") %>"
112
131
  res: "Wednesday 01.01.1975"
@@ -114,8 +133,8 @@ date_from_params:
114
133
  date_from_params_in_query:
115
134
  context:
116
135
  year: 2006
117
- src: "<r:main_date text='#{params[:year]}/04/03' format='%Y/%m/%d' do='show' eval='main_date' format='%Y-%m-%d'/>"
118
- tem: "/_zmaindate = \"#\{params\[:year\]\}/04/03\".to_utc\(\"%Y/%m/%d\"\) %>/"
136
+ src: "<r:void set_date='parse_date(\"#{params[:year]}/04/03\", \"%Y/%m/%d\")' do='show' eval='date' format='%Y-%m-%d'/>"
137
+ tem: "/_zdate = parse_date.*format_date/"
119
138
  res: "2006-04-03"
120
139
 
121
140
  input_date:
@@ -123,12 +142,21 @@ input_date:
123
142
  node: opening
124
143
  src: "<r:Post?><r:input type='date' name='date'/></r:Post?>"
125
144
  tem: '/date_box\(@node, "date", :value => @node.prop\[.date.\], :size => 15\)/'
126
- res: "/value='2011-01-16 01:00'/"
145
+ res: "/value='2006-03-15 01:00'/"
146
+
147
+ input_date_no_time:
148
+ context:
149
+ node: opening
150
+ src: "<r:Post?><r:input type='date' name='date' time='false'/></r:Post?>"
151
+ tem: '/:time => "false"/'
152
+ res: "/value='2006-03-15'/"
153
+ js: "/showsTime *: *false/"
127
154
 
128
155
  test_date:
129
- src: "<r:Post?><r:if test='date'></r:if></r:Post?>"
156
+ # test with 'date' tests contextual date (main_date).
157
+ src: "<r:Post?><r:if test='this.date'></r:if></r:Post?>"
130
158
  tem: "/@node.prop\['date'\]/"
131
-
159
+
132
160
  format_date_empty_string:
133
161
  tem: "<%= format_date('') %>"
134
162
  res: ""
@@ -18,7 +18,7 @@ show_title_with_opts:
18
18
  old_src: "<h1 do='title' class='s70' status='true' actions='all'>this is the title</h1>"
19
19
  old_tem: "/<h1 class='s<%= @node.version.status %>'><%= show_title\(:node=>@node\) \+ node_actions\(:node=>@node, .*:actions=>\"all\"/"
20
20
  src: "<h1 do='title' prefix='status' actions='all' live='true'>this is the title</h1>"
21
- tem: "<h1 class='s<%= @node.version.status %>'><span id='_title<%= @node.zip %>'><%= @node.prop['title'] %></span> <%= node_actions(@node, :actions => \"all\") %></h1>"
21
+ tem: "<h1 class='s<%= @node.version.status %>'><span id='_title<%= @node.zip %>'><%= h @node.prop['title'] %></span> <%= node_actions(@node, :actions => \"all\") %></h1>"
22
22
  old_res: "/<h1 class='s50'><span id='title22'.*class='actions'>/"
23
23
  res: "/<h1 class='s50'><span id='_title22'.*class='actions'>/"
24
24
 
@@ -140,13 +140,13 @@ show_width:
140
140
  show_else:
141
141
  old_src: "<r:show attr='comment' else='name'/>"
142
142
  src: "<r:show eval='origin || title'/>"
143
- tem: "<%= (@node.prop['origin'] or @node.prop['title']) %>"
143
+ tem: "<%= h (@node.prop['origin'] or @node.prop['title']) %>"
144
144
  res: "status title"
145
145
 
146
146
  show_default:
147
147
  old_src: "<r:show attr='d_foo' default='baz'/>"
148
148
  src: "<r:show eval='origin || \"baz\"'/>"
149
- tem: "<%= (@node.prop['origin'] or \"baz\") %>"
149
+ tem: "<%= h (@node.prop['origin'] or \"baz\") %>"
150
150
  res: "baz"
151
151
 
152
152
  javascripts:
@@ -264,7 +264,7 @@ admin_links_for_admin_with_list:
264
264
  visitor: lion
265
265
  src: "<ul do='admin_links' list='comments,sites'><li do='each' do='show'><a href='#'>do this</a></li></ul>"
266
266
  tem: '/if var1 = admin_links\(\{:list => "comments,sites"\}/'
267
- res: '<ul><li><a href="/comments">manage comments</a></li><li><a href="/sites">manage sites</a></li></ul>'
267
+ res: '<ul><li><a href="/comments">comments</a></li><li><a href="/sites">sites</a></li></ul>'
268
268
 
269
269
  admin_links_for_anon:
270
270
  context:
@@ -281,7 +281,7 @@ show_with_label_shortcut:
281
281
  context:
282
282
  lang: fr
283
283
  src: "<li do='show' label='t' blank='hide' attr='title'/>"
284
- tem: "<% if !@node.prop['title'].blank? %><li><label>titre</label> <span><%= @node.prop['title'] %></span></li><% end %>"
284
+ tem: "<% if !@node.prop['title'].blank? %><li><label>titre</label> <span><%= h @node.prop['title'] %></span></li><% end %>"
285
285
  res: "<li><label>titre</label> <span>Etat des travaux</span></li>"
286
286
 
287
287
  show_with_custom_label_shortcut:
@@ -291,6 +291,20 @@ show_with_custom_label_shortcut:
291
291
  tem: "/anglais/"
292
292
  res: "<li><label>anglais</label> <span>Etat des travaux</span></li>"
293
293
 
294
+ render_h_label:
295
+ context:
296
+ lang: fr
297
+ src: "<r:default label='t'><li do='show' attr='title'/></r:default>"
298
+ res: "<li><label>titre</label> <span>Etat des travaux</span></li>"
299
+
300
+ render_h_disabled:
301
+ src: "<r:default h='false'><r:show attr='title'/></r:default>"
302
+ tem: "<%= @node.prop['title'] %>"
303
+
304
+ show_h_disabled:
305
+ src: "<r:show h='false' attr='title'/>"
306
+ tem: "<%= @node.prop['title'] %>"
307
+
294
308
  show_with_custom_tlabel_shortcut:
295
309
  context:
296
310
  lang: fr
@@ -298,6 +312,11 @@ show_with_custom_tlabel_shortcut:
298
312
  tem: "/anglais/"
299
313
  res: "<li><label>anglais</label> <span>Etat des travaux</span></li>"
300
314
 
315
+ show_date_context:
316
+ src: "<b do='created_at' do='show' format='%Y'/><b do='event_at' do='show' format='%Y'/>"
317
+ # 'event_at' is a context. If nil ==> do not enter context.
318
+ res: "<b>2006</b>"
319
+
301
320
  rendering:
302
321
  src: "==<r:headers Content-Disposition='attachment; filename=special_#{title}.csv'/>=="
303
322
  tem: "==<% set_headers(\"Content-Disposition\" => \"attachment; filename=special_#{@node.prop['title']}.csv\") %>=="
@@ -307,4 +326,39 @@ each_whitespace:
307
326
  src: |
308
327
  <r:pages in='site' order='id asc' limit='3'><r:each><r:id/><r:node></r:node></r:each>
309
328
  </r:pages>.
310
- res: "12\n34\n16\n.\n"
329
+ res: "54\n12\n34\n.\n"
330
+
331
+ set_class_before_query:
332
+ # Should use previous node (not list context)
333
+ src: "<div class='foo_#{title}' do='images in site'></div>"
334
+ res: "<div class='foo_status title'></div>"
335
+
336
+ flash_messages:
337
+ src: "<r:flash_messages/>"
338
+ tem: "<%= flash_messages %>"
339
+ res: "<div id='flash_messages'></div>"
340
+
341
+ date_without_set_var:
342
+ context:
343
+ node: opening
344
+ ref_date: '2011-04-22'
345
+ src: "<r:Post?><r:date format='%e'/>,<p do='this.date' format='%e'/><p do='date' format='%e'/></r:Post?>"
346
+ res: '22,<p>15</p><p>22</p>'
347
+
348
+ date_with_set_var:
349
+ context:
350
+ node: opening
351
+ ref_date: '2011-04-22'
352
+ src: "<r:Post? set_date='parse_date(\"2011-04-03\")'><r:date format='%e'/>,<p do='this.date' format='%e'/><p do='date' format='%e'/></r:Post?>"
353
+ res: ' 3,<p>15</p><p> 3</p>'
354
+
355
+ short_path:
356
+ src: "<r:short_path do='join(\" / \")'/>"
357
+ res: ".. / Clean Water project / status title"
358
+
359
+ show_param:
360
+ context:
361
+ t: 'hello'
362
+ src: "<r:show param='t'/>"
363
+ tem: "<%= h params[:t] %>"
364
+ res: "hello"
@@ -36,7 +36,7 @@ show_var:
36
36
  tem: "/unknown method 'boo\(\)' for Zena::ZafuCompiler/"
37
37
 
38
38
  show_bad_sprintf:
39
- src: "<p do='show' date='updated_at' format='%.2f %i hop'/>"
39
+ src: "<p do='show' attr='updated_at' format='%.2f %i hop'/>"
40
40
  res: "<p>.2f i hop</p>"
41
41
 
42
42
  division_by_zero_in_eval:
@@ -96,4 +96,8 @@ datebox_on_vclass:
96
96
 
97
97
  bad_iconv:
98
98
  src: "<r:iconv to='foobar'>écrit</r:iconv>"
99
- tem: "/invalid encoding \"foobar\"/"
99
+ tem: "/invalid encoding \"foobar\"/"
100
+
101
+ add_bad_klass:
102
+ src: "<ol do='pages'><li do='each' do='link'/><li do='add' klass='page'/></ol>"
103
+ res: "!/backtrace/"
@@ -45,15 +45,19 @@ translate_id_to_zip:
45
45
  select_class_existing_node:
46
46
  context:
47
47
  node: 'letter'
48
- src: "<r:form><select name='klass' root_class='Note' selected='Post'/></r:form>"
48
+ src: "<r:form><r:select name='klass' root_class='Note' selected='Post'/></r:form>"
49
49
  res: "/<select name=.node\[klass\].><option value=\"Note\">Note<\/option>\n<option value=\"Letter\" selected=\"selected\">  Letter<\/option>\n<option value=\"Post\">  Post<\/option><\/select>/"
50
50
 
51
51
  select_class_new_node:
52
- src: "<r:pages><r:each/><r:add/><r:form><select name='klass' root_class='Note' selected='Post'/></r:form>"
52
+ src: "<r:pages><r:each/><r:add/><r:form><r:select name='klass' root_class='Note' selected='Post'/></r:form>"
53
53
  res: "/<select.*name=.node\[klass\].*Note.*Letter.*Post. selected=.selected./"
54
54
 
55
+ select_class_kpath:
56
+ src: "<r:select param='k' root_class='Note' attr='kpath'/>"
57
+ res: "/<select.*name=.k.*NN.*Note.*NNL.*Letter.*NNP.*Post/"
58
+
55
59
  select_nodes:
56
- src: "<r:form><select nodes='images in site' name='foo'></select></r:form>"
60
+ src: "<r:form><r:select nodes='images in site' name='foo'></select></r:form>"
57
61
  res: "/name='node\[foo\]'><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Autumn Tree</option>\n<option value=\"30\">bird</option>/"
58
62
 
59
63
  do_not_set_parent_id_if_form_contains_parent_id:
@@ -61,7 +65,7 @@ do_not_set_parent_id_if_form_contains_parent_id:
61
65
  res: "!/node\[parent_id\].\s+value/"
62
66
 
63
67
  select_nodes_selected:
64
- src: "<r:form><select name='parent_id' nodes='projects in site'/></r:form>"
68
+ src: "<r:form><r:select name='parent_id' nodes='projects in site'/></r:form>"
65
69
  res: "/option\s* value=.21.\s* selected=.selected.>Clean Water/"
66
70
 
67
71
  select_nodes_in_ajax:
@@ -81,6 +85,16 @@ select_values_tshow:
81
85
  src: "<r:select name='origin' values='1,2,3' tshow='en,fr,de'/>"
82
86
  res: "/option value=.1.>english.*option value=.2.>french/"
83
87
 
88
+ select_prop:
89
+ # Refactor select to use collection_select.
90
+ src: "<r:select name='origin' values='1,2,3' tshow='en,fr,de'/>"
91
+ tem: "/@node.prop\['origin'\].to_s/"
92
+
93
+ select_l_status:
94
+ # Refactor select to use collection_select.
95
+ src: "<r:select name='l_status' values='1,2,3' tshow='en,fr,de'/>"
96
+ tem: "/@node.l_status.to_s/"
97
+
84
98
  form_publish:
85
99
  src: "<r:form publish='true'><r:select name='origin' values='bar,baz'/></r:form>"
86
100
  res: "/div.*name=.node\[v_status\]. value=.50.\/>.*<\/div>/"
@@ -163,7 +177,7 @@ textarea_with_blocks:
163
177
  context:
164
178
  node: 'ant'
165
179
  src: "<r:Contact? do='textarea' name='first_name'>Sir <r:show attr='first_name'/></r:Contact?>"
166
- tem: "/<textarea name='node\[first_name\]'>Sir <%= @node.prop\['first_name'\] %></textarea>/"
180
+ tem: "/<textarea name='node\[first_name\]'>Sir <%= h @node.prop\['first_name'\] %></textarea>/"
167
181
  res: "<textarea name='node[first_name]'>Sir Solenopsis</textarea>"
168
182
 
169
183
  input_new:
@@ -211,6 +225,31 @@ label_on_select:
211
225
  src: "<r:select label='t' name='title' values='1,2'/>"
212
226
  res: "/<label>titre</label> <span><select name='node\[title\]'/"
213
227
 
228
+ passiv_form:
229
+ # Should not transform 'form' or 'input' into 'r:form' or 'r:input'
230
+ src: "<form>xxx<input name='x' id='y' type='text'/> yyy<input name='x' id='y' type='text' value='#{id}'/></form>"
231
+ tem: "<form>xxx<input name='x' id='y' type='text'/> yyy<input name='x' id='y' type='text' value='<%= @node.zip %>'/></form>"
232
+
233
+ passiv_input_in_form:
234
+ # Should not transform 'form' or 'input' into 'r:form' or 'r:input'
235
+ src: "<r:form>xxx<input name='x' id='y' type='text'/> yyy<input name='x' id='y' type='text' value='#{id}'/></r:form>"
236
+ tem: "/yyy<input name='x' id='y' type='text' value='<%= @node.zip %>'/>/"
237
+
214
238
  param_on_select:
215
239
  src: "<r:select param='q[contact.status]' values='0,-5,-10' tshow='active, being registered, inactive'/>"
216
- res: "<select name='q[contact.status]'><option value=\"0\">active</option>\n<option value=\"-5\">being registered</option>\n<option value=\"-10\">inactive</option></select>"
240
+ res: "<select name='q[contact.status]'><option value=\"0\">active</option>\n<option value=\"-5\">being registered</option>\n<option value=\"-10\">inactive</option></select>"
241
+
242
+ crop:
243
+ context:
244
+ node: 'bird_jpg'
245
+ src: "<r:Image? do='crop'/>"
246
+ res: "/node\[crop\]\[h\]/"
247
+ js: '/Zena.Div_editor\("imglist1"/'
248
+
249
+ hidden_fields_in_form_tag:
250
+ src: "<r:form foo='bar'></r:form>"
251
+ tem: "/<input type='hidden' name='foo' value='bar'/>/"
252
+
253
+ hidden_fields_in_form_tag_dynamic:
254
+ src: "<r:form node[log]='#{title}'></r:form>"
255
+ tem: "/<input type='hidden' name='node\[log\]' value='<%= \"#\{@node.prop\['title'\]\}\" %>/"
@@ -125,6 +125,13 @@ dictionary_fr:
125
125
  tem: "<% _zdict = load_dictionary(828931430) %>foo: j'aime les mots"
126
126
  res: "foo: j'aime les mots"
127
127
 
128
+ dictionary_missing:
129
+ context:
130
+ lang: 'fr'
131
+ src: "<r:load dictionary='barbaz' missing='ignore'><r:trans>foo</r:trans>: <r:t>I love</r:t> <r:trans>words</r:trans></r:load>"
132
+ tem: "foo: I love words"
133
+ res: "foo: I love words"
134
+
128
135
  dynamic_dictionary_eval_fr:
129
136
  context:
130
137
  lang: 'fr'
@@ -157,7 +164,7 @@ dictionary_de:
157
164
  res: "foo: Ich liebe Wörter"
158
165
 
159
166
  dictionary_tformat:
160
- src: "<r:load dictionary='/Default skin/translations'><r:show date='created_at' tformat='date_format'/></r:load>"
167
+ src: "<r:load dictionary='/Default skin/translations'><r:show attr='created_at' tformat='date_format'/></r:load>"
161
168
  tem: "<% _zdict = load_dictionary(828931430) %><%= format_date(@node.created_at, :format => \"[%d.%m]\") %>"
162
169
  res: "[10.03]"
163
170
 
@@ -0,0 +1,38 @@
1
+ default:
2
+ context:
3
+ lang: 'en'
4
+ visitor: 'ant'
5
+ node: 'status'
6
+
7
+ include_with:
8
+ src: "include_with: <r:include template='/basic/name/title'><h1 do='with' part='title' attr='id'/>"
9
+ res: "include_with: title: <h1 id='lala'>22</h1>"
10
+
11
+ include_with_empty:
12
+ src: "include_with: <r:include template='/meta/name/title'><r:with part='title'/>"
13
+ res: "include_with: title: "
14
+
15
+ name_title:
16
+ src: "title: <h1 id='lala' do='show' name='title' attr='title'>blah</h1>"
17
+ res: "title: <h1 id='lala'>status title</h1>"
18
+
19
+ id_name:
20
+ src: "name_with_name: My name is <b do='void' name='bob'>Bob</b>.<r:void id='comment'> I am happy.</r:void>"
21
+ res: "name_with_name: My name is <b>Bob</b>. I am happy."
22
+
23
+ include_named:
24
+ src: "include_named: <r:include template='/meta/id/name'><r:with part='bob'>John</r:with></r:include>"
25
+ res: "include_named: name_with_name: My name is <b>John</b>. I am happy."
26
+
27
+ include_part:
28
+ src: "include_part: <r:include template='/meta/id/name' part='bob'/>"
29
+ tem: "include_part: <b>Bob</b>"
30
+
31
+ # this test is a dummy used by include_context
32
+ context_dummy:
33
+ src: "CD: <r:pages in='site' where='title like \"s%\"' name='pages'><r:each join=', ' do='title'/></r:pages>"
34
+ res: "CD: Skins (layout themes), status title"
35
+
36
+ include_context:
37
+ src: "IC: <r:include template='/meta/context/dummy'><r:with part='pages'><r:each join=' / ' do='title'/></r:with></r:include>"
38
+ res: "IC: CD: Skins (layout themes) / status title"
@@ -133,14 +133,20 @@ paginate_count:
133
133
  src: "<r:pages in='site' paginate='p' do='count'/>"
134
134
  # should properly pass the query to sub-contexts.
135
135
  tem: '/<%= _znodes %>/'
136
- res: "18"
136
+ res: "19"
137
+
138
+ count:
139
+ src: "<r:pages in='site' do='count'/>"
140
+ # should detect 'count' method and count nodes without pagination.
141
+ tem: '/<%= _znodes %>/'
142
+ res: "19"
137
143
 
138
144
  paginate_page_name:
139
145
  context:
140
146
  p: 5
141
147
  src: "<r:pages in='site' limit='3' paginate='p' do='link' page='list' page_count='4' do='each'><r:page_name/>(<r:this/>)</r:pages>"
142
148
  # should define page_name
143
- res: "…(3) 4(4) 5 6(6)"
149
+ res: "…(4) 5 6(6) 7(7)"
144
150
  # ============= Dynamic query ========
145
151
 
146
152
  query:
@@ -202,6 +208,39 @@ query_can_be_nil_bad_argument_type:
202
208
  tem: '/params\[:filter\] \|\| \"pages in site\"/'
203
209
  res: ''
204
210
 
205
- query_truc:
211
+ query_count:
206
212
  tem: '<%= query("Page", "@node", "pages in site", :type => :count) %>'
207
- res: '18'
213
+ res: '19'
214
+
215
+ simple_select:
216
+ src: "<div do='nodes select title as ti' find='first' do='ti'/>"
217
+ tem: '/<%= var1.attributes\["ti"\] %>/'
218
+ res: "<div>crocodiles</div>"
219
+
220
+ select_in_from:
221
+ src: "<div do='images select title as it from projects select title as pt in site' do='each' join=', '><r:pt/>: <r:it/></div>"
222
+ tem: '/<%= var2.attributes\["pt"\] %>: <%= var2.attributes\["it"\] %>/'
223
+ res: "<div>a wiki with Zena: bird, a wiki with Zena: flower, Clean Water project: it's a lake</div>"
224
+
225
+ select_group:
226
+ src: "<div do='images select title as it from projects select title as pt in site' do='group' by='pt' do='each_group' join=' / '><r:pt/>: <r:each join=', ' do='it'/></div>"
227
+ res: "<div>a wiki with Zena: bird, flower / Clean Water project: it's a lake</div>"
228
+
229
+ select_group_count:
230
+ src: "<div do='images select id.count as img_count from projects select id as pid, title as pt in site group by pid' do='each' join=', '><r:pt/>: <r:img_count/></div>"
231
+ res: "<div>a wiki with Zena: 2, Clean Water project: 1</div>"
232
+
233
+ select_group_count_having:
234
+ src: "<div do='images select id.count as img_count from projects select id as pid, title as pt in site group by pid having img_count >= 2' do='each' join=', '><r:pt/>: <r:img_count/></div>"
235
+ res: "<div>a wiki with Zena: 2</div>"
236
+
237
+ core_context:
238
+ # Ensure that :project rubyless method uses enrollable.
239
+ src: "<r:project do='origin || title'/>"
240
+ tem: "/ar1.prop\['origin'\] or var1.prop\['title'\]/"
241
+
242
+ query_errors:
243
+ context:
244
+ c: 'badaboum'
245
+ src: "<r:query default='nodes' select='nodes in #{params[:c]}'><r:elsif test='query_errors' do='query_errors'/></r:query>"
246
+ res: "<span class='query'>nodes in badaboum</span> <span class='error'>Invalid scope 'badaboum'.</span>"
@@ -79,7 +79,7 @@ pages_random:
79
79
  context:
80
80
  node: 'cleanWater'
81
81
  src: "<r:pages limit='3' order='random'><r:each join=', '><r:show attr='title'/></r:each></r:pages>"
82
- tem: "/ORDER BY RAND/"
82
+ tem: "/ORDER BY (RAND|random)/"
83
83
 
84
84
  nodes_in_project:
85
85
  src: "<r:nodes in='project' limit='2'><r:each join=', '><r:show attr='title'/></r:each></r:nodes>"
@@ -110,11 +110,11 @@ author:
110
110
 
111
111
  public_readable_link:
112
112
  src: "<r:show attr='set_tag_ids'/>"
113
- tem: '<%= @node.rel["set_tag"].try(:other_zips) %>'
113
+ tem: '<%= h @node.rel["set_tag"].try(:other_zips) %>'
114
114
 
115
115
  public_readable_link_for:
116
116
  src: "<r:show attr='hot_for_ids'/>"
117
- tem: '<%= @node.rel["hot_for"].try(:other_zips) %>'
117
+ tem: '<%= h @node.rel["hot_for"].try(:other_zips) %>'
118
118
  res: '21'
119
119
 
120
120
  public_readable_link_id:
@@ -181,8 +181,14 @@ children_else:
181
181
  hot_else:
182
182
  context:
183
183
  class: Project
184
- src: "<r:hot else='project'><r:show attr='title'/></r:hot>"
185
- res: "Clean Water project"
184
+ src: "<div do='hot' else='project'><r:show attr='title'/></div>"
185
+ res: "<div>Clean Water project</div>"
186
+
187
+ hot_else_query:
188
+ context:
189
+ class: Project
190
+ src: "<div do='hot' else='node where title like \"%wiki%\" in site'><r:show attr='title'/></div>"
191
+ res: "<div>a wiki with Zena</div>"
186
192
 
187
193
  updated_today:
188
194
  # date set in ZafuCompilerTest
@@ -315,6 +321,11 @@ visitor_node:
315
321
  src: "<r:visitor_node><b do='title'/></r:visitor_node>"
316
322
  res: "<b>Mr nobody</b>"
317
323
 
324
+ relation_or_other:
325
+ src: "<ul do='posts' in='project' or='references' order='log_at desc' limit='8'>"
326
+ # should build a valid SQLiss query
327
+ tem: "/\) OR \(.*\)\) GROUP BY nodes.id ORDER BY nodes.log_at DESC LIMIT 8/"
328
+
318
329
  relation_in_site:
319
330
  src: "<r:tagged in='site' limit='10' do='each' join=',' do='title'/>"
320
331
  res: "Clean Water project,parc opening"
@@ -393,36 +404,10 @@ group_by_parent_sort:
393
404
  res: "<b>a wiki with Zena</b>: bird,flower<b>Clean Water project</b>: it's a lake"
394
405
 
395
406
  nodes_in_site_group_by_year:
396
- old_src: "<r:nodes in='site' group='log_at:year' order='log_at:year asc, title ASC' do='each' join=', '><r:show date='log_at' format='%Y'/></r:nodes>"
397
- src: "<r:nodes in='site' group='log_at.year' order='log_at.year asc, title ASC' do='each' join=', '><r:show date='log_at' format='%Y'/></r:nodes>"
407
+ old_src: "<r:nodes in='site' group='log_at:year' order='log_at:year asc, title ASC' do='each' join=', '><r:show attr='log_at' format='%Y'/></r:nodes>"
408
+ src: "<r:nodes in='site' group='log_at.year' order='log_at.year asc, title ASC' do='each' join=', '><r:show attr='log_at' format='%Y'/></r:nodes>"
398
409
  res: ", 2006, 2007"
399
410
 
400
- comments_order_desc:
401
- context:
402
- visitor: ant
403
- # tz='UTC'
404
- src: "<r:comments order='created_at desc'><r:each join=', '><r:show date='created_at' format='%Y-%m-%d'/>:<b do='[title]'/></r:each></r:comments>"
405
- 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>"
406
-
407
- comments_where_title:
408
- src: "<r:comments where='title like \"%rivers%\"'><r:each join=', '><r:show date='created_at' format='%Y-%m-%d'/>:<b do='title'/></r:each></r:comments>"
409
- tem: '/var1 = Comment.do_find/'
410
- res: "2006-12-20:<b>What about rivers ?</b>, 2008-05-21:<b>re: What about rivers ?</b>"
411
-
412
- comments_no_discussion:
413
- context:
414
- node: letter
415
- src: "<r:comments order='created_at desc'><r:each join=', '><r:show date='created_at' format='%Y-%m-%d'/>:<b do='[title]'/></r:each><r:else>-- no comment yet --</r:else></r:comments>"
416
- res: "-- no comment yet --"
417
-
418
- comments_previous_node:
419
- src: "<r:comments><r:each do='zazen' attr='text'/></r:comments>"
420
- tem: "/zazen\(var2.text, :node => @node/"
421
-
422
- comments_in_site_node:
423
- 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>"
424
- res: "status title: re: What about rivers ?, status title: What about rivers ?"
425
-
426
411
  find_by_zip:
427
412
  src: "<div do='find(30)' do='img'/>"
428
413
  res: '/image30_std.jpg/'
@@ -461,3 +446,11 @@ count:
461
446
  src: "<p do='nodes in site order by id' find='count'/>"
462
447
  tem: "<p><%= Node.do_find(:count, %Q{SELECT COUNT(*) FROM nodes WHERE #{secure_scope('nodes')}}) %></p>"
463
448
  res: "<p>42</p>"
449
+
450
+ query_in_array:
451
+ src: "<div do='posts' do='find(\"posts in site\")'/>"
452
+ tem: "/Node\.do_find.*Node\.do_find"
453
+
454
+ query_in_array_without_find:
455
+ src: "<div do='posts' do='posts in site'/>"
456
+ tem: "/Node\.do_find.*Node\.do_find"
@@ -77,3 +77,13 @@ ancestors_on_root:
77
77
  node: 'zena'
78
78
  src: "<ul id='path' do='ancestors'><li do='each' do='link'/></ul>"
79
79
  res: ''
80
+
81
+ prop_in_list_context:
82
+ src: "<div do='nodes in site'><r:title/></div>"
83
+ tem: "/var1.first.prop\['title'\]/"
84
+ res: '<div>a wiki with Zena</div>'
85
+
86
+ role_existing_class_name:
87
+ # Should understand 'Comment' as a Role.
88
+ src: "<r:Comment?>xx</r:Comment?>"
89
+ tem: "/<% if @node.has_role\?\(\d+\) %>xx<% end %>/"
@@ -91,4 +91,24 @@ map_on_can_be_nil:
91
91
  node: 'cleanWater'
92
92
  eval: "Contact.relations.map(:name).join('-')"
93
93
  tem: "/VirtualClass\[\"Contact\"\] \? VirtualClass\[\"Contact\"\].all_relations.map\(&:other_role\).compact.join\(\"-\"\)/"
94
- res: "/collaborator_for-favorite-favorite_for/"
94
+ res: "/collaborator_for-favorite-favorite_for/"
95
+
96
+ min:
97
+ context:
98
+ h: 10
99
+ w: 0.1
100
+ src: "<r:show format='%.2f CHF' eval='params[:h].to_f * min(0.25, params[:w].to_f)'/>"
101
+ res: "1.00 CHF"
102
+
103
+ max:
104
+ context:
105
+ h: 10
106
+ w: 0.1
107
+ src: "<r:show format='%.2f CHF' eval='params[:h].to_f * max(0.25, 10 * params[:w].to_f)'/>"
108
+ res: "10.00 CHF"
109
+
110
+ time_advance:
111
+ context:
112
+ date: '2011-02-03'
113
+ src: "<b do='date.advance(:months =&gt; 1).strftime(\"%Y-%m-%d\")'/>"
114
+ res: "<b>2011-03-03</b>"