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
@@ -26,18 +26,18 @@ This filter updates the "distant filter block test"
26
26
  </div>
27
27
 
28
28
  <h3>publish = true</h3>
29
- <r:zazen attr='d_some_attr' edit='true' publish='true'/>
29
+ <r:zazen attr='origin' edit='true' publish='true'/>
30
30
 
31
31
  <h3>publish = force</h3>
32
- <r:zazen attr='d_some_attr' edit='true' publish='force'/>
32
+ <r:zazen attr='origin' edit='true' publish='force'/>
33
33
 
34
34
  <h3>pagination test</h3>
35
35
  (no ajax)
36
36
  <r:nodes in='site' order='zip' limit='8' paginate='p'>
37
- <p><b do='[p_nodes]'/> nodes</p>
37
+ <p><b do='page_count'/> nodes</p>
38
38
  <p>
39
39
  <r:link mode='test' page='previous' do='t'>previous</r:link>
40
- <r:show var='p'/>/<r:show var='p_count'/>
40
+ <r:p/>/<r:page_count/>
41
41
  || <r:link page='list' mode='test'/> ||
42
42
  <r:link mode='test' page='next' do='t'>next</r:link>
43
43
  </p>
@@ -48,10 +48,10 @@ This filter updates the "distant filter block test"
48
48
 
49
49
  (ajax)
50
50
  <div id='pagir' do='block' do='nodes' in='site' order='zip' limit='8' paginate='p'>
51
- <p><b do='[p_nodes]'/> nodes</p>
51
+ <p><b do='page_count'/> nodes</p>
52
52
  <p>
53
53
  <r:link mode='test' update='pagir' page='previous' do='t'>previous</r:link>
54
- <r:show var='p'/>/<r:show var='p_count'/>
54
+ <r:p/>/<r:page_count/>
55
55
  || <r:link page='list' update='pagir'/> ||
56
56
  <r:link mode='test' update='pagir' page='next' do='t'>next</r:link>
57
57
  </p>
@@ -177,19 +177,20 @@ This filter updates the "distant filter block test"
177
177
  .orange { background:orange;}
178
178
  .green { background:green;}
179
179
  </style>
180
- <div id='swap' class='orange' do='block' green_if='custom_a eq 100'>
181
- <span do='swap' states=',100' attr='custom_a' publish='true'><r:if test='custom_a eq 100'><r:t>done</r:t><r:else do='t'>open</r:else></r:if></span> custom_a: <b do='[custom_a]'/>
180
+ <div id='swap' class='orange' do='block' green_if='weight == 100'>
181
+ <span do='swap' states=',100' attr='weight' publish='true'><r:if test='weight == 100'><r:t>done</r:t><r:else do='t'>open</r:else></r:if></span> weight: <b do='weight'/>
182
182
  </div>
183
183
 
184
- <h2>drag & drop</h2>
184
+ <h2>drag &amp; drop</h2>
185
185
 
186
186
  <r:images in='site' do='each' draggable='true' do='img' mode='tiny'/>
187
187
 
188
188
  <h3>drop set relation</h3>
189
189
 
190
190
  <ul do='tags in site'>
191
+ <!-- drop in each -->
191
192
  <li style='border:1px solid #400; min_width:100px; min_height:100px;' do='each' do='drop' set='set_tag'>
192
- <b do='[title]'/>
193
+ <b do='title'/>
193
194
  <ul do='context' select='tagged'><li do='each' do='unlink' do='img' mode='tiny'/></ul>
194
195
  </li>
195
196
  </ul>
@@ -197,18 +198,18 @@ This filter updates the "distant filter block test"
197
198
  <h3>drop set attributes</h3>
198
199
 
199
200
  <ul do='projects in site'>
200
- <li style='border:1px solid #400; min_width:100px; min_height:100px;' do='each'><r:drop d_foo='I am an icon for [title]' icon_for_id='[id]'><b do='title' actions='all'/><r:icon where='1'><r:unlink do='img' mode='pv'/> <r:show attr='d_foo'/> </r:icon></r:drop>
201
+ <li style='border:1px solid #400; min_width:100px; min_height:100px;' do='each'><r:drop origin='I am an icon for #{title}' icon_for_id='#{id}'><b do='title' actions='all'/><r:icon where='1'><r:unlink do='img' mode='pv'/> <r:origin/> </r:icon></r:drop>
201
202
  </li>
202
203
  </ul>
203
204
 
204
205
  <h3>drop reload with param (comment on receiving)</h3>
205
206
 
206
- <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' d='[id]' do='if' test='param:d'>
207
- <r:node where='id eq param:d' in='site'>
207
+ <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' params[d]='\#{id}' do='if' test='params[:d]'>
208
+ <r:node where='id == #{params[:d]}' in='site'>
208
209
  Change icon to <r:img mode='tiny'/> ?
209
210
  <r:main store='icon' do='form'>
210
- <r:input type='hidden' name='icon_id' set_value='[icon.id]'/>
211
- <r:input type='hidden' name='m_title' set_value='icon changed to [icon.name]'/>
211
+ <r:input type='hidden' name='icon_id' value='#{icon.id}'/>
212
+ <r:input type='hidden' name='m_title' value='icon changed to #{icon.title}'/>
212
213
  <r:textarea name='m_text'/>
213
214
  <input type='submit'/>
214
215
  </r:main>
@@ -217,8 +218,8 @@ This filter updates the "distant filter block test"
217
218
  <r:icon do='img' mode='pv'/>
218
219
  please drop a node to change the icon
219
220
  <ul do='comments'>
220
- <li do='each'><b do='[title]'/> <b do='[author_name]'/>
221
- <div do='{text}'/>
221
+ <li do='each'><b do='title'/> <b do='author.title'/>
222
+ <div do='zazen' attr='text'/>
222
223
  </li>
223
224
  </ul></r:else>
224
225
  </div>
@@ -229,12 +230,12 @@ This filter updates the "distant filter block test"
229
230
 
230
231
  <r:images in='site' do='each' draggable='true' do='img' mode='tiny'/>
231
232
 
232
- <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' d='[id]' do='if' test='param:d'>
233
- <r:node where='id eq param:d' in='site'>
233
+ <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' d='\#{id}' do='if' test='params[:d]'>
234
+ <r:node where='id = #{params[:d]}' in='site'>
234
235
  Change icon to <r:img mode='tiny'/> ?
235
- <r:form t_id='[main.id]'>
236
- <r:input type='hidden' name='icon_for_id' set_value='[main.id]'/>
237
- <r:input type='hidden' name='m_title' set_value='icon for [main.name]'/>
236
+ <r:form t_id='#{main.id}'>
237
+ <r:input type='hidden' name='icon_for_id' value='#{main.id}'/>
238
+ <r:input type='hidden' name='m_title' value='icon for #{main.title}'/>
238
239
  <r:textarea name='m_text'/>
239
240
  <input type='submit'/>
240
241
  </r:form>
@@ -243,8 +244,8 @@ This filter updates the "distant filter block test"
243
244
  please drop a node to change the icon
244
245
  <r:icon><r:img mode='pv'/>
245
246
  <ul do='comments'>
246
- <li do='each'><b do='[title]'/> <b do='[author_name]'/>
247
- <div do='{text}'/>
247
+ <li do='each'><b do='title'/> <b do='author.title'/>
248
+ <div do='zazen' attr='text'/>
248
249
  </li>
249
250
  </ul></r:icon></r:else>
250
251
  </div>
@@ -265,22 +266,22 @@ This filter updates the "distant filter block test"
265
266
 
266
267
  <hr/>
267
268
 
268
- <h2>notes & comments</h2>
269
+ <h2>notes &amp; comments</h2>
269
270
 
270
- <div id='notes' do='notes' in='project' limit='10' order='log_at DESC'>
271
+ <div id='notes' do='posts' in='project' limit='10' order='date desc'>
271
272
  <ul class='note_list'>
272
273
  <li do='add' after='self'/>
273
274
  <li class='inline_form' do='form'>
274
275
  <form>
275
276
  <p class='node_title'><input type='text' name='title' size='25'/></p>
276
277
  <p class='node_klass'> <r:select name='klass' root_class='Note' selected='Post'/></p>
277
- <p class='node_log_at'> <input type='date_box' name='log_at'/> </p>
278
+ <p class='node_date'> <input type='date_box' name='date'/> </p>
278
279
  <p class='validate'> <input type="submit" value='validate' do='void' tset_value='validate'/></p>
279
280
  </form>
280
281
  </li>
281
282
  <li class='note' do='each'>
282
283
  <div class='header'>
283
- <p class='log_at' do='show' date='log_at' tformat='full_date'>04.10</p>
284
+ <p class='date' do='show' attr='date' tformat='full_date'>04.10</p>
284
285
  <h2 class='title' do='title' actions='all'/>
285
286
  <div class='summary' do ='summary'/>
286
287
  </div>
@@ -1,4 +1,15 @@
1
1
  translations:
2
2
  I love: "Ich liebe"
3
3
  words: Wörter
4
- date_format: '[%d.%m]'
4
+ date_format: '[%d.%m]'
5
+ # admin
6
+ add_object: "<img src='/images/add.png' title='add a new object'/> add object"
7
+ upload_document: "<img src='/images/add.png' title='upload a new document'/> upload document"
8
+ view_live: "view live <img src='/images/bullet_go.png'/>"
9
+ page: page
10
+ records: records
11
+ root_node: root node
12
+ not_found: not found
13
+ crop: crop
14
+ no_parent: no parent
15
+ admin_interface: admin interface
@@ -6,4 +6,15 @@ translations:
6
6
  'status title': statut
7
7
  lang_en: anglais
8
8
  mean: "<%= 5 + 8 %>"
9
- mean_m: "<"
9
+ mean_m: "<"
10
+ # admin
11
+ add_object: "<img src='/images/add.png' title='add a new object'/> add object"
12
+ upload_document: "<img src='/images/add.png' title='upload a new document'/> upload document"
13
+ view_live: "view live <img src='/images/bullet_go.png'/>"
14
+ page: page
15
+ records: enregistrements
16
+ root_node: racine
17
+ not_found: sans
18
+ crop: rogner
19
+ no_parent: pas de parent
20
+ admin_interface: interface admin
@@ -12,6 +12,15 @@ class CommentsControllerTest < Zena::Controller::TestCase
12
12
  assert !comment.new_record?
13
13
  end
14
14
 
15
+ def test_create_bad_captcha
16
+ login(:anon)
17
+ post 'create', 'node_id'=>nodes_zip(:status), 'comment'=>{'title'=>'blowe', 'text' => 'I do not know..'}
18
+ assert_response :redirect
19
+ assert_redirected_to zen_path(nodes(:status))
20
+ comment = assigns['comment']
21
+ assert comment.new_record?
22
+ end
23
+
15
24
  def test_update
16
25
  login(:tiger)
17
26
  put 'update', 'id'=>comments_id(:tiger_says_inside), 'comment'=>{'title'=>'hahaha', 'text' => 'new text'}
@@ -90,7 +90,7 @@ class IformatsControllerTest < Zena::Controller::TestCase
90
90
  assert_response :success
91
91
  assert_template 'index'
92
92
  iformats = assigns['iformats']
93
- assert_equal 11, iformats.size
93
+ assert_equal 12, iformats.size
94
94
  end
95
95
 
96
96
  def test_show
@@ -79,6 +79,19 @@ class NodesControllerTest < Zena::Controller::TestCase
79
79
  get_subject
80
80
  assert_response :success
81
81
  end
82
+
83
+ context 'with admin mode' do
84
+ subject do
85
+ {:action => 'show', :controller => 'nodes', :path => ["page#{nodes_zip(:projects)}_admin.html"], :prefix => 'en'}
86
+ end
87
+
88
+ should 'render not found' do
89
+ # Stupid tests. Raises ActionView::TemplateError during testing and
90
+ # ActiveRecord::RecordNotFound in production.
91
+ assert_raise(ActionView::TemplateError) { get_subject }
92
+ end
93
+ end # with admin mode
94
+
82
95
  end # visiting show
83
96
 
84
97
  context 'with xml' do
@@ -193,6 +206,26 @@ class NodesControllerTest < Zena::Controller::TestCase
193
206
  end
194
207
  end # visiting edit page
195
208
 
209
+ # FIXME: Rails3 with new Urls: test does not pass, but it works.
210
+ # context 'visiting a custom_base with accents' do
211
+ # setup do
212
+ # # see test_zen_path_custom_base_with_accents
213
+ # # in urls_test
214
+ # login(:lion)
215
+ # node = secure!(Node) { nodes(:cleanWater) }
216
+ # node.update_attributes(:title => 'Lignes aériennes', :v_status => Zena::Status[:pub])
217
+ # end
218
+ #
219
+ # subject do
220
+ # {:action => 'show', :prefix => 'oo', :controller => 'nodes', :path => ['Lignes-aériennes']}
221
+ # end
222
+ #
223
+ # should 'not redirect' do
224
+ # get_subject
225
+ # assert_response :success
226
+ # end
227
+ # end # visiting a custom_base with accents
228
+
196
229
  context 'creating a node' do
197
230
  subject do
198
231
  {:action => 'create', :controller => 'nodes', :node => {:parent_id => nodes_zip(:zena), :title => 'hello', :klass => 'Page'}}
@@ -241,6 +274,39 @@ class NodesControllerTest < Zena::Controller::TestCase
241
274
  end
242
275
  end # with a redir param
243
276
 
277
+ context 'by changing a link comment' do
278
+ subject do
279
+ {:action => 'update', :controller => 'nodes', :id => nodes_zip(:opening), :node => {:link_id => links_id(:opening_in_art), :l_comment => 'To be removed'}}
280
+ end
281
+
282
+ should 'update link' do
283
+ assert_difference('Link.count', 0) do
284
+ assert_difference('Version.count', 0) do
285
+ put_subject
286
+ end
287
+ end
288
+ assert_equal 'To be removed', Link.find(links_id(:opening_in_art)).comment
289
+ assert_response :redirect
290
+ end
291
+ end # by changing a link comment
292
+
293
+
294
+ context 'by changing a link date' do
295
+ subject do
296
+ {:action => 'update', :controller => 'nodes', :id => nodes_zip(:opening), :node => {:link_id => links_id(:opening_in_art), :l_date => '2011-03-29 17:51'}}
297
+ end
298
+
299
+ should 'update link' do
300
+ assert_difference('Link.count', 0) do
301
+ assert_difference('Version.count', 0) do
302
+ put_subject
303
+ end
304
+ end
305
+ assert_equal '2011-03-29 17:51', Link.find(links_id(:opening_in_art)).date.strftime('%Y-%m-%d %H:%M')
306
+ assert_response :redirect
307
+ end
308
+ end # by changing a date
309
+
244
310
  context 'by changing skin' do
245
311
  subject do
246
312
  {:action => 'update', :controller => 'nodes', :id => nodes_zip(:people), :node => {:skin_zip => nodes_zip(:wikiSkin), :inherit => 0}}
@@ -264,9 +330,9 @@ class NodesControllerTest < Zena::Controller::TestCase
264
330
  end # with a bad value
265
331
 
266
332
  end # by changing skin
267
-
333
+
268
334
  end # updating a node
269
-
335
+
270
336
  # ======================================= Template update
271
337
  context 'updating a template' do
272
338
  subject do
@@ -278,7 +344,7 @@ class NodesControllerTest < Zena::Controller::TestCase
278
344
  assert_equal '+index', assigns(:node).mode
279
345
  end
280
346
  end # updating a template
281
-
347
+
282
348
  context 'using xml' do
283
349
  context 'without being in the api_group' do
284
350
  setup do
@@ -407,55 +473,78 @@ class NodesControllerTest < Zena::Controller::TestCase
407
473
 
408
474
  end # using xml
409
475
 
410
- context 'using html' do
411
- context 'destroying a node' do
476
+ context 'visiting a node' do
477
+
478
+ subject do
479
+ {:action => 'show', :controller => 'nodes', :path => ["page#{nodes_zip(:projects)}_admin.html"], :prefix => 'oo'}
480
+ end
412
481
 
482
+ should 'show page' do
483
+ get_subject
484
+ assert_response :success
485
+ end
486
+
487
+ context 'with admin mode' do
413
488
  subject do
414
- {:action=>'destroy', :controller=>'nodes', :id=>nodes_zip(:art)}
489
+ {:action => 'show', :controller => 'nodes', :path => ["page#{nodes_zip(:projects)}_admin.html"], :prefix => 'oo'}
415
490
  end
416
491
 
417
- should 'succeed' do
418
- assert_nothing_raised do
419
- delete_subject
420
- end
492
+ should 'render default admin layout' do
493
+ get_subject
494
+ assert_response :success
495
+ assert_match %r{\$default/Node-admin}, @response.rendered[:template].to_s
421
496
  end
497
+ end # with admin mode
498
+ end
499
+
500
+ context 'destroying a node' do
501
+
502
+ subject do
503
+ {:action=>'destroy', :controller=>'nodes', :id=>nodes_zip(:art)}
504
+ end
422
505
 
423
- should 'be redirected' do
506
+ should 'succeed' do
507
+ assert_nothing_raised do
424
508
  delete_subject
425
- assert_response :redirect
426
509
  end
510
+ end
427
511
 
428
- should 'be noticed that the node is destroyed' do
512
+ should 'be redirected' do
513
+ delete_subject
514
+ assert_response :redirect
515
+ end
516
+
517
+ # No, flash removed
518
+ # should 'be noticed that the node is destroyed' do
519
+ # delete_subject
520
+ # assert_equal 'Node destroyed.', flash[:notice]
521
+ # end
522
+
523
+ should 'delete the node' do
524
+ assert_difference('Node.count', -1) do
429
525
  delete_subject
430
- assert_equal 'Node destroyed.', flash[:notice]
431
526
  end
527
+ end
432
528
 
433
- should 'delete the node' do
434
- assert_difference('Node.count', -1) do
435
- delete_subject
436
- end
437
- end
529
+ end # destroying a node
438
530
 
439
- end # destroying a node
531
+ context 'trying to destroy an inaccessible node' do
532
+ subject do
533
+ {:action=>'destroy', :controller=>'nodes', :id=>nodes_zip(:status)}
534
+ end
440
535
 
441
- context 'trying to destroy an inaccessible node' do
442
- subject do
443
- {:action=>'destroy', :controller=>'nodes', :id=>nodes_zip(:status)}
444
- end
536
+ should 'be noticed that it could not destroy the node' do
537
+ delete_subject
538
+ assert_equal "Could not destroy node.", flash[:notice]
539
+ end
445
540
 
446
- should 'be noticed that it could not destroy the node' do
541
+ should 'not delete the node' do
542
+ assert_difference('Node.count', 0) do
447
543
  delete_subject
448
- assert_equal "Could not destroy node.", flash[:notice]
449
- end
450
-
451
- should 'not delete the node' do
452
- assert_difference('Node.count', 0) do
453
- delete_subject
454
- end
455
544
  end
545
+ end
456
546
 
457
- end # trying to destroy an inaccessible node
458
- end # using html
547
+ end # trying to destroy an inaccessible node
459
548
  end # A user
460
549
 
461
550
 
@@ -765,7 +854,7 @@ END:VCALENDAR
765
854
 
766
855
  def test_search_q
767
856
  login(:anon)
768
- get 'search', 'q' => 'zen'
857
+ get 'search', 'q' => 'wild'
769
858
  assert nodes = assigns(:nodes)
770
859
  assert_equal [nodes_id(:zena)], nodes.map {|r| r.id}
771
860
  end
@@ -140,12 +140,141 @@ class UsersControllerTest < Zena::Controller::TestCase
140
140
  context "Updating a user" do
141
141
  setup do
142
142
  login(:lion)
143
- put 'update', 'id' => users_id(:lion), 'user'=>{'name'=>'Leo Verneyi', 'lang'=>'en', 'time_zone'=>'Africa/Algiers', 'first_name'=>'Panthera', 'login'=>'lion', 'email'=>'lion@zenadmin.info'}
143
+ put 'update',
144
+ 'id' => users_id(:lion),
145
+ 'user'=> {
146
+ 'lang'=>'en',
147
+ 'time_zone'=>'Africa/Algiers',
148
+ 'login'=>'lion',
149
+ }
144
150
  end
151
+
145
152
  should_assign_to :user
153
+
146
154
  should_respond_with :success
147
- should "be able to set timezone" do
148
- assert_equal 'Africa/Algiers', assigns(:user)[:time_zone]
155
+
156
+ should "set timezone" do
157
+ err assigns(:user)
158
+ assert_equal 'Africa/Algiers', users(:lion)[:time_zone]
149
159
  end
150
160
  end # Updating a user
161
+
162
+ context "Changing password" do
163
+ setup do
164
+ login(:ant)
165
+ end
166
+
167
+ subject do
168
+ put 'update',
169
+ 'id' => users_id(:ant),
170
+ 'update' => 'pass',
171
+ 'user' => {
172
+ 'password' => 'superman',
173
+ 'retype_password' => 'superman',
174
+ 'old_password' => 'ant'
175
+ }
176
+ end
177
+
178
+ should 'set password' do
179
+ subject
180
+ assert_response :success
181
+ assert users(:ant).valid_password?('superman')
182
+ end
183
+
184
+ context 'with an invalid previous password' do
185
+ subject do
186
+ put 'update',
187
+ 'id' => users_id(:ant),
188
+ 'update' => 'pass',
189
+ 'user' => {
190
+ 'password' => 'superman',
191
+ 'retype_password' => 'superman',
192
+ 'old_password' => 'antaddf'
193
+ }
194
+ end
195
+
196
+ should 'not change password' do
197
+ subject
198
+ assert_response :success
199
+ assert !users(:ant).valid_password?('superman')
200
+ assert users(:ant).valid_password?('ant')
201
+ end
202
+
203
+ should 'set an error' do
204
+ subject
205
+ assert_equal 'not correct', assigns(:user).errors[:old_password]
206
+ end
207
+ end # with an invalid previous password
208
+
209
+ context 'by an admin' do
210
+ setup do
211
+ login(:lion)
212
+ end
213
+
214
+ subject do
215
+ put 'update',
216
+ 'id' => users_id(:lion),
217
+ 'update' => 'pass',
218
+ 'user' => {
219
+ 'password' => 'superman',
220
+ 'retype_password' => 'superman',
221
+ 'old_password' => 'lion'
222
+ }
223
+ end
224
+
225
+ should 'set password' do
226
+ subject
227
+ assert_response :success
228
+ assert users(:lion).valid_password?('superman')
229
+ end
230
+
231
+ should 'set other user password' do
232
+ put 'update',
233
+ 'id' => users_id(:ant),
234
+ 'update' => 'pass',
235
+ 'user' => {
236
+ 'password' => 'cymbal'
237
+ }
238
+ assert_response :success
239
+ assert users(:ant).valid_password?('cymbal')
240
+ end
241
+
242
+ should 'not set own password without previous password' do
243
+ put 'update',
244
+ 'id' => users_id(:lion),
245
+ 'update' => 'pass',
246
+ 'user' => {
247
+ 'password' => 'cymbal'
248
+ }
249
+ assert_response :success
250
+ assert_equal 'not correct', assigns(:user).errors[:old_password]
251
+ end
252
+
253
+ context 'with an invalid previous password' do
254
+ subject do
255
+ put 'update',
256
+ 'id' => users_id(:lion),
257
+ 'update' => 'pass',
258
+ 'user' => {
259
+ 'password' => 'superman',
260
+ 'retype_password' => 'superman',
261
+ 'old_password' => 'antaddf'
262
+ }
263
+ end
264
+
265
+ should 'not change password' do
266
+ subject
267
+ assert_response :success
268
+ assert !assigns(:user).valid_password?('superman')
269
+ assert assigns(:user).valid_password?('lion')
270
+ end
271
+
272
+ should 'set an error' do
273
+ subject
274
+ assert_equal 'not correct', assigns(:user).errors[:old_password]
275
+ end
276
+ end # with an invalid previous password
277
+ end # by an admin
278
+
279
+ end # Changing password
151
280
  end