zena 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +29 -1
- data/Rakefile +0 -1
- data/app/controllers/documents_controller.rb +1 -1
- data/app/controllers/nodes_controller.rb +34 -8
- data/app/controllers/sites_controller.rb +8 -1
- data/app/controllers/user_sessions_controller.rb +13 -3
- data/app/models/acl.rb +16 -0
- data/app/models/document.rb +33 -14
- data/app/models/idx_nodes_integer.rb +5 -0
- data/app/models/image.rb +16 -4
- data/app/models/node.rb +16 -3
- data/app/models/relation_proxy.rb +3 -3
- data/app/models/site.rb +11 -1
- data/app/models/string_hash.rb +1 -1
- data/app/models/template.rb +1 -1
- data/app/models/user.rb +6 -1
- data/app/models/virtual_class.rb +36 -1
- data/app/views/acls/_form.rhtml +5 -1
- data/app/views/acls/_li.rhtml +1 -1
- data/app/views/templates/document_create_tabs/_file.rhtml +1 -0
- data/app/views/templates/document_create_tabs/_template.rhtml +1 -1
- data/app/views/users/_form.rhtml +1 -0
- data/app/views/virtual_classes/_form.erb +8 -7
- data/bricks/acls/lib/bricks/acls.rb +43 -15
- data/bricks/acls/zena/migrate/20130313110443_add_create_kpath_to_acl.rb +13 -0
- data/bricks/acls/zena/migrate/20130429073432_fix_create_kpath_default.rb +8 -0
- data/bricks/acls/zena/test/integration/acl_integration_test.rb +53 -1
- data/bricks/acls/zena/test/sites/erebus/acls.yml +21 -0
- data/bricks/acls/zena/test/unit/acl_test.rb +35 -2
- data/bricks/math/lib/bricks/math.rb +1 -1
- data/bricks/sphinx/zena/tasks.rb +1 -1
- data/bricks/spreadsheet/lib/bricks/spreadsheet.rb +1 -1
- data/bricks/worker/zena/worker +25 -0
- data/config/environment.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/gems.yml +6 -5
- data/lib/bricks/requirements_validation.rb +1 -1
- data/lib/log_recorder/lib/log_recorder.rb +1 -1
- data/lib/tasks/zena.rake +10 -2
- data/lib/zena.rb +4 -3
- data/lib/zena/app.rb +1 -0
- data/lib/zena/deploy/httpd.rhtml +2 -2
- data/lib/zena/deploy/template.rb +15 -5
- data/lib/zena/info.rb +1 -1
- data/lib/zena/parser/zazen_rules.rb +9 -2
- data/lib/zena/remote/connection.rb +2 -2
- data/lib/zena/remote/interface.rb +8 -2
- data/lib/zena/remote/node.rb +1 -1
- data/lib/zena/routes.rb +2 -1
- data/lib/zena/use/action.rb +8 -2
- data/lib/zena/use/ajax.rb +31 -20
- data/lib/zena/use/calendar.rb +2 -0
- data/lib/zena/use/conditional.rb +15 -14
- data/lib/zena/use/dates.rb +5 -2
- data/lib/zena/use/display.rb +3 -2
- data/lib/zena/use/forms.rb +36 -9
- data/lib/zena/use/i18n.rb +8 -2
- data/lib/zena/use/image_builder.rb +7 -0
- data/lib/zena/use/query_node.rb +24 -8
- data/lib/zena/use/relations.rb +2 -6
- data/lib/zena/use/rendering.rb +10 -6
- data/lib/zena/use/upload.rb +6 -4
- data/lib/zena/use/urls.rb +13 -5
- data/lib/zena/use/zafu_safe_definitions.rb +1 -1
- data/public/javascripts/grid.js +11 -2
- data/public/javascripts/upload-progress.js +5 -3
- data/public/javascripts/zena.js +6 -2
- data/public/stylesheets/upload-progress.css +1 -0
- data/test/fixtures/files/TestNode.zafu +2 -2
- data/test/fixtures/files/translations_fr.yml +2 -1
- data/test/functional/acls_controller_test.rb +6 -0
- data/test/functional/nodes_controller_test.rb +1 -1
- data/test/functional/sites_controller_test.rb +19 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/integration/query_node/filters.yml +10 -0
- data/test/integration/zafu_compiler/action.yml +8 -4
- data/test/integration/zafu_compiler/ajax.yml +4 -4
- data/test/integration/zafu_compiler/calendar.yml +8 -15
- data/test/integration/zafu_compiler/context.yml +1 -1
- data/test/integration/zafu_compiler/dates.yml +5 -1
- data/test/integration/zafu_compiler/display.yml +1 -2
- data/test/integration/zafu_compiler/forms.yml +37 -10
- data/test/integration/zafu_compiler/query.yml +5 -5
- data/test/integration/zafu_compiler/relations.yml +8 -8
- data/test/integration/zafu_compiler/safe_definitions.yml +7 -2
- data/test/integration/zafu_compiler/urls.yml +24 -3
- data/test/integration/zafu_compiler/zazen.yml +9 -1
- data/test/selenium/Destroy/destroy1.rsel +2 -1
- data/test/selenium/Destroy/destroy2.rsel +17 -0
- data/test/unit/document_test.rb +17 -4
- data/test/unit/relation_proxy_test.rb +19 -8
- data/test/unit/string_hash_test.rb +1 -1
- data/test/unit/template_test.rb +3 -3
- data/test/unit/virtual_class_test.rb +77 -0
- data/test/unit/zena/use/urls_test.rb +9 -1
- data/vendor/plugins/selenium-on-rails/lib/selenium_on_rails_config.rb +1 -1
- data/zena.gemspec +60 -53
- metadata +145 -125
|
@@ -33,7 +33,7 @@ icon:
|
|
|
33
33
|
node: 'cleanWater'
|
|
34
34
|
src: "<r:icon do='title'/>"
|
|
35
35
|
tem: "/ORDER BY links.id DESC/"
|
|
36
|
-
res: "it
|
|
36
|
+
res: "it's a lake"
|
|
37
37
|
|
|
38
38
|
pages:
|
|
39
39
|
context:
|
|
@@ -91,7 +91,7 @@ pages_random:
|
|
|
91
91
|
|
|
92
92
|
nodes_in_project:
|
|
93
93
|
src: "<r:nodes in='project' limit='2'><r:each join=', '><r:show attr='title'/></r:each></r:nodes>"
|
|
94
|
-
res: "it
|
|
94
|
+
res: "it's a lake, Lake Tanganyika"
|
|
95
95
|
|
|
96
96
|
nodes_in_project_stored:
|
|
97
97
|
src: "<r:void set_foo='this'><r:node where='id = 29 in site'>from <r:show attr='title'/>, look at <r:foo do='title'/>: <r:foo do='pages in project' do='each' join=', ' do='title'/></r:node></r:void>"
|
|
@@ -289,7 +289,7 @@ projects:
|
|
|
289
289
|
|
|
290
290
|
nodes:
|
|
291
291
|
src: "<r:nodes in='project'><r:each join=', ' do='show' attr='title'/></r:nodes>"
|
|
292
|
-
res: "it
|
|
292
|
+
res: "it's a lake, Lake Tanganyika, parc opening, status title, water"
|
|
293
293
|
|
|
294
294
|
menu_with_favorites:
|
|
295
295
|
context:
|
|
@@ -348,7 +348,7 @@ where:
|
|
|
348
348
|
|
|
349
349
|
where_like:
|
|
350
350
|
src: "<r:images where='title like \"%ke\"' in='site' do='each' join=',' do='title'/>"
|
|
351
|
-
res: "it
|
|
351
|
+
res: "it's a lake"
|
|
352
352
|
|
|
353
353
|
else:
|
|
354
354
|
src: "<r:nodes where='id = 1' in='site' else='[this]' do='each' join=',' do='title'/>"
|
|
@@ -363,7 +363,7 @@ where_not:
|
|
|
363
363
|
context:
|
|
364
364
|
node: 'cleanWater'
|
|
365
365
|
src: "<r:nodes where='title ne \"status title\"' do='each' join=',' do='title'/>"
|
|
366
|
-
res: "it
|
|
366
|
+
res: "it's a lake,Lake Tanganyika,parc opening,water"
|
|
367
367
|
|
|
368
368
|
where_two_attributes:
|
|
369
369
|
src: "<r:nodes where='log_at ne event_at' in='site' do='each' join=', ' do='title'/>"
|
|
@@ -373,7 +373,7 @@ where_two_attributes:
|
|
|
373
373
|
many_or:
|
|
374
374
|
# old: or='images in site' or='tags in site'
|
|
375
375
|
src: "<r:tagged in='site or images in site or tags in site' do='each' join=',' do='title'/>"
|
|
376
|
-
res: "Art,bird,Clean Water project,flower,it
|
|
376
|
+
res: "Art,bird,Clean Water project,flower,it's a lake,News list,parc opening,Top menu"
|
|
377
377
|
|
|
378
378
|
hot_or_page:
|
|
379
379
|
context:
|
|
@@ -405,11 +405,11 @@ group_by_project_sort_zip:
|
|
|
405
405
|
context:
|
|
406
406
|
visitor: ant
|
|
407
407
|
src: "<r:images in='site' order='zip ASC' do='group' by='project' sort='id'><b do='project' do='title'/>: <r:each join=', ' do='title'/></r:images>"
|
|
408
|
-
res: "<b>Clean Water project</b>: it
|
|
408
|
+
res: "<b>Clean Water project</b>: it's a lake<b>a wiki with Zena</b>: bird, flower<b>Zena the wild CMS</b>: Autumn Tree"
|
|
409
409
|
|
|
410
410
|
group_by_parent_sort:
|
|
411
411
|
src: "<r:images in='site' order='title ASC' do='group' by='parent' sort='title'><b do='parent' do='title'/>: <r:each join=', ' do='title'/></r:images>"
|
|
412
|
-
res: "<b>a wiki with Zena</b>: bird, flower<b>Clean Water project</b>: it
|
|
412
|
+
res: "<b>a wiki with Zena</b>: bird, flower<b>Clean Water project</b>: it's a lake"
|
|
413
413
|
|
|
414
414
|
nodes_in_site_group_by_year:
|
|
415
415
|
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>"
|
|
@@ -96,7 +96,7 @@ map_join:
|
|
|
96
96
|
node: 'cleanWater'
|
|
97
97
|
src: "<r:children do='map(\"title\").join(\",\")'/>"
|
|
98
98
|
tem: "/var1.map\{\|_map_obj\| _map_obj.prop\['title'\]\}/"
|
|
99
|
-
res: "crocodiles,it
|
|
99
|
+
res: "crocodiles,it's a lake,The lake we love,parc opening,status title,water"
|
|
100
100
|
|
|
101
101
|
sum:
|
|
102
102
|
context:
|
|
@@ -145,7 +145,12 @@ range:
|
|
|
145
145
|
x: 4
|
|
146
146
|
src: "<r:void do='(0..params[:x].to_i).to_a'><span do='each' join=' ' do='this'/></r:void>"
|
|
147
147
|
res: '<span>0</span> <span>1</span> <span>2</span> <span>3</span> <span>4</span>'
|
|
148
|
-
|
|
148
|
+
|
|
149
|
+
range_literal:
|
|
150
|
+
src: "<r:void do='(0..4).to_a'><span do='each' join=' ' do='this'/></r:void>"
|
|
151
|
+
tem: '/\(0..4\)/'
|
|
152
|
+
res: '<span>0</span> <span>1</span> <span>2</span> <span>3</span> <span>4</span>'
|
|
153
|
+
|
|
149
154
|
hash_to_params:
|
|
150
155
|
context:
|
|
151
156
|
q:
|
|
@@ -187,10 +187,19 @@ encode_params:
|
|
|
187
187
|
b: 'Bee'
|
|
188
188
|
c: 'Sea'
|
|
189
189
|
x: ''
|
|
190
|
-
src: "<r:link encode_params='a,c,x,y'/>"
|
|
191
|
-
tem: "/:encode_params => \"a,c,x,y\"/"
|
|
190
|
+
src: "<r:link encode_params='a,c,x,y,mode'/>"
|
|
191
|
+
tem: "/:encode_params => \"a,c,x,y,mode\"/"
|
|
192
192
|
res: "/page22\.html\?a%5Bb%5D=Bee&c=Sea'/"
|
|
193
193
|
|
|
194
|
+
encode_params_mode:
|
|
195
|
+
context:
|
|
196
|
+
mode: 'print'
|
|
197
|
+
a: 'Sea'
|
|
198
|
+
b: ''
|
|
199
|
+
src: "<r:link encode_params='a,b,mode'/>"
|
|
200
|
+
tem: "/:encode_params => \"a,b,mode\"/"
|
|
201
|
+
res: "/page22_print\.html\?a=Sea'/"
|
|
202
|
+
|
|
194
203
|
title_link_mode:
|
|
195
204
|
old_src: "<h2 do='title' link='details'/>"
|
|
196
205
|
src: "<h2 do='link' mode='details' do='title' live='true'/>"
|
|
@@ -264,7 +273,19 @@ target_blank:
|
|
|
264
273
|
|
|
265
274
|
action_destroy:
|
|
266
275
|
src: "<r:link action='destroy'/>"
|
|
267
|
-
res: "<a data-confirm='Destroy status title ?' href='/nodes/22' onclick='return Zena.m(this,\"delete\")'>status title</a>"
|
|
276
|
+
res: "<a data-confirm='Destroy \"status title\" ?' href='/nodes/22' onclick='return Zena.m(this,\"delete\")'>status title</a>"
|
|
277
|
+
|
|
278
|
+
action_destroy_message_apos:
|
|
279
|
+
context:
|
|
280
|
+
p: "O'Hear"
|
|
281
|
+
src: "<r:link action='destroy' confirm='#{params[:p]}'/>"
|
|
282
|
+
res: "<a data-confirm='O'Hear' href='/nodes/22' onclick='return Zena.m(this,\"delete\")'>status title</a>"
|
|
283
|
+
|
|
284
|
+
action_destroy_message_apos_remote:
|
|
285
|
+
context:
|
|
286
|
+
p: "O'Hear"
|
|
287
|
+
src: "<div id='foo' do='block'></div><r:link action='destroy' confirm='#{params[:p]}' update='foo'/>"
|
|
288
|
+
res: "/confirm\(this.getAttribute\(.data-confirm.\)\)/"
|
|
268
289
|
|
|
269
290
|
action_publish:
|
|
270
291
|
src: "<r:link action='publish'/>"
|
|
@@ -125,4 +125,12 @@ target:
|
|
|
125
125
|
src: |
|
|
126
126
|
<r:zazen text='"":12' target="foobar"/>
|
|
127
127
|
tem: /:target => "foobar"/
|
|
128
|
-
res: /<div class='zazen'><p><a .* target=\"foobar\"/
|
|
128
|
+
res: /<div class='zazen'><p><a .* target=\"foobar\"/
|
|
129
|
+
|
|
130
|
+
notextile_not_auth:
|
|
131
|
+
src: "<r:zazen text='<notextile>hello</notextile>'/>"
|
|
132
|
+
res: "<div class='zazen'></div>"
|
|
133
|
+
|
|
134
|
+
notextile_auth:
|
|
135
|
+
src: "<r:zazen notextile='true' text='<notextile>hello\nblah\nblah</notextile>'/>"
|
|
136
|
+
res: "<div class='zazen'>hello\nblah\nblah</div>"
|
|
@@ -4,11 +4,12 @@ verify_element_not_present 'destroy_destroy1'
|
|
|
4
4
|
|
|
5
5
|
click 'css=img[alt=add]'
|
|
6
6
|
type 'destroy_list1_title', 'destroy1'
|
|
7
|
+
type 'destroy_list1_summary', 'destroy1'
|
|
7
8
|
click 'css=input[type=submit]'
|
|
8
9
|
wait_for_element_present 'destroy_destroy1'
|
|
9
10
|
|
|
10
11
|
click 'css=#destroy_destroy1 a'
|
|
11
|
-
assert_confirmation 'Destroy destroy1 ?'
|
|
12
|
+
assert_confirmation 'Destroy "destroy1" ?'
|
|
12
13
|
wait_for_element_not_present 'destroy_destroy1'
|
|
13
14
|
|
|
14
15
|
# Reload
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Add first element
|
|
2
|
+
open '/oo/testnode37.html?test=destroy1'
|
|
3
|
+
verify_element_not_present 'destroy_destroy2'
|
|
4
|
+
|
|
5
|
+
click 'css=img[alt=add]'
|
|
6
|
+
type 'destroy_list1_title', "rock'n rol\"l"
|
|
7
|
+
type 'destroy_list1_summary', 'destroy2'
|
|
8
|
+
click 'css=input[type=submit]'
|
|
9
|
+
wait_for_element_present 'destroy_destroy2'
|
|
10
|
+
|
|
11
|
+
click 'css=#destroy_destroy2 a'
|
|
12
|
+
assert_confirmation 'Destroy "rock\'n rol"l" ?'
|
|
13
|
+
wait_for_element_not_present 'destroy_destroy2'
|
|
14
|
+
|
|
15
|
+
# Reload
|
|
16
|
+
open '/oo/testnode37.html?test=destroy2'
|
|
17
|
+
verify_element_not_present 'destroy_destroy2'
|
data/test/unit/document_test.rb
CHANGED
|
@@ -7,19 +7,32 @@ class DocumentTest < Zena::Unit::TestCase
|
|
|
7
7
|
should 'return self on unknown content_type' do
|
|
8
8
|
class Dummy < Document
|
|
9
9
|
end
|
|
10
|
-
assert_equal Dummy, Dummy.document_class_from_content_type('zorglub')
|
|
10
|
+
assert_equal 'DocumentTest::Dummy', Dummy.document_class_from_content_type('zorglub').to_s
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
should 'return Image on image types' do
|
|
14
|
-
assert_equal Image, Document.document_class_from_content_type('image/png')
|
|
14
|
+
assert_equal 'Image', Document.document_class_from_content_type('image/png').to_s
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
should 'not return Image on svg' do
|
|
18
|
-
assert_equal TextDocument, Document.document_class_from_content_type('image/svg+xml')
|
|
18
|
+
assert_equal 'TextDocument', Document.document_class_from_content_type('image/svg+xml').to_s
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
should 'return TextDocument on nil' do
|
|
22
|
-
assert_equal TextDocument, Document.document_class_from_content_type(nil)
|
|
22
|
+
assert_equal 'TextDocument', Document.document_class_from_content_type(nil).to_s
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
should 'return matching content_type sub-class' do
|
|
26
|
+
login(:lion)
|
|
27
|
+
secure(VirtualClass) {
|
|
28
|
+
VirtualClass.create(
|
|
29
|
+
:superclass => 'TextDocument',
|
|
30
|
+
:name => 'HtmlDoc',
|
|
31
|
+
:create_group_id => groups_id(:public),
|
|
32
|
+
:content_type => 'text/html'
|
|
33
|
+
)}
|
|
34
|
+
assert_equal VirtualClass['HtmlDoc'], Document.document_class_from_content_type('text/html')
|
|
35
|
+
assert_equal VirtualClass['TextDocument'], Document.document_class_from_content_type('text/plain')
|
|
23
36
|
end
|
|
24
37
|
end
|
|
25
38
|
|
|
@@ -572,22 +572,33 @@ class RelationProxyTest < Zena::Unit::TestCase
|
|
|
572
572
|
subject do
|
|
573
573
|
node = secure(Node) { nodes(:cleanWater)}
|
|
574
574
|
end
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
|
|
576
|
+
should 'update with string list of ids' do
|
|
577
577
|
login(:lion)
|
|
578
578
|
node = secure(Node) { nodes(:cleanWater)}
|
|
579
579
|
assert_difference('Link.count', 3) do
|
|
580
|
-
node.update_attributes_with_transformation('reference_ids' => [:art, :menu, :bird_jpg].map {|s| nodes_zip(s)})
|
|
580
|
+
node.update_attributes_with_transformation('reference_ids' => [:art, :menu, :bird_jpg].map {|s| nodes_zip(s)}.join(', '))
|
|
581
581
|
end
|
|
582
582
|
end
|
|
583
|
+
|
|
584
|
+
context 'updating' do
|
|
583
585
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
586
|
+
setup do
|
|
587
|
+
login(:lion)
|
|
588
|
+
node = secure(Node) { nodes(:cleanWater)}
|
|
589
|
+
assert_difference('Link.count', 3) do
|
|
590
|
+
node.update_attributes_with_transformation('reference_ids' => [:art, :menu, :bird_jpg].map {|s| nodes_zip(s)})
|
|
591
|
+
end
|
|
588
592
|
end
|
|
589
593
|
|
|
590
|
-
|
|
594
|
+
should 'use other_id to update status' do
|
|
595
|
+
assert_difference('Link.count', 0) do
|
|
596
|
+
assert subject.update_attributes_with_transformation('rel' => {'reference' => {'other_id' => nodes_zip(:art), :status => 100}})
|
|
597
|
+
err subject
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
assert_equal 100, subject.find(:first, 'reference where l_status = 100').l_status
|
|
601
|
+
end
|
|
591
602
|
end
|
|
592
603
|
end # With many links
|
|
593
604
|
end
|
|
@@ -12,7 +12,7 @@ class StringHashTest < Test::Unit::TestCase
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
should 'convert to json' do
|
|
15
|
-
assert_match %r{"json_class":"StringHash"
|
|
15
|
+
assert_match %r{"json_class":"StringHash","data":\{"b":"2","a":"1"|"a":"1","b":"2"\}|"data":\{"b":"2","a":"1"|"a":"1","b":"2"\},"json_class":"StringHash"}, subject.to_json
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
should 'create from json' do
|
data/test/unit/template_test.rb
CHANGED
|
@@ -123,7 +123,7 @@ class TemplateTest < Zena::Unit::TestCase
|
|
|
123
123
|
|
|
124
124
|
context 'with a blank title' do
|
|
125
125
|
subject do
|
|
126
|
-
secure(Template) { Template.create(:parent_id=>nodes_id(:default), :target_klass => 'Section') }
|
|
126
|
+
secure(Template) { Template.create(:parent_id => nodes_id(:default), :target_klass => 'Section') }
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
should 'use target_klass as title' do
|
|
@@ -198,9 +198,9 @@ class TemplateTest < Zena::Unit::TestCase
|
|
|
198
198
|
secure!(Document) { Document.create(:parent_id => nodes_id(:default), :title => 'sub.html')}
|
|
199
199
|
end
|
|
200
200
|
|
|
201
|
-
should 'create a
|
|
201
|
+
should 'create a TextDocument' do
|
|
202
202
|
assert !subject.new_record?
|
|
203
|
-
assert_kind_of
|
|
203
|
+
assert_kind_of TextDocument, subject
|
|
204
204
|
end
|
|
205
205
|
end # with an html extension
|
|
206
206
|
|
|
@@ -60,6 +60,17 @@ class VirtualClassTest < Zena::Unit::TestCase
|
|
|
60
60
|
assert !classes_for_form.include?("Page")
|
|
61
61
|
assert !classes_for_form.include?("Reference")
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
def test_sub_classes
|
|
65
|
+
# add a sub class
|
|
66
|
+
login(:lion)
|
|
67
|
+
vclass = VirtualClass.create(:superclass => 'Post', :name => 'Super', :create_group_id => groups_id(:public))
|
|
68
|
+
assert !vclass.new_record?
|
|
69
|
+
|
|
70
|
+
login(:anon)
|
|
71
|
+
|
|
72
|
+
assert_equal %w{Post Super}, VirtualClass['Post'].sub_classes.map(&:name)
|
|
73
|
+
end
|
|
63
74
|
|
|
64
75
|
def test_post_classes_for_form_opt
|
|
65
76
|
# add a sub class
|
|
@@ -808,8 +819,74 @@ class VirtualClassTest < Zena::Unit::TestCase
|
|
|
808
819
|
should 'consider role methods as safe' do
|
|
809
820
|
assert_equal Hash[:class=>String, :method=>"prop['assigned']", :nil=>true], subject.safe_method_type(['assigned'])
|
|
810
821
|
end
|
|
822
|
+
|
|
823
|
+
# with content_type
|
|
824
|
+
#
|
|
811
825
|
end # A virtual class
|
|
826
|
+
|
|
827
|
+
context 'Creating a virtual class' do
|
|
828
|
+
context 'with an admin visitor' do
|
|
829
|
+
setup do
|
|
830
|
+
login(:lion)
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
context 'with content_type' do
|
|
834
|
+
subject do
|
|
835
|
+
{
|
|
836
|
+
:superclass => 'Document',
|
|
837
|
+
:name => 'HtmlDoc',
|
|
838
|
+
:create_group_id => groups_id(:public),
|
|
839
|
+
:content_type => 'text/html'}
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
should 'save and create regexp' do
|
|
843
|
+
v = secure(VirtualClass) { VirtualClass.new(subject) }
|
|
844
|
+
assert v.save
|
|
845
|
+
assert_equal %r{^text/html$}, v.content_type_re
|
|
846
|
+
end
|
|
847
|
+
|
|
848
|
+
should 'add an error on bad content_type' do
|
|
849
|
+
v = secure(VirtualClass) { VirtualClass.new(subject.merge(:content_type => '(')) }
|
|
850
|
+
assert !v.save
|
|
851
|
+
assert_equal 'invalid characters', v.errors[:content_type]
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
end
|
|
855
|
+
end
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
context 'A Virtual class' do
|
|
859
|
+
context 'subclass of Document with content_type' do
|
|
860
|
+
setup do
|
|
861
|
+
login(:lion)
|
|
862
|
+
end
|
|
863
|
+
|
|
864
|
+
context 'with content_type' do
|
|
865
|
+
subject do
|
|
866
|
+
secure(VirtualClass) {
|
|
867
|
+
VirtualClass.create(
|
|
868
|
+
:superclass => 'TextDocument',
|
|
869
|
+
:name => 'HtmlDoc',
|
|
870
|
+
:create_group_id => groups_id(:public),
|
|
871
|
+
:content_type => 'text/html'
|
|
872
|
+
)}
|
|
873
|
+
end
|
|
812
874
|
|
|
875
|
+
should 'be used to create matching content_type documents' do
|
|
876
|
+
klass = subject
|
|
877
|
+
n = secure!(Document) { Document.create(
|
|
878
|
+
:parent_id => nodes_id(:cleanWater),
|
|
879
|
+
:content_type => 'text/html',
|
|
880
|
+
:file => uploaded_text('some.txt'))
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
assert !n.new_record?
|
|
884
|
+
assert_equal subject.name, n.klass
|
|
885
|
+
end
|
|
886
|
+
end
|
|
887
|
+
end
|
|
888
|
+
end
|
|
889
|
+
|
|
813
890
|
context 'A visitor with write access' do
|
|
814
891
|
setup do
|
|
815
892
|
login(:tiger)
|
|
@@ -53,6 +53,14 @@ class UrlsTest < Zena::View::TestCase
|
|
|
53
53
|
assert_equal '/en/projects-list/Clean-Water-project/page22.html?a%5Bb%5D=Bee&p=Pepe', zen_path(node, :encode_params => 'p,a')
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def test_zen_path_query_params_array
|
|
57
|
+
login(:anon)
|
|
58
|
+
node = secure!(Node) { nodes(:status) }
|
|
59
|
+
assert_equal '/en/projects-list/Clean-Water-project/page22.html?p=5', zen_path(node, :p => 5)
|
|
60
|
+
@params = {'p' => 'Pepe', 'b' => ['','bee','c','','dee']}
|
|
61
|
+
assert_equal '/en/projects-list/Clean-Water-project/page22.html?b%5B%5D=bee&b%5B%5D=c&b%5B%5D=dee&p=Pepe', zen_path(node, :encode_params => 'p,b')
|
|
62
|
+
end
|
|
63
|
+
|
|
56
64
|
def test_zen_path_cache_stamp
|
|
57
65
|
login(:ant)
|
|
58
66
|
node = secure!(Node) { nodes(:zena) }
|
|
@@ -127,7 +135,7 @@ class UrlsTest < Zena::View::TestCase
|
|
|
127
135
|
end
|
|
128
136
|
|
|
129
137
|
def test_data_path_for_public_documents
|
|
130
|
-
login(:
|
|
138
|
+
login(:lion)
|
|
131
139
|
node = secure!(Node) { nodes(:water_pdf) }
|
|
132
140
|
assert_equal "/en/projects-list/Clean-Water-project/document25.pdf", data_path(node)
|
|
133
141
|
node = secure!(Node) { nodes(:status) }
|
data/zena.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{zena}
|
|
8
|
-
s.version = "1.2.
|
|
8
|
+
s.version = "1.2.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Gaspard Bucher"]
|
|
12
|
-
s.date = %q{2013-
|
|
12
|
+
s.date = %q{2013-06-13}
|
|
13
13
|
s.default_executable = %q{zena}
|
|
14
14
|
s.description = %q{zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour).}
|
|
15
15
|
s.email = %q{gaspard@teti.ch}
|
|
@@ -68,6 +68,7 @@ Gem::Specification.new do |s|
|
|
|
68
68
|
"app/models/group.rb",
|
|
69
69
|
"app/models/idx_nodes_datetime.rb",
|
|
70
70
|
"app/models/idx_nodes_float.rb",
|
|
71
|
+
"app/models/idx_nodes_integer.rb",
|
|
71
72
|
"app/models/idx_nodes_ml_string.rb",
|
|
72
73
|
"app/models/idx_nodes_string.rb",
|
|
73
74
|
"app/models/idx_project.rb",
|
|
@@ -285,6 +286,8 @@ Gem::Specification.new do |s|
|
|
|
285
286
|
"bricks/acls/zena/init.rb",
|
|
286
287
|
"bricks/acls/zena/migrate/20110509141600_create_acls.rb",
|
|
287
288
|
"bricks/acls/zena/migrate/20110627193757_add_allowed_mode_and_format_to_acl.rb",
|
|
289
|
+
"bricks/acls/zena/migrate/20130313110443_add_create_kpath_to_acl.rb",
|
|
290
|
+
"bricks/acls/zena/migrate/20130429073432_fix_create_kpath_default.rb",
|
|
288
291
|
"bricks/acls/zena/test/integration/acl_integration_test.rb",
|
|
289
292
|
"bricks/acls/zena/test/sites/erebus/acls.yml",
|
|
290
293
|
"bricks/acls/zena/test/sites/erebus/groups.yml",
|
|
@@ -2011,6 +2014,7 @@ Gem::Specification.new do |s|
|
|
|
2011
2014
|
"test/selenium/Add/add3.rsel",
|
|
2012
2015
|
"test/selenium/Destroy/0setup.rsel",
|
|
2013
2016
|
"test/selenium/Destroy/destroy1.rsel",
|
|
2017
|
+
"test/selenium/Destroy/destroy2.rsel",
|
|
2014
2018
|
"test/selenium/Drop/0setup.rsel",
|
|
2015
2019
|
"test/selenium/Drop/drop1.rsel",
|
|
2016
2020
|
"test/selenium/Drop/drop2.rsel",
|
|
@@ -2473,84 +2477,87 @@ Gem::Specification.new do |s|
|
|
|
2473
2477
|
s.specification_version = 3
|
|
2474
2478
|
|
|
2475
2479
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
2476
|
-
s.add_runtime_dependency(%q<
|
|
2477
|
-
s.add_runtime_dependency(%q<differ>, ["= 0.1.2"])
|
|
2480
|
+
s.add_runtime_dependency(%q<tzinfo>, [">= 0"])
|
|
2478
2481
|
s.add_runtime_dependency(%q<fast_gettext>, ["~> 0.4.16"])
|
|
2479
|
-
s.add_runtime_dependency(%q<
|
|
2480
|
-
s.add_runtime_dependency(%q<open4>, [">= 0"])
|
|
2481
|
-
s.add_runtime_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2482
|
-
s.add_runtime_dependency(%q<querybuilder>, ["= 1.2.1"])
|
|
2482
|
+
s.add_runtime_dependency(%q<rubyless>, ["= 0.8.10"])
|
|
2483
2483
|
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
|
2484
|
-
s.add_runtime_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2485
2484
|
s.add_runtime_dependency(%q<json>, ["= 1.5.1"])
|
|
2485
|
+
s.add_runtime_dependency(%q<shoulda>, ["= 2.10.3"])
|
|
2486
|
+
s.add_runtime_dependency(%q<httmultiparty>, ["= 0.3.8"])
|
|
2487
|
+
s.add_runtime_dependency(%q<gem_plugin>, [">= 0"])
|
|
2486
2488
|
s.add_runtime_dependency(%q<daemons>, [">= 0"])
|
|
2487
|
-
s.add_runtime_dependency(%q<
|
|
2488
|
-
s.add_runtime_dependency(%q<
|
|
2489
|
-
s.add_runtime_dependency(%q<
|
|
2489
|
+
s.add_runtime_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2490
|
+
s.add_runtime_dependency(%q<open4>, [">= 0"])
|
|
2491
|
+
s.add_runtime_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2492
|
+
s.add_runtime_dependency(%q<safe_yaml>, ["= 0.8.0"])
|
|
2493
|
+
s.add_runtime_dependency(%q<rails>, ["= 2.3.18"])
|
|
2490
2494
|
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
|
|
2491
|
-
s.add_runtime_dependency(%q<
|
|
2492
|
-
s.add_runtime_dependency(%q<
|
|
2493
|
-
s.add_runtime_dependency(%q<
|
|
2494
|
-
s.add_runtime_dependency(%q<gem_plugin>, [">= 0"])
|
|
2495
|
-
s.add_runtime_dependency(%q<rubyless>, ["= 0.8.8"])
|
|
2496
|
-
s.add_runtime_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2495
|
+
s.add_runtime_dependency(%q<querybuilder>, ["= 1.2.2"])
|
|
2496
|
+
s.add_runtime_dependency(%q<simple_xlsx_writer>, [">= 0"])
|
|
2497
|
+
s.add_runtime_dependency(%q<property>, ["= 2.3.2"])
|
|
2497
2498
|
s.add_runtime_dependency(%q<uuidtools>, ["= 2.0.0"])
|
|
2499
|
+
s.add_runtime_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2498
2500
|
s.add_runtime_dependency(%q<will_paginate>, ["~> 2.3.12"])
|
|
2499
|
-
s.add_runtime_dependency(%q<
|
|
2501
|
+
s.add_runtime_dependency(%q<ruby-recaptcha>, ["= 1.0.3"])
|
|
2500
2502
|
s.add_runtime_dependency(%q<RedCloth>, ["= 3.0.4"])
|
|
2503
|
+
s.add_runtime_dependency(%q<versions>, ["= 0.3.1"])
|
|
2504
|
+
s.add_runtime_dependency(%q<differ>, ["= 0.1.2"])
|
|
2505
|
+
s.add_runtime_dependency(%q<gettext>, ["= 2.1.0"])
|
|
2501
2506
|
else
|
|
2502
|
-
s.add_dependency(%q<
|
|
2503
|
-
s.add_dependency(%q<differ>, ["= 0.1.2"])
|
|
2507
|
+
s.add_dependency(%q<tzinfo>, [">= 0"])
|
|
2504
2508
|
s.add_dependency(%q<fast_gettext>, ["~> 0.4.16"])
|
|
2505
|
-
s.add_dependency(%q<
|
|
2506
|
-
s.add_dependency(%q<open4>, [">= 0"])
|
|
2507
|
-
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2508
|
-
s.add_dependency(%q<querybuilder>, ["= 1.2.1"])
|
|
2509
|
+
s.add_dependency(%q<rubyless>, ["= 0.8.10"])
|
|
2509
2510
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
2510
|
-
s.add_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2511
2511
|
s.add_dependency(%q<json>, ["= 1.5.1"])
|
|
2512
|
+
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
|
2513
|
+
s.add_dependency(%q<httmultiparty>, ["= 0.3.8"])
|
|
2514
|
+
s.add_dependency(%q<gem_plugin>, [">= 0"])
|
|
2512
2515
|
s.add_dependency(%q<daemons>, [">= 0"])
|
|
2513
|
-
s.add_dependency(%q<
|
|
2514
|
-
s.add_dependency(%q<
|
|
2515
|
-
s.add_dependency(%q<
|
|
2516
|
+
s.add_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2517
|
+
s.add_dependency(%q<open4>, [">= 0"])
|
|
2518
|
+
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2519
|
+
s.add_dependency(%q<safe_yaml>, ["= 0.8.0"])
|
|
2520
|
+
s.add_dependency(%q<rails>, ["= 2.3.18"])
|
|
2516
2521
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
|
2517
|
-
s.add_dependency(%q<
|
|
2518
|
-
s.add_dependency(%q<
|
|
2519
|
-
s.add_dependency(%q<
|
|
2520
|
-
s.add_dependency(%q<gem_plugin>, [">= 0"])
|
|
2521
|
-
s.add_dependency(%q<rubyless>, ["= 0.8.8"])
|
|
2522
|
-
s.add_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2522
|
+
s.add_dependency(%q<querybuilder>, ["= 1.2.2"])
|
|
2523
|
+
s.add_dependency(%q<simple_xlsx_writer>, [">= 0"])
|
|
2524
|
+
s.add_dependency(%q<property>, ["= 2.3.2"])
|
|
2523
2525
|
s.add_dependency(%q<uuidtools>, ["= 2.0.0"])
|
|
2526
|
+
s.add_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2524
2527
|
s.add_dependency(%q<will_paginate>, ["~> 2.3.12"])
|
|
2525
|
-
s.add_dependency(%q<
|
|
2528
|
+
s.add_dependency(%q<ruby-recaptcha>, ["= 1.0.3"])
|
|
2526
2529
|
s.add_dependency(%q<RedCloth>, ["= 3.0.4"])
|
|
2530
|
+
s.add_dependency(%q<versions>, ["= 0.3.1"])
|
|
2531
|
+
s.add_dependency(%q<differ>, ["= 0.1.2"])
|
|
2532
|
+
s.add_dependency(%q<gettext>, ["= 2.1.0"])
|
|
2527
2533
|
end
|
|
2528
2534
|
else
|
|
2529
|
-
s.add_dependency(%q<
|
|
2530
|
-
s.add_dependency(%q<differ>, ["= 0.1.2"])
|
|
2535
|
+
s.add_dependency(%q<tzinfo>, [">= 0"])
|
|
2531
2536
|
s.add_dependency(%q<fast_gettext>, ["~> 0.4.16"])
|
|
2532
|
-
s.add_dependency(%q<
|
|
2533
|
-
s.add_dependency(%q<open4>, [">= 0"])
|
|
2534
|
-
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2535
|
-
s.add_dependency(%q<querybuilder>, ["= 1.2.1"])
|
|
2537
|
+
s.add_dependency(%q<rubyless>, ["= 0.8.10"])
|
|
2536
2538
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
2537
|
-
s.add_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2538
2539
|
s.add_dependency(%q<json>, ["= 1.5.1"])
|
|
2540
|
+
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
|
2541
|
+
s.add_dependency(%q<httmultiparty>, ["= 0.3.8"])
|
|
2542
|
+
s.add_dependency(%q<gem_plugin>, [">= 0"])
|
|
2539
2543
|
s.add_dependency(%q<daemons>, [">= 0"])
|
|
2540
|
-
s.add_dependency(%q<
|
|
2541
|
-
s.add_dependency(%q<
|
|
2542
|
-
s.add_dependency(%q<
|
|
2544
|
+
s.add_dependency(%q<yamltest>, ["= 0.7.0"])
|
|
2545
|
+
s.add_dependency(%q<open4>, [">= 0"])
|
|
2546
|
+
s.add_dependency(%q<authlogic>, ["= 2.1.3"])
|
|
2547
|
+
s.add_dependency(%q<safe_yaml>, ["= 0.8.0"])
|
|
2548
|
+
s.add_dependency(%q<rails>, ["= 2.3.18"])
|
|
2543
2549
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
|
2544
|
-
s.add_dependency(%q<
|
|
2545
|
-
s.add_dependency(%q<
|
|
2546
|
-
s.add_dependency(%q<
|
|
2547
|
-
s.add_dependency(%q<gem_plugin>, [">= 0"])
|
|
2548
|
-
s.add_dependency(%q<rubyless>, ["= 0.8.8"])
|
|
2549
|
-
s.add_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2550
|
+
s.add_dependency(%q<querybuilder>, ["= 1.2.2"])
|
|
2551
|
+
s.add_dependency(%q<simple_xlsx_writer>, [">= 0"])
|
|
2552
|
+
s.add_dependency(%q<property>, ["= 2.3.2"])
|
|
2550
2553
|
s.add_dependency(%q<uuidtools>, ["= 2.0.0"])
|
|
2554
|
+
s.add_dependency(%q<syntax>, ["= 1.0.0"])
|
|
2551
2555
|
s.add_dependency(%q<will_paginate>, ["~> 2.3.12"])
|
|
2552
|
-
s.add_dependency(%q<
|
|
2556
|
+
s.add_dependency(%q<ruby-recaptcha>, ["= 1.0.3"])
|
|
2553
2557
|
s.add_dependency(%q<RedCloth>, ["= 3.0.4"])
|
|
2558
|
+
s.add_dependency(%q<versions>, ["= 0.3.1"])
|
|
2559
|
+
s.add_dependency(%q<differ>, ["= 0.1.2"])
|
|
2560
|
+
s.add_dependency(%q<gettext>, ["= 2.1.0"])
|
|
2554
2561
|
end
|
|
2555
2562
|
end
|
|
2556
2563
|
|