caterpillar 0.9.16 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +9 -1
- data/README +36 -6
- data/generators/caterpillar/USAGE +1 -1
- data/generators/caterpillar/caterpillar_generator.rb +44 -25
- data/generators/caterpillar/templates/config/portlets.rb +5 -5
- data/generators/caterpillar/templates/images/portlet_test_bench/Leafy_Sea_Dragon_1.jpg +0 -0
- data/generators/caterpillar/templates/images/portlet_test_bench/debug.jpg +0 -0
- data/generators/caterpillar/templates/images/portlet_test_bench/java.png +0 -0
- data/generators/caterpillar/templates/images/portlet_test_bench/rails.png +0 -0
- data/generators/caterpillar/templates/images/portlet_test_bench/ruby.gif +0 -0
- data/generators/caterpillar/templates/javascripts/portlet_test_bench/main.js +3 -0
- data/generators/caterpillar/templates/stylesheets/portlet_test_bench/main.css +163 -0
- data/init.rb +30 -3
- data/lib/caterpillar.rb +36 -1
- data/lib/caterpillar/config.rb +12 -2
- data/lib/caterpillar/liferay.rb +70 -14
- data/lib/caterpillar/portlet.rb +9 -0
- data/lib/caterpillar/task.rb +3 -12
- data/lib/web/portlet.rb +0 -7
- data/portlet_test_bench/controllers/caterpillar/application.rb +13 -0
- data/portlet_test_bench/controllers/caterpillar/css_controller.rb +9 -0
- data/portlet_test_bench/controllers/caterpillar/http_methods_controller.rb +35 -0
- data/portlet_test_bench/controllers/caterpillar/js_controller.rb +74 -0
- data/portlet_test_bench/controllers/caterpillar/login_controller.rb +41 -0
- data/portlet_test_bench/controllers/caterpillar/resource_controller.rb +23 -0
- data/portlet_test_bench/controllers/caterpillar/session_controller.rb +57 -0
- data/portlet_test_bench/controllers/caterpillar/user_controller.rb +6 -0
- data/portlet_test_bench/helpers/caterpillar/application_helper.rb +3 -0
- data/portlet_test_bench/routing.rb +43 -0
- data/portlet_test_bench/views/caterpillar/application/_back_to_menu.html.erb +13 -0
- data/portlet_test_bench/views/caterpillar/application/index.html.erb +70 -0
- data/portlet_test_bench/views/caterpillar/css/background.html.erb +30 -0
- data/portlet_test_bench/views/caterpillar/css/simple.html.erb +53 -0
- data/portlet_test_bench/views/caterpillar/http_methods/back.html.erb +2 -0
- data/portlet_test_bench/views/caterpillar/http_methods/parameter.html.erb +21 -0
- data/portlet_test_bench/views/caterpillar/http_methods/post.html.erb +43 -0
- data/portlet_test_bench/views/caterpillar/http_methods/post_and_redirect.html.erb +25 -0
- data/portlet_test_bench/views/caterpillar/http_methods/redirect.html.erb +4 -0
- data/portlet_test_bench/views/caterpillar/js/_scriptaculous_jquery.html.erb +19 -0
- data/portlet_test_bench/views/caterpillar/js/dragndrop.html.erb +40 -0
- data/portlet_test_bench/views/caterpillar/js/jquery.html.erb +5 -0
- data/portlet_test_bench/views/caterpillar/js/link_to_post.html.erb +5 -0
- data/portlet_test_bench/views/caterpillar/js/prototype.html.erb +5 -0
- data/portlet_test_bench/views/caterpillar/js/scriptaculous.html.erb +10 -0
- data/portlet_test_bench/views/caterpillar/js/simple.html.erb +34 -0
- data/portlet_test_bench/views/caterpillar/login/index.html.erb +52 -0
- data/portlet_test_bench/views/caterpillar/resource/exit_portlet.html.erb +3 -0
- data/portlet_test_bench/views/caterpillar/resource/images.html.erb +13 -0
- data/portlet_test_bench/views/caterpillar/user/home.html.erb +3 -0
- data/portlet_test_bench/views/layouts/basic.html.erb +20 -0
- metadata +61 -3
@@ -0,0 +1,57 @@
|
|
1
|
+
class Caterpillar::SessionController < Caterpillar::ApplicationController
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
def index
|
8
|
+
render :inline => VERSION
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
# inspect the session variables
|
13
|
+
def raw
|
14
|
+
render :inline => session.inspect
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
# inspect the session cookie
|
19
|
+
def cookie
|
20
|
+
|
21
|
+
s = "<html><body><pre>"
|
22
|
+
|
23
|
+
cookies.each do |cookie|
|
24
|
+
# s += "name: " + cookie[0]
|
25
|
+
s += cookie.inspect
|
26
|
+
s += "<br />"
|
27
|
+
# s += "id: " + cookie[1].to_s
|
28
|
+
# s += "<br />"
|
29
|
+
# cookie.methods.each { |m| s += m.to_s + "<br />" }
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
s += "</pre></body></html>"
|
34
|
+
render :inline => s
|
35
|
+
end
|
36
|
+
|
37
|
+
def _id
|
38
|
+
render :inline => session.session_id.inspect
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# inspect the request variables
|
43
|
+
def req
|
44
|
+
s = "<html><body>"
|
45
|
+
|
46
|
+
request.env.each_pair do |key,value|
|
47
|
+
s += key
|
48
|
+
s += " => "
|
49
|
+
s += value unless value.nil?
|
50
|
+
s += "<br />"
|
51
|
+
end
|
52
|
+
|
53
|
+
s += "</body></html>"
|
54
|
+
render :inline => s
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Caterpillar #:nodoc:
|
2
|
+
# Routes for Portlet Test Bench.
|
3
|
+
module Routing
|
4
|
+
module MapperExtensions # :nodoc:
|
5
|
+
def caterpillar
|
6
|
+
|
7
|
+
@set.add_named_route(
|
8
|
+
'portlet_test_bench',
|
9
|
+
'caterpillar/test_bench',
|
10
|
+
{:controller => 'Caterpillar::Application'})
|
11
|
+
|
12
|
+
@set.add_route(
|
13
|
+
'caterpillar/test_bench/http_methods/:action',
|
14
|
+
{:controller => 'Caterpillar::HttpMethods'})
|
15
|
+
|
16
|
+
@set.add_route(
|
17
|
+
'caterpillar/test_bench/javascript/:action',
|
18
|
+
{:controller => 'Caterpillar::Js'})
|
19
|
+
|
20
|
+
@set.add_route(
|
21
|
+
'caterpillar/test_bench/css/:action',
|
22
|
+
{:controller => 'Caterpillar::Css'})
|
23
|
+
|
24
|
+
@set.add_route(
|
25
|
+
'caterpillar/test_bench/login/:action',
|
26
|
+
{:controller => 'Caterpillar::Login'})
|
27
|
+
|
28
|
+
@set.add_route(
|
29
|
+
'caterpillar/test_bench/resource/:action',
|
30
|
+
{:controller => 'Caterpillar::Resource'})
|
31
|
+
|
32
|
+
@set.add_route(
|
33
|
+
'caterpillar/test_bench/session/:action',
|
34
|
+
{:controller => 'Caterpillar::Session'})
|
35
|
+
|
36
|
+
@set.add_route(
|
37
|
+
'caterpillar/test_bench/user/:action',
|
38
|
+
{:controller => 'Caterpillar::User'})
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<p style="
|
2
|
+
border: 2px groove gray;
|
3
|
+
margin-top: 10px;
|
4
|
+
margin-bottom: 10px;
|
5
|
+
width: auto;
|
6
|
+
padding: 3px;
|
7
|
+
background: #FFFFFF;
|
8
|
+
overflow: hidden;
|
9
|
+
margin-left: 0px;
|
10
|
+
margin-right: 0px;
|
11
|
+
">
|
12
|
+
<%= link_to "All tests", portlet_test_bench_url -%>
|
13
|
+
</p>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
<body>
|
2
|
+
|
3
|
+
<h1>HTTP</h1>
|
4
|
+
|
5
|
+
<%= link_to 'URL parameters',
|
6
|
+
:controller => 'Caterpillar::HttpMethods', :action => :parameter -%><br />
|
7
|
+
|
8
|
+
<%= link_to 'HTTP POST form',
|
9
|
+
:controller => 'Caterpillar::HttpMethods', :action => :post -%><br />
|
10
|
+
|
11
|
+
<%= link_to 'HTTP POST and GET redirect',
|
12
|
+
:controller => 'Caterpillar::HttpMethods', :action => :post_and_redirect -%><br />
|
13
|
+
|
14
|
+
<%= link_to 'HTTP referer (back)',
|
15
|
+
:controller => 'Caterpillar::HttpMethods', :action => :back -%><br />
|
16
|
+
|
17
|
+
<%= link_to 'HTTP redirect',
|
18
|
+
:controller => 'Caterpillar::HttpMethods', :action => :redirect -%><br />
|
19
|
+
|
20
|
+
|
21
|
+
<h1>JavaScripts</h1>
|
22
|
+
|
23
|
+
<%= link_to 'Simple JavaScript',
|
24
|
+
:controller => 'Caterpillar::Js', :action => :simple -%><br />
|
25
|
+
|
26
|
+
<%= link_to 'Prototype JavaScript',
|
27
|
+
:controller => 'Caterpillar::Js', :action => :prototype -%><br />
|
28
|
+
|
29
|
+
<%= link_to 'Script.aculo.us JavaScript',
|
30
|
+
:controller => 'Caterpillar::Js', :action => :scriptaculous -%><br />
|
31
|
+
|
32
|
+
<%= link_to 'jQuery JavaScript',
|
33
|
+
:controller => 'Caterpillar::Js', :action => :jquery -%><br />
|
34
|
+
|
35
|
+
<%= link_to 'Drag and drop',
|
36
|
+
:controller => 'Caterpillar::Js', :action => :dragndrop -%><br />
|
37
|
+
|
38
|
+
<%= link_to 'link_to :method => :post',
|
39
|
+
:controller => 'Caterpillar::Js', :action => :link_to_post -%><br />
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<h1>CSS</h1>
|
44
|
+
|
45
|
+
<%= link_to 'Simple CSS',
|
46
|
+
:controller => 'Caterpillar::Css', :action => :simple -%><br />
|
47
|
+
|
48
|
+
<%= link_to 'CSS background image',
|
49
|
+
:controller => 'Caterpillar::Css', :action => :background -%><br />
|
50
|
+
|
51
|
+
|
52
|
+
<h1>Misc</h1>
|
53
|
+
|
54
|
+
<%= link_to 'Image resources',
|
55
|
+
:controller => 'Caterpillar::Resource', :action => :images -%><br />
|
56
|
+
|
57
|
+
<%= link_to 'Inline text',
|
58
|
+
:controller => 'Caterpillar::Resource', :action => :inline -%><br />
|
59
|
+
|
60
|
+
<%= link_to 'Link outside the portlet',
|
61
|
+
:controller => 'Caterpillar::Resource', :action => :exit_portlet -%><br />
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
<%#= link_to 'Login',
|
66
|
+
:controller => 'Caterpillar::Login', :action => :index -%><br />
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</body>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<head>
|
2
|
+
<title>Simple CSS test</title>
|
3
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
|
4
|
+
|
5
|
+
<%= stylesheet_link_tag 'portlet_test_bench/main' %>
|
6
|
+
|
7
|
+
<style type="text/css">
|
8
|
+
/* Leafy Sea Dragon */
|
9
|
+
|
10
|
+
#background_image {
|
11
|
+
background-image: url('/images/portlet_test_bench/Leafy_Sea_Dragon_1.jpg');
|
12
|
+
background-repeat: no-repeat;
|
13
|
+
border: 5px outset gray;
|
14
|
+
width: 297px;
|
15
|
+
height: 320px;
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<%= render :partial => 'caterpillar/application/back_to_menu' %>
|
21
|
+
|
22
|
+
<p class="info">
|
23
|
+
In the div below, the background should display a Leafy Sea Dragon, defined in the css.
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<center>
|
27
|
+
<div id="background_image"></div>
|
28
|
+
</center>
|
29
|
+
|
30
|
+
</body>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<head>
|
2
|
+
<title>Simple CSS test</title>
|
3
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
|
4
|
+
|
5
|
+
<%= stylesheet_link_tag 'portlet_test_bench/main' %>
|
6
|
+
|
7
|
+
<style type="text/css" id="style_in_head">
|
8
|
+
/* simple.html.erb */
|
9
|
+
#head_ref {
|
10
|
+
margin: 25px; padding: 10px; border: 1px solid #000000;
|
11
|
+
background: #6FFF3A;
|
12
|
+
}
|
13
|
+
</style>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<%= render :partial => 'caterpillar/application/back_to_menu' %>
|
17
|
+
|
18
|
+
<style type="text/css" id="style_in_body">
|
19
|
+
#body_ref {
|
20
|
+
margin: 25px; padding: 10px; border: 1px solid #000000;
|
21
|
+
background: #FFB751;
|
22
|
+
}
|
23
|
+
</style>
|
24
|
+
|
25
|
+
Body<br />
|
26
|
+
<b>background-color: #FFFFFCC; font: 11px Arial,Helvetica;</b>
|
27
|
+
<p class="info">
|
28
|
+
All the following divs should appear the same, with different background colors.<br />
|
29
|
+
<b>margin: 25px; padding: 10px; border: 1px solid #000000;</b>
|
30
|
+
</p>
|
31
|
+
<div style="margin: 25px; padding: 10px; border: 1px solid #000000; background: #FFFFFF;">
|
32
|
+
This is a div with self-contained style parameters. <br />
|
33
|
+
<b>background: #FFEE31;</b>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="simple_content">
|
37
|
+
This is a div with style definitions in <i>main.css</i>.<br />
|
38
|
+
<b>background: #93FFE4;</b>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="head_ref">
|
42
|
+
This is a div with style definitions in <i><head></i>.<br />
|
43
|
+
<b>background: #6FFF3A;</b>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="body_ref">
|
47
|
+
This is a div with style definitions in <i><body></i>.<br />
|
48
|
+
<b>background: #FFB751;</b>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<br />
|
52
|
+
|
53
|
+
</body>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1>URL parameters</h1>
|
2
|
+
|
3
|
+
<p style="border: 2px dashed gray; background: #FFFBB4; margin: 20px; width: 40%;">
|
4
|
+
<%= @params.inspect -%><br />
|
5
|
+
<hr />
|
6
|
+
Interpreted as:<br />
|
7
|
+
foo: <%= @params[:foo] -%><br />
|
8
|
+
count: <%= @params[:count] -%><br />
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<ul>
|
12
|
+
<li>
|
13
|
+
<%= link_to 'Send parameters "foo=bar" and "count=3"',
|
14
|
+
url_for( :action => 'parameter', :foo => 'bar', :count => 3 ) -%>
|
15
|
+
</li>
|
16
|
+
|
17
|
+
<li>
|
18
|
+
<%= link_to 'Clear parameters',
|
19
|
+
url_for( :action => 'parameter' ) -%>
|
20
|
+
</li>
|
21
|
+
</ul>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div id="http_post">
|
2
|
+
<h1>POST test</h1>
|
3
|
+
|
4
|
+
<div id="http_postform">
|
5
|
+
<%= form_tag :action => "post" %>
|
6
|
+
<p>
|
7
|
+
<span>Input text:</span>
|
8
|
+
<%= text_field_tag "msg", "The Java language was created by James Gosling in June 1991", :size => 42 %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<span>Input checkbox:</span>
|
13
|
+
<input type="checkbox" name="checkbox" value="yay" true />
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p id="submit_tags">
|
17
|
+
<input type="submit" value="Submit values" />
|
18
|
+
<input type="reset" value="Reset to defaults" />
|
19
|
+
</p>
|
20
|
+
</form>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
|
24
|
+
<h2>Message from last POST:</h2>
|
25
|
+
<span id="post_msg">
|
26
|
+
<%= @msg -%>
|
27
|
+
</span>
|
28
|
+
<br />
|
29
|
+
<span id="post_info">
|
30
|
+
<% if @checkbox -%>
|
31
|
+
Checkbox was checked
|
32
|
+
<% else -%>
|
33
|
+
<% if @checkbox == false %>
|
34
|
+
<!--
|
35
|
+
Checkbox was unchecked
|
36
|
+
-->
|
37
|
+
<% end %>
|
38
|
+
<% end -%>
|
39
|
+
</span>
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div id="http_post">
|
2
|
+
<h1>POST + GET redirect test</h1>
|
3
|
+
|
4
|
+
<div id="http_postform">
|
5
|
+
<%= form_tag :action => "post_and_redirect" %>
|
6
|
+
<p>
|
7
|
+
<span>Input text:</span>
|
8
|
+
<%= text_field_tag "msg", "try me", :size => 42 %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p id="submit_tags">
|
12
|
+
<input type="submit" value="Submit values" />
|
13
|
+
</p>
|
14
|
+
</form>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
|
18
|
+
<h2>Message from last POST:</h2>
|
19
|
+
<span id="post_msg">
|
20
|
+
<%= @msg -%>
|
21
|
+
</span>
|
22
|
+
<br />
|
23
|
+
|
24
|
+
|
25
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div id="highlight_test">
|
2
|
+
<%= link_to_remote("Highlight test", :url => { :action => 'highlight_test' }) -%>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div>
|
6
|
+
<%= link_to_remote("Appear test", :url => { :action => 'appear_test' }) -%>
|
7
|
+
<div id="appear_test" style="display: none;">
|
8
|
+
Appear works
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
|
13
|
+
<div>
|
14
|
+
<%= link_to_remote("Toggle test", :url => { :action => 'toggle_blind_test' }) -%>
|
15
|
+
<div id="toggle_blind_test" style="display: none;">
|
16
|
+
Toggle works
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<h1>Drag and drop test</h1>
|
2
|
+
|
3
|
+
|
4
|
+
<div id="draggables" class="dragdrop">
|
5
|
+
<span class="dragdrop_id">Draggables</span>
|
6
|
+
<div id="java">
|
7
|
+
<%= image_tag 'portlet_test_bench/java.png', :id => :java_handle, :class => :draggable -%>
|
8
|
+
</div>
|
9
|
+
<%= image_tag 'portlet_test_bench/ruby.gif', :id => :ruby, :class => :draggable -%>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<%= draggable_element :java, :revert => true, :handle => "'java_handle'" -%>
|
13
|
+
<%= draggable_element 'ruby', :revert => true -%>
|
14
|
+
|
15
|
+
|
16
|
+
<div id="droppables" class="dragdrop">
|
17
|
+
<span class="dragdrop_id">Droppables</span>
|
18
|
+
<span id="drop_status" style="display: none;"></span>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
|
22
|
+
<%#= drop_receiving_element( :droppables, :hoverclass => 'hover', :accept => 'draggable',
|
23
|
+
:onHover => "function(draggable, droppable, overlap){
|
24
|
+
$('hover_notice').update('you drag');
|
25
|
+
}"
|
26
|
+
) -%>
|
27
|
+
|
28
|
+
<%#= drop_receiving_element( :droppables, :hoverclass => 'hover',
|
29
|
+
:onHover => "function(){ $('hover_notice').update('Hovering!'); }"
|
30
|
+
) -%>
|
31
|
+
|
32
|
+
<%#= drop_receiving_element( :droppables, :onHover => "function(){ alert('Hovering!'); }") -%>
|
33
|
+
|
34
|
+
<%= drop_receiving_element( :droppables, :url => { :action => :receive_drop }) -%>
|
35
|
+
|
36
|
+
<%#= javascript_tag "Droppables.add('droppables'){onHover:function(){ alert('Hovering!'); }}" %>
|
37
|
+
|
38
|
+
|
39
|
+
<span id="hover_notice"></span>
|
40
|
+
|