zena 1.0.0.beta2 → 1.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/.gitignore +2 -0
  2. data/History.txt +12 -0
  3. data/app/controllers/application_controller.rb +0 -1
  4. data/app/controllers/columns_controller.rb +11 -1
  5. data/app/controllers/nodes_controller.rb +79 -19
  6. data/app/controllers/versions_controller.rb +0 -2
  7. data/app/controllers/virtual_classes_controller.rb +19 -6
  8. data/app/models/column.rb +5 -1
  9. data/app/models/comment.rb +1 -6
  10. data/app/models/node.rb +21 -3
  11. data/app/models/role.rb +21 -0
  12. data/app/models/site.rb +7 -2
  13. data/app/models/template.rb +3 -3
  14. data/app/models/text_document.rb +4 -4
  15. data/app/models/user.rb +21 -8
  16. data/app/views/columns/_li.html.erb +1 -0
  17. data/app/views/nodes/_groups.rhtml +1 -1
  18. data/app/views/sites/_form.erb +3 -1
  19. data/app/views/sites/_li.erb +1 -0
  20. data/app/views/sites/index.erb +1 -1
  21. data/app/views/virtual_classes/_form.erb +11 -2
  22. data/app/views/virtual_classes/_li.erb +5 -2
  23. data/bin/zena +1 -1
  24. data/bricks/math/lib/bricks/math.rb +1 -1
  25. data/bricks/mongrel/README +3 -0
  26. data/bricks/mongrel/zena/deploy.rb +56 -0
  27. data/bricks/passenger/README +3 -0
  28. data/bricks/passenger/zena/deploy.rb +49 -0
  29. data/config/bricks.yml +6 -0
  30. data/config/deploy.rb +24 -18
  31. data/config/gems.yml +3 -3
  32. data/db/migrate/20100915062903_add_api_group_id_to_site.rb +9 -0
  33. data/lib/tasks/zena.rake +39 -35
  34. data/lib/zena.rb +5 -6
  35. data/lib/zena/acts/enrollable.rb +37 -6
  36. data/lib/zena/app.rb +4 -2
  37. data/lib/zena/deploy.rb +110 -150
  38. data/lib/zena/deploy/awstats.conf.rhtml +4 -4
  39. data/lib/zena/deploy/httpd.rhtml +2 -1
  40. data/lib/zena/deploy/stats.vhost.rhtml +7 -7
  41. data/lib/zena/deploy/vhost.rhtml +1 -1
  42. data/lib/zena/deploy/vhost_www.rhtml +4 -4
  43. data/lib/zena/foxy_parser.rb +6 -5
  44. data/lib/zena/info.rb +1 -1
  45. data/lib/zena/integration/test_case.rb +8 -3
  46. data/lib/zena/parser.rb +11 -11
  47. data/lib/zena/parser/zafu_tags.rb +2 -2
  48. data/lib/zena/remote.rb +16 -0
  49. data/lib/zena/remote/connection.rb +67 -0
  50. data/lib/zena/remote/interface.rb +405 -0
  51. data/lib/zena/remote/klass.rb +14 -0
  52. data/lib/zena/remote/mock.rb +58 -0
  53. data/lib/zena/remote/node.rb +76 -0
  54. data/lib/zena/routes.rb +2 -1
  55. data/lib/zena/use.rb +9 -4
  56. data/lib/zena/use/ajax.rb +3 -3
  57. data/lib/zena/use/authlogic.rb +8 -1
  58. data/lib/zena/use/context.rb +22 -21
  59. data/lib/zena/use/dates.rb +26 -3
  60. data/lib/zena/use/display.rb +33 -5
  61. data/lib/zena/use/forms.rb +90 -12
  62. data/lib/zena/use/fulltext.rb +1 -1
  63. data/lib/zena/use/i18n.rb +118 -31
  64. data/lib/zena/use/query_builder.rb +7 -5
  65. data/lib/zena/use/query_node.rb +30 -4
  66. data/lib/zena/use/rendering.rb +1 -1
  67. data/lib/zena/use/search.rb +10 -7
  68. data/lib/zena/use/urls.rb +3 -3
  69. data/lib/zena/use/zafu_attributes.rb +2 -2
  70. data/lib/zena/use/zafu_eval.rb +1 -1
  71. data/lib/zena/use/zafu_safe_definitions.rb +1 -0
  72. data/lib/zena/use/zafu_templates.rb +1 -1
  73. data/lib/zena/zafu_compiler.rb +5 -1
  74. data/public/javascripts/zena.js +4 -4
  75. data/public/stylesheets/admin.css +1 -0
  76. data/test/custom_queries/complex.host.yml +3 -3
  77. data/test/fixtures/files/translations_fr.yml +4 -1
  78. data/test/functional/application_controller_test.rb +2 -2
  79. data/test/functional/nodes_controller_test.rb +57 -5
  80. data/test/functional/users_controller_test.rb +10 -9
  81. data/test/functional/virtual_classes_controller_test.rb +48 -0
  82. data/test/integration/navigation_test.rb +13 -1
  83. data/test/integration/query_node/filters.yml +5 -0
  84. data/test/integration/query_node_test.rb +1 -1
  85. data/test/integration/zafu_compiler/ajax.yml +13 -19
  86. data/test/integration/zafu_compiler/basic.yml +0 -72
  87. data/test/integration/zafu_compiler/complex.yml +1 -1
  88. data/test/integration/zafu_compiler/complex_ok.yml +19 -0
  89. data/test/integration/zafu_compiler/dates.yml +62 -1
  90. data/test/integration/zafu_compiler/display.yml +4 -4
  91. data/test/integration/zafu_compiler/forms.yml +19 -7
  92. data/test/integration/zafu_compiler/i18n.yml +56 -1
  93. data/test/integration/zafu_compiler/later.yml +23 -1
  94. data/test/integration/zafu_compiler/relations.yml +1 -1
  95. data/test/integration/zafu_compiler/roles.yml +29 -1
  96. data/test/integration/zafu_compiler/safe_definitions.yml +1 -1
  97. data/test/integration/zafu_compiler/zafu_attributes.yml +2 -1
  98. data/test/integration/zafu_compiler_test.rb +5 -3
  99. data/test/sites/zena/columns.yml +3 -0
  100. data/test/sites/zena/roles.yml +0 -1
  101. data/test/sites/zena/sites.yml +1 -0
  102. data/test/sites/zena/versions.yml +2 -0
  103. data/test/unit/node_test.rb +27 -9
  104. data/test/unit/relation_proxy_test.rb +7 -4
  105. data/test/unit/remote_test.rb +379 -0
  106. data/test/unit/user_test.rb +47 -0
  107. data/test/unit/zena/acts/enrollable_test.rb +36 -7
  108. data/test/unit/zena/acts/serializable_test.rb +14 -2
  109. data/test/unit/zena/use/i18n_test.rb +32 -5
  110. data/test/unit/zena/use/query_node_test.rb +13 -1
  111. data/zena.gemspec +25 -11
  112. metadata +24 -10
@@ -22,7 +22,7 @@ module Zena
22
22
  elsif res = find_document_for_template(path, base_path)
23
23
  doc, base_path = res
24
24
  # text, fullpath (for recursion testing), base_path
25
- return doc.text, doc.fullpath, base_path
25
+ return doc.text, doc.fullpath, base_path, doc
26
26
  else
27
27
  nil
28
28
  end
@@ -1,15 +1,19 @@
1
1
  require 'zafu'
2
2
 
3
3
  module Zena
4
+ # FIXME: replace with (and make sure all is ok!)
5
+ # ZafuCompiler = Zafu.parser_with_rules(Zafu::All + Zena::Use.modules_for('Zafu'))
6
+
4
7
  ZafuCompiler = Zafu.parser_with_rules([
5
8
  Zafu::All,
6
9
  Zena::Use::Conditional::ZafuMethods,
7
10
  Zena::Use::Context::ZafuMethods,
8
- Zena::Use::Display::ZafuMethods,
9
11
  Zena::Use::Urls::ZafuMethods,
10
12
  Zena::Use::ZafuAttributes::ZafuMethods,
11
13
  Zena::Use::ZafuEval::ZafuMethods,
12
14
  Zena::Use::QueryBuilder::ZafuMethods,
15
+ # Has to come after QB
16
+ Zena::Use::Display::ZafuMethods,
13
17
  Zena::Use::I18n::ZafuMethods,
14
18
  Zena::Use::Action::ZafuMethods,
15
19
  Zena::Use::Dates::ZafuMethods,
@@ -283,7 +283,7 @@ Zena.update_rwp = function(inherit_val,r_index,w_index,p_index,s_index) {
283
283
  $("node_wgroup_id").selectedIndex = 0;
284
284
  $("node_rgroup_id").disabled = true;
285
285
  $("node_wgroup_id").disabled = true;
286
- $("node_skin" ).disabled = false;
286
+ $("node_skin_id" ).disabled = false;
287
287
  if (p_index != '') {
288
288
  $("node_dgroup_id").selectedIndex = 0;
289
289
  $("node_dgroup_id").disabled = true;
@@ -291,10 +291,10 @@ Zena.update_rwp = function(inherit_val,r_index,w_index,p_index,s_index) {
291
291
  } else if (inherit_val == "1") {
292
292
  $("node_rgroup_id").selectedIndex = r_index;
293
293
  $("node_wgroup_id").selectedIndex = w_index;
294
- $("node_skin" ).selectedIndex = s_index;
294
+ $("node_skin_id" ).selectedIndex = s_index;
295
295
  $("node_rgroup_id").disabled = true;
296
296
  $("node_wgroup_id").disabled = true;
297
- $("node_skin" ).disabled = true;
297
+ $("node_skin_id" ).disabled = true;
298
298
  if (p_index != '') {
299
299
  $("node_dgroup_id").selectedIndex = p_index;
300
300
  $("node_dgroup_id").disabled = true;
@@ -303,7 +303,7 @@ Zena.update_rwp = function(inherit_val,r_index,w_index,p_index,s_index) {
303
303
  $("node_rgroup_id").disabled = false;
304
304
  $("node_wgroup_id").disabled = false;
305
305
  $("node_dgroup_id").disabled = false;
306
- $("node_skin" ).disabled = false;
306
+ $("node_skin_id" ).disabled = false;
307
307
  if (p_index != '') {
308
308
  $("node_dgroup_id").disabled = false;
309
309
  }
@@ -49,6 +49,7 @@ table.admin td:first-child { border-left: 1px solid #999; }
49
49
  .admin .ruby .constant { font-weight:bold;}
50
50
  .admin .real_class .ruby .constant { color:#333;}
51
51
  .admin .spacer {font-family:monospace;color:#ccc;}
52
+ .admin .spacer span {color:#555; font-weight:bold;}
52
53
  .destroy { margin:5px;}
53
54
  .destroy input, .destroy form { display:inline; }
54
55
  .destroy { border:1px solid #300; padding:3px; background:#fdd; float:right;}
@@ -54,7 +54,7 @@
54
54
 
55
55
  Node:
56
56
  # find all courses that an employee must follow
57
- emp_form_dates:
57
+ emp_form_date:
58
58
  # find courses assigned_to pages in job assigned_to CURRENT_NODE (employee)
59
59
  main_table: courses
60
60
  select:
@@ -90,7 +90,7 @@ Node:
90
90
  group: courses.id
91
91
  order: priority DESC, last_date ASC, courses.node_name ASC
92
92
 
93
- course_emp_dates:
93
+ course_emp_date:
94
94
  main_table: employees
95
95
  select:
96
96
  - employees.id
@@ -125,7 +125,7 @@ Node:
125
125
  order: employees.node_name ASC, IF(form.last_date,form.last_date,0) ASC
126
126
 
127
127
 
128
- all_course_emp_dates:
128
+ all_course_emp_date:
129
129
  # assigned_employees from project from assigned_pages from courses in site
130
130
  # all courses that need to have a formation created
131
131
  main_table: courses
@@ -1,4 +1,7 @@
1
1
  translations:
2
2
  I love: "j'aime"
3
3
  words: les mots
4
- date_format: '[%d.%m]'
4
+ date_format: '[%d.%m]'
5
+ # used to translate dynamic key
6
+ status: statut
7
+ lang_en: anglais
@@ -21,10 +21,10 @@ end
21
21
  @skin_names = ['wiki', 'default']
22
22
  end
23
23
 
24
- notes_template, url = @controller.send(:find_document_for_template, :current_dir=>"", :src=>"default/notes")
24
+ notes_template, url = @controller.send(:find_document_for_template, :base_path=>"", :src=>"default/notes")
25
25
  assert_kind_of Template, notes_template
26
26
  assert_equal 'default/notes', url
27
- default_css, url = @controller.send(:find_document_for_template, :current_dir=>"default", :src=>"default.css", :type=>:stylesheet)
27
+ default_css, url = @controller.send(:find_document_for_template, :base_path=>"default", :src=>"default.css", :type=>:stylesheet)
28
28
  assert_kind_of TextDocument, default_css
29
29
  assert_equal 'default/default.css', url
30
30
  end
@@ -126,6 +126,20 @@ class NodesControllerTest < Zena::Controller::TestCase
126
126
  assert_response :unauthorized
127
127
  end
128
128
  end # creating a node
129
+
130
+ context 'accessing xml without a token' do
131
+ subject do
132
+ {:action => 'search', :qb => 'foos'}
133
+ end
134
+
135
+ should 'return an error' do
136
+ @request.env['HTTP_ACCEPT'] = 'application/xml'
137
+ get_subject
138
+ assert_response 401
139
+ assert_equal "Authentication token needed.", Hash.from_xml(@response.body)['errors'].first['message']
140
+ end
141
+ end # accessing xml without a token
142
+
129
143
  end # with xml
130
144
  end # An anonymous user
131
145
 
@@ -196,6 +210,29 @@ class NodesControllerTest < Zena::Controller::TestCase
196
210
  end # creating a node
197
211
 
198
212
  context 'using xml' do
213
+ context 'without being in the api_group' do
214
+ setup do
215
+ visitor.site.api_group_id = nil
216
+ end
217
+
218
+ context 'asking for show' do
219
+ subject do
220
+ {:action => 'show', :controller => 'nodes', :id => nodes_zip(:projects).to_s, :format => 'xml'}
221
+ end
222
+
223
+ should 'fail' do
224
+ get_subject
225
+ assert_response :unauthorized
226
+ end
227
+
228
+ should 'return an xml error' do
229
+ get_subject
230
+ assert_match %r{<message>Not in API group.</message>}, @response.body
231
+ end
232
+ end
233
+
234
+ end # without being in the api_group
235
+
199
236
  context 'asking for show' do
200
237
  subject do
201
238
  {:action => 'show', :controller => 'nodes', :id => nodes_zip(:projects).to_s, :format => 'xml'}
@@ -262,6 +299,20 @@ class NodesControllerTest < Zena::Controller::TestCase
262
299
 
263
300
  end
264
301
 
302
+ context 'with a bad request' do
303
+ subject do
304
+ {:action => 'search', :qb => 'foos'}
305
+ end
306
+
307
+ should 'return an error' do
308
+ @request.env['HTTP_ACCEPT'] = 'application/xml'
309
+ @request.env['HTTP_X_AUTHENTICATION_TOKEN'] = 'mytoken'
310
+ get_subject
311
+ assert_response 401
312
+ assert_equal "Error parsing query \"foos\" (Unknown relation 'foos'.)", Hash.from_xml(@response.body)['errors'].first['message']
313
+ end
314
+ end # with a bad request
315
+
265
316
  end # using xml
266
317
 
267
318
  context 'using html' do
@@ -632,14 +683,15 @@ END:VCALENDAR
632
683
  get 'search', 'qb' => 'nodes where (set_tag_id = 33 and hot_id = 22) in site'
633
684
  assert_response :success
634
685
  assert nodes = assigns(:nodes)
635
- assert_equal [nodes_id(:cleanWater)], nodes.map {|r| r.id}
686
+ assert_equal [nodes_id(:cleanWater)], nodes.map(&:id)
636
687
  end
637
688
 
638
- def test_search_qb_errors
689
+ def test_find_from_node
639
690
  login(:anon)
640
- assert_raise(ActiveRecord::StatementInvalid) do
641
- get 'search', 'qb' => 'nodes foobar error'
642
- end
691
+ get 'find', :id => nodes_zip(:lake_jpg), 'qb' => 'icon_for', '_find' => 'first'
692
+ assert_response :success
693
+ assert nodes = assigns(:nodes)
694
+ assert_equal nodes_id(:cleanWater), nodes.first.id
643
695
  end
644
696
  end
645
697
 
@@ -84,14 +84,16 @@ class UsersControllerTest < Zena::Controller::TestCase
84
84
  subject do
85
85
  {
86
86
  :user => {
87
- "name" => "Dupont",
88
- "lang" => "fr",
89
- "time_zone" => "Europe/Zurich",
90
- "status" => "50",
91
- "password" => "secret",
92
- "login" => "bolomey",
93
- "first_name" => "Paul"
94
-
87
+ 'name' => 'Dupont',
88
+ 'lang' => 'fr',
89
+ 'time_zone' => 'Europe/Zurich',
90
+ 'status' => '50',
91
+ 'password' => 'secret',
92
+ 'login' => 'bolomey',
93
+ 'first_name' => 'Paul',
94
+ 'group_ids' => [groups_id(:admin), ''],
95
+ 'email' => 'paul.bolomey@brainfuck.com',
96
+ '_' => '' # This is in the original post
95
97
  },
96
98
  :action => 'create'
97
99
  }
@@ -101,7 +103,6 @@ class UsersControllerTest < Zena::Controller::TestCase
101
103
  post_subject
102
104
  assert_response :success
103
105
  user = assigns(:user)
104
- err user
105
106
  assert !user.new_record?
106
107
  end
107
108
 
@@ -73,6 +73,34 @@ class VirtualClassesControllerTest < Zena::Controller::TestCase
73
73
 
74
74
  end # creating a virtual class
75
75
 
76
+ context 'creating a role' do
77
+ subject do
78
+ {:action => :create, :virtual_class => { :type => 'Role', :name => 'Xkcd', :superclass => 'Section', :create_group_id => groups_id(:public) }}
79
+ end
80
+
81
+ should 'create a new Role' do
82
+ assert_difference('VirtualClass.count', 0) do
83
+ assert_difference('Role.count', 1) do
84
+ post_subject
85
+ end
86
+ end
87
+ end
88
+
89
+ should 'set name, superclass and kpath' do
90
+ post_subject
91
+ vclass = assigns(:virtual_class)
92
+ assert_equal 'Xkcd', vclass.name
93
+ assert_equal Section, vclass.superclass
94
+ assert_equal 'NPS', vclass.kpath
95
+ end
96
+
97
+ should 'redirect to show' do
98
+ post_subject
99
+ assert_redirected_to virtual_class_path(assigns(:virtual_class))
100
+ end
101
+
102
+ end # creating a role
103
+
76
104
  context 'displaying a virtual class' do
77
105
  subject do
78
106
  {:action => :show, :id => roles_id(:Letter)}
@@ -115,6 +143,26 @@ class VirtualClassesControllerTest < Zena::Controller::TestCase
115
143
  # TODO: What happens to properties for a class if kpath changes ?
116
144
  end # updating a virtual class
117
145
 
146
+ context 'updating a role' do
147
+ subject do
148
+ {:action => :update, :id => roles_id(:Original), :virtual_class => { :name => 'Life', :superclass => 'Post'}}
149
+ end
150
+
151
+ should 'redirect to show' do
152
+ put_subject
153
+ assert_redirected_to virtual_class_path(assigns(:virtual_class))
154
+ end
155
+
156
+ should 'save name and kpath' do
157
+ put_subject
158
+ vclass = assigns(:virtual_class)
159
+ assert_equal 'Life', vclass.name
160
+ assert_equal 'NNP', vclass.kpath
161
+ end
162
+
163
+ # TODO: What happens to properties for a class if kpath changes ?
164
+ end # updating a virtual class
165
+
118
166
  context 'destroying a virtual class' do
119
167
  subject do
120
168
  {:action => :destroy, :id => roles_id(:Letter)}
@@ -13,8 +13,9 @@ class NavigationTest < Zena::Integration::TestCase
13
13
  get 'http://test.host/'
14
14
  assert_redirected_to 'http://test.host/login'
15
15
 
16
- reset!
17
16
  post 'http://test.host/session', :login=>'tiger', :password=>'tiger'
17
+ assert_redirected_to "http://test.host/"
18
+ follow_redirect!
18
19
  assert_redirected_to "http://test.host/oo"
19
20
 
20
21
  # 2. navigating out of '/oo' but logged in and format is not data
@@ -26,6 +27,17 @@ class NavigationTest < Zena::Integration::TestCase
26
27
  assert_response :success
27
28
  end
28
29
 
30
+ def test_should_not_redirect_to_css
31
+
32
+ # 1. site forces authentication
33
+ Site.connection.execute "UPDATE sites SET authentication = 1 WHERE id = #{sites_id(:zena)}"
34
+ get 'http://test.host/en/textdocument53.css' # style_css
35
+ assert_redirected_to 'http://test.host/login'
36
+
37
+ post 'http://test.host/session', :login=>'tiger', :password=>'tiger'
38
+ assert_redirected_to "http://test.host/oo"
39
+ end
40
+
29
41
  # HTTP_AUTH disabled
30
42
  # def test_authorize_http_auth
31
43
  # Site.connection.execute "UPDATE sites SET http_auth = 1 WHERE id = #{sites_id(:zena)}"
@@ -116,6 +116,11 @@ role_as_relation_filter:
116
116
  sql: "%Q{SELECT nodes.* FROM nodes,nodes_roles WHERE #{secure_scope('nodes')} AND nodes_roles.role_id = 493147733 AND nodes_roles.node_id = nodes.id ORDER BY nodes.position ASC, nodes.node_name ASC}"
117
117
  res: 'tree'
118
118
 
119
+ filter_by_parent:
120
+ src: "nodes where parent_id = 11 in site"
121
+ # nodes where parent.zip = ...
122
+ sql: "%Q{SELECT nodes.* FROM nodes,nodes AS jn1 WHERE #{secure_scope('nodes')} AND jn1.zip = 11 AND jn1.id = nodes.parent_id AND jn1.site_id = nodes.site_id ORDER BY nodes.position ASC, nodes.node_name ASC}"
123
+ res: 'collections, letter, nature, people, projects, skins'
119
124
  #many_role_filter:
120
125
  # This is not working (or clause on 'indexed' fields is not supported right now)
121
126
  # src: "nodes where role = Original or role = Task in site"
@@ -6,7 +6,7 @@ class QueryNodeTest < Zena::Unit::TestCase
6
6
  safe_method :date => Time
7
7
  safe_method :params => StringDictionary
8
8
 
9
- def safe_method_type(signature)
9
+ def safe_method_type(signature, receiver = nil)
10
10
  # TODO: we could use the @context[:node] to get real class..
11
11
  if type = Node.safe_method_type(signature)
12
12
  type.merge(:method => "@node.#{type[:method]}")
@@ -15,19 +15,6 @@ add:
15
15
  'ajax/add/en/children_form.erb': "/class='form' id='<%= ndom_id\(@node\) %>'/"
16
16
  'ajax/add/en/children.erb': "<li id='<%= ndom_id(@node) %>'><a href='<%= zen_path(@node) %>'><%= @node.prop['title'] %></a></li>"
17
17
 
18
- zazen_edit:
19
- src: "<r:zazen attr='node_name' edit='true'/>"
20
- tem: "<div class='zazen' id='list1_name'><% if @node.can_write? -%><span class='zazen_edit'><%= link_to_remote(\"edit\", :url => edit_node_path(@node.zip) + \"?attribute=name&dom_id=list1_name&zazen=true\", :method => :get) %></span><% end -%><%= zazen(@node.name, :node=>@node) %></div>"
21
- res: "/div class='zazen' id='list1_name'>.*Ajax\.Request\('/nodes/22/edit\?attribute=name/"
22
-
23
- zazen_edit_publish_force:
24
- src: "<r:zazen attr='d_some_attr' edit='true' publish='force'/>"
25
- tem: "/attribute=d_some_attr&dom_id=.*_some_attr&publish=force&zazen=true/"
26
-
27
- zazen_edit_publish_true:
28
- src: "<r:zazen attr='d_some_attr' edit='true' publish='true'/>"
29
- tem: "/attribute=d_some_attr&dom_id=.*_some_attr&publish=true&zazen=true/"
30
-
31
18
  edit_not_each:
32
19
  src: "<li class='blah'>this is a post <r:edit>edit post</r:edit></li>"
33
20
  res: "/<li class='blah'>this is a post <a href='/nodes/22/edit'>edit</a></li>/"
@@ -53,7 +40,7 @@ each_add_with_form:
53
40
  <li do='add'>add new</li>
54
41
  <li do='form'><input name='title'/> this is the form</li>
55
42
  </ol>
56
- res: "/<li id='list1_30'>bird.*<li id='list1_31'>flower.*<li.*list1_add.*list1_form.*toggle.*<li style.*none.*list1_form.*Ajax.Request.*input type='hidden' name='t_url' value=.ajax/each/add/with/form/list1.*input type='hidden' name='node\[parent_id\]' value=.29./"
43
+ res: "/<li id='list2_30'>bird.*<li id='list2_31'>flower.*<li.*list1_add.*list1_form.*toggle.*<li style.*none.*list1_form.*Ajax.Request.*input type='hidden' name='t_url' value=.ajax/each/add/with/form/list1.*input type='hidden' name='node\[parent_id\]' value=.29./"
57
44
 
58
45
  each_add_with_form_in_sub_block:
59
46
  context:
@@ -88,7 +75,7 @@ each_edit_with_form:
88
75
  context:
89
76
  node: 'wiki'
90
77
  src: "<r:children><li do='each'><r:show attr='node_name'>blah</r:show> <r:edit>edit</r:edit></li>\n<r:form><li><form>this is the form</form></li></r:form></r:children>"
91
- 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/"
78
+ res: "/<li id='list2_30'>bird <a href='/nodes/30/edit' onclick='new Ajax.Request\(\"/nodes/30/edit\?.*t_url=ajax%2Feach%2Fedit%2Fwith%2Fform%2Flist2_form/"
92
79
 
93
80
  make_form:
94
81
  src: "<ul do='children'><li do='each' do='node_name'/><li do='add'/></ul>"
@@ -101,7 +88,7 @@ each_edit_cannot_write:
101
88
  node: 'cleanWater'
102
89
  visitor: 'anon'
103
90
  src: "<r:children><li do='each'><r:show attr='node_name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:children>"
104
- res: "/<li id='list1_24'>lake</li>.*/"
91
+ res: "/<li id='list2_24'>lake</li>.*/"
105
92
 
106
93
  add_each_publish:
107
94
  src: "<ul do='children' id='things'><li do='each'>I <p do='node_name'>blah</p></li><li do='add' publish='true'/></ul>"
@@ -167,6 +154,13 @@ draggable_true:
167
154
  src: "<r:link draggable='true'/>"
168
155
  tem: "/add_drag_id\(\"list1_\#\{@node.zip\}\", .*drag_handle/"
169
156
 
157
+ draggable_in_block:
158
+ # should use 'hooba' class
159
+ src: "<r:block><r:link draggable='true'/></r:block>"
160
+ tem: "/add_drag_id\(\"list1_\#\{@node.zip\}\", .*hooba/"
161
+ res: "<div class='drag' id='list1_22'><a href='/oo/projects/cleanWater/page22.html'>status title</a></div>"
162
+ js: "/Zena.draggable\(item, \"hooba\"\)/"
163
+
170
164
  draggable_with_id_set:
171
165
  # should not change original id
172
166
  src: "<h1 id='title' do='title' draggable='true'/>"
@@ -223,7 +217,7 @@ drop_param:
223
217
 
224
218
  drop_param_in_each:
225
219
  src: "<r:pages do='each' do='drop' change='params' d='foo'><r:show eval='params[:d]'/></r:pages>"
226
- tem: "/<div class='drop' id='<%= %Q\{list1_#\{var2.zip\}\} %>'><% add_drop_id\(\"list1_#\{var2.zip\}\"/"
220
+ tem: "/<div class='drop' id='<%= %Q\{list2_#\{var2.zip\}\} %>'><% add_drop_id\(\"list2_#\{var2.zip\}\"/"
227
221
 
228
222
  update_target:
229
223
  src: "UT: <div id='foo' do='block'>...</div> <r:link update='foo'/>"
@@ -234,8 +228,8 @@ include_update_target:
234
228
  tem: "/IUT: UT: <div id='foo'><%= @node.node_name %></div> <a .*zen_path.*onclick='new Ajax.Request/"
235
229
 
236
230
  id_in_each_group_should_be_scoped:
237
- src: "<ul do='comments from nodes in site' do='group' by='discussion_id'><li do='each_group'><r:node do='block' do='swap' states='1,2' attr='custom_a' do='[custom_a]'/></li></ul>"
238
- tem: "/grp_list1.each.*<div id='list1_<%= var1.zip %>/"
231
+ src: "<ul do='comments from nodes in site' do='group' by='discussion_id'><li do='each'><r:node do='block' do='title'/></li></ul>"
232
+ tem: "/<div id='<%= %Q\{list1_#\{var4.zip\}\} %>'>/"
239
233
 
240
234
  link_page_next:
241
235
  context:
@@ -334,45 +334,7 @@ comments_shown_if_empty_but_can_comment:
334
334
  src: "<r:comments><r:each do='[title]'/><r:add/></r:comments>"
335
335
  tem: "/if \(list1 = @node.comments\) \|\| \(@node.can_comment\? && list1=\[\]\) -%>/"
336
336
 
337
- date_tformat:
338
- context:
339
- node: 'people'
340
- lang: 'fr'
341
- src: "<r:show date='created_at' tformat='%d %B %Y'/>"
342
- tem: "<%= format_date(@node.created_at, :format => \"%d %B %Y\") %>"
343
- res: "10 mars 2006"
344
-
345
- date_tz:
346
- context:
347
- visitor: 'ant'
348
- node: 'people'
349
- lang: 'en'
350
- src: "<r:show date='created_at' format='%H:%M'/> / <r:show date='created_at' format='%H:%M' time_zone='Asia/Jakarta'/>"
351
- res: "01:00 / 07:00"
352
337
 
353
- date_tz_field:
354
- context:
355
- node: 'projects'
356
- src: "<r:pages do='each' join=', '><r:show attr='node_name'/>: <r:show date='created_at' format='%H:%M' time_zone='[d_tz]' time_zone='Europe/Zurich'/> | <r:show date='created_at' format='%H:%M' time_zone='UTC'/></r:pages>"
357
- res: "cleanWater: 07:00 | 00:00, wiki: 01:00 | 00:00"
358
-
359
- dictionary_fr:
360
- context:
361
- lang: 'fr'
362
- src: "<r:load dictionary='translations'><r:trans>foo</r:trans>: <r:t>I love</r:t> <r:trans>words</r:trans></r:load>"
363
- tem: "foo: j'aime les mots"
364
- res: "foo: j'aime les mots"
365
-
366
- dictionary_de:
367
- context:
368
- lang: 'de'
369
- src: "<r:load dictionary='translations'><r:trans>foo</r:trans>: <r:trans>I love</r:trans> <r:trans>words</r:trans></r:load>"
370
- tem: "foo: Ich liebe Wörter"
371
- res: "foo: Ich liebe Wörter"
372
-
373
- dictionary_tformat:
374
- src: "<r:load dictionary='translations'><r:show date='created_at' tformat='date_format'/></r:load>"
375
- res: "[10.03]"
376
338
 
377
339
  captcha:
378
340
  context:
@@ -381,40 +343,6 @@ captcha:
381
343
  src: "<r:captcha theme='clean'/>"
382
344
  res: "/RecaptchaOptions .* theme : .clean./"
383
345
 
384
- date_fr:
385
- context:
386
- visitor: ant
387
- lang: 'fr'
388
- src: "<r:show date='created_at' format='%a'/>"
389
- res: "ven"
390
-
391
- date_fr_lang:
392
- context:
393
- lang: 'fr'
394
- old_src: "<r:show date='created_at' format='%a' lang='en'/>"
395
- src: "<r:show attr='created_at' format='%a' lang='en'/>"
396
- tem: "<%= format_date(@node.created_at, :lang => \"en\", :format => \"%a\") %>"
397
- res: "Fri"
398
-
399
- date_context:
400
- old_src: "<r:date select='2008-03-02'><r:show date='current_date' format='%A %d.%m.%Y'/></r:date>"
401
- src: "<r:show eval='parse_date(\"2008-03-02\")' format='%A %d.%m.%Y'/>"
402
- res: "Sunday 02.03.2008"
403
-
404
- date_from_params:
405
- context:
406
- year: 1975
407
- old_src: "<r:date select='[param:year]-01-01'><r:show date='current_date' format='%A %d.%m.%Y'/></r:date>"
408
- src: "<r:show eval='parse_date(\"#{params[:year]}-01-01\")' format='%A %d.%m.%Y'/>"
409
- tem: "<%= format_date(parse_date(\"#{params[:year]}-01-01\"), :format => \"%A %d.%m.%Y\") %>"
410
- res: "Wednesday 01.01.1975"
411
-
412
- date_from_params_in_query:
413
- context:
414
- year: 2006
415
- src: "<r:date select='[param:year]-01-01'><r:nodes in='site' log='year' do='each' join=', ' do='node_name'/></r:date>"
416
- tem: "/(date_format|strftime).*format_date.*params\[:year\].*%Y/"
417
- res: "letter, opening"
418
346
 
419
347
  paginate:
420
348
  context: