ruote-kit 2.1.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.
Files changed (73) hide show
  1. data/.document +0 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +10 -0
  4. data/README.rdoc +132 -0
  5. data/Rakefile +57 -0
  6. data/config.ru +21 -0
  7. data/lib/ruote-kit/application.rb +50 -0
  8. data/lib/ruote-kit/configuration.rb +52 -0
  9. data/lib/ruote-kit/helpers/engine_helpers.rb +24 -0
  10. data/lib/ruote-kit/helpers/form_helpers.rb +11 -0
  11. data/lib/ruote-kit/helpers/launch_item_parser.rb +59 -0
  12. data/lib/ruote-kit/helpers/navigation_helpers.rb +54 -0
  13. data/lib/ruote-kit/helpers/render_helpers.rb +103 -0
  14. data/lib/ruote-kit/helpers.rb +9 -0
  15. data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
  16. data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
  17. data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
  18. data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
  19. data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
  20. data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +191 -0
  21. data/lib/ruote-kit/public/_ruote/javascripts/fluo-can.js +1111 -0
  22. data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +149 -0
  23. data/lib/ruote-kit/public/_ruote/javascripts/fluo-json.js +183 -0
  24. data/lib/ruote-kit/public/_ruote/javascripts/fluo-tred.js +515 -0
  25. data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +226 -0
  26. data/lib/ruote-kit/public/_ruote/stylesheets/base.css +336 -0
  27. data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +30 -0
  28. data/lib/ruote-kit/public/_ruote/stylesheets/style.css +393 -0
  29. data/lib/ruote-kit/resources/expressions.rb +55 -0
  30. data/lib/ruote-kit/resources/processes.rb +52 -0
  31. data/lib/ruote-kit/resources/workitems.rb +64 -0
  32. data/lib/ruote-kit/spec/ruote_helpers.rb +47 -0
  33. data/lib/ruote-kit/vendor/sinatra-respond_to/LICENSE +21 -0
  34. data/lib/ruote-kit/vendor/sinatra-respond_to/README.markdown +102 -0
  35. data/lib/ruote-kit/vendor/sinatra-respond_to/Rakefile +30 -0
  36. data/lib/ruote-kit/vendor/sinatra-respond_to/VERSION.yml +4 -0
  37. data/lib/ruote-kit/vendor/sinatra-respond_to/lib/sinatra/respond_to.rb +206 -0
  38. data/lib/ruote-kit/vendor/sinatra-respond_to/sinatra-respond_to.gemspec +56 -0
  39. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static folder/.keep +0 -0
  40. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/public/static.txt +1 -0
  41. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/test_app.rb +53 -0
  42. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/unreachable_static.txt +1 -0
  43. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/layout.html.haml +2 -0
  44. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.html.haml +1 -0
  45. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.js.erb +3 -0
  46. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/app/views/resource.xml.builder +3 -0
  47. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/extension_spec.rb +403 -0
  48. data/lib/ruote-kit/vendor/sinatra-respond_to/spec/spec_helper.rb +18 -0
  49. data/lib/ruote-kit/views/expression.html.haml +38 -0
  50. data/lib/ruote-kit/views/expressions.html.haml +30 -0
  51. data/lib/ruote-kit/views/index.html.haml +1 -0
  52. data/lib/ruote-kit/views/launch_process.html.haml +19 -0
  53. data/lib/ruote-kit/views/layout.html.haml +46 -0
  54. data/lib/ruote-kit/views/process.html.haml +55 -0
  55. data/lib/ruote-kit/views/processes.html.haml +27 -0
  56. data/lib/ruote-kit/views/resource_not_found.html.haml +7 -0
  57. data/lib/ruote-kit/views/workitem.html.haml +39 -0
  58. data/lib/ruote-kit/views/workitems.html.haml +23 -0
  59. data/lib/ruote-kit.rb +105 -0
  60. data/ruote-kit.gemspec +136 -0
  61. data/spec/helpers/render_helpers_spec.rb +211 -0
  62. data/spec/resources/expressions_spec.rb +179 -0
  63. data/spec/resources/index_spec.rb +46 -0
  64. data/spec/resources/processes_spec.rb +259 -0
  65. data/spec/resources/workitems_spec.rb +308 -0
  66. data/spec/ruote-kit_spec.rb +4 -0
  67. data/spec/spec.opts +2 -0
  68. data/spec/spec_helper.rb +152 -0
  69. data/spec/views/launch_process.html.haml_spec.rb +21 -0
  70. data/spec/views/process.html.haml_spec.rb +16 -0
  71. data/spec/views/processes.html.haml_spec.rb +30 -0
  72. data/spec/views/workitems.html.haml_spec.rb +68 -0
  73. metadata +185 -0
@@ -0,0 +1,403 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe Sinatra::RespondTo do
4
+ def media_type(sym)
5
+ Sinatra::Base.media_type(sym)
6
+ end
7
+
8
+ describe "options" do
9
+ it "should initialize with :default_charset set to 'utf-8'" do
10
+ TestApp.default_charset.should == 'utf-8'
11
+ end
12
+
13
+ it "should initialize with :default_content set to :html" do
14
+ TestApp.default_content.should == :html
15
+ end
16
+
17
+ it "should initialize with :assume_xhr_is_js set to true" do
18
+ TestApp.assume_xhr_is_js be_true
19
+ end
20
+ end
21
+
22
+ describe "assume_xhr_is_js" do
23
+ it "should set the content type to application/javascript for an XMLHttpRequest" do
24
+ header 'HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'
25
+
26
+ get '/resource'
27
+
28
+ last_response['Content-Type'].should =~ %r{#{media_type(:js)}}
29
+ end
30
+
31
+ it "should not set the content type to application/javascript for an XMLHttpRequest when assume_xhr_is_js is false" do
32
+ TestApp.disable :assume_xhr_is_js
33
+ header 'HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'
34
+ get '/resource'
35
+
36
+ last_response['Content-Type'].should_not =~ %r{#{media_type(:js)}}
37
+
38
+ # Put back the option, no side effects here
39
+ TestApp.enable :assume_xhr_is_js
40
+ end
41
+ end
42
+
43
+ describe "extension routing" do
44
+ it "breaks routes expecting an extension" do
45
+ # In test_app.rb the route is defined as get '/style.css' instead of get '/style'
46
+ get "/style.css"
47
+
48
+ last_response.should_not be_ok
49
+ end
50
+
51
+ it "should pick the default content option for routes with out an extension, and render haml templates" do
52
+ get "/resource"
53
+
54
+ last_response.body.should =~ %r{\s*<html>\s*<body>Hello from HTML</body>\s*</html>\s*}
55
+ end
56
+
57
+ it "should render for a template using builder" do
58
+ get "/resource.xml"
59
+
60
+ last_response.body.should =~ %r{\s*<root>Some XML</root>\s*}
61
+ end
62
+
63
+ it "should render for a template using erb" do
64
+ get "/resource.js"
65
+
66
+ last_response.body.should =~ %r{'Hiya from javascript'}
67
+ end
68
+
69
+ it "should return string literals in block" do
70
+ get "/resource.json"
71
+
72
+ last_response.body.should =~ %r{We got some json}
73
+ end
74
+
75
+ # This will fail if the above is failing
76
+ it "should set the appropriate content-type for route with an extension" do
77
+ get "/resource.xml"
78
+
79
+ last_response['Content-Type'].should =~ %r{#{media_type(:xml)}}
80
+ end
81
+
82
+ it "should set the character set to the default character set" do
83
+ get "/default_charset"
84
+
85
+ last_response['Content-Type'].should =~ %r{charset=#{TestApp.default_charset}}
86
+ end
87
+
88
+ it "should honor a change in character set in block" do
89
+ get "/iso-8859-1"
90
+
91
+ last_response['Content-Type'].should =~ %r{charset=iso-8859-1}
92
+ end
93
+
94
+ it "should not set the character set when requesting a non text resource" do
95
+ get "/resource.png"
96
+
97
+ last_response['Content-Type'].should_not =~ /charset/
98
+ end
99
+
100
+ it "should return not found when path does not exist" do
101
+ get "/nonexistant-path.txt"
102
+
103
+ last_response.status.should == 404
104
+ end
105
+
106
+ describe "for static files" do
107
+ before(:all) do
108
+ TestApp.enable :static
109
+ end
110
+
111
+ after(:all) do
112
+ TestApp.disable :static
113
+ end
114
+
115
+ it "should allow serving static files from public directory" do
116
+ get '/static.txt'
117
+
118
+ last_response.body.should == "A static file"
119
+ end
120
+
121
+ it "should only serve files when static routing is enabled" do
122
+ TestApp.disable :static
123
+ get '/static.txt'
124
+
125
+ last_response.should_not be_ok
126
+ last_response.body.should_not == "A static file"
127
+
128
+ TestApp.enable :static
129
+ end
130
+
131
+ it "should not allow serving static files from outside the public directory" do
132
+ get '/../unreachable_static.txt'
133
+
134
+ last_response.should_not be_ok
135
+ last_response.body.should_not == "Unreachable static file"
136
+ end
137
+ end
138
+ end
139
+
140
+ describe "routes not using respond_to" do
141
+ it "should set the default content type when no extension" do
142
+ get "/normal-no-respond_to"
143
+
144
+ last_response['Content-Type'].should =~ %r{#{media_type(TestApp.default_content)}}
145
+ end
146
+
147
+ it "should set the default character when no extension" do
148
+ get "/normal-no-respond_to"
149
+
150
+ last_response['Content-Type'].should =~ %r{charset=#{TestApp.default_charset}}
151
+ end
152
+
153
+ it "should set the appropriate content type when given an extension" do
154
+ get "/normal-no-respond_to.css"
155
+
156
+ last_response['Content-Type'].should =~ %r{#{media_type(:css)}}
157
+ end
158
+
159
+ it "should set the default charset when given an extension" do
160
+ get "/normal-no-respond_to.css"
161
+
162
+ last_response['Content-Type'].should =~ %r{charset=#{TestApp.default_charset}}
163
+ end
164
+ end
165
+
166
+ describe "error pages in production" do
167
+ class ProductionErrorApp < Sinatra::Base
168
+ set :environment, :production
169
+ register Sinatra::RespondTo
170
+ get '/missing-template' do
171
+ respond_to do |wants|
172
+ wants.html { haml :missing }
173
+ end
174
+ end
175
+ end
176
+
177
+ before(:each) do
178
+ @app = Rack::Builder.new { run ProductionErrorApp }
179
+ end
180
+
181
+ describe Sinatra::RespondTo::MissingTemplate do
182
+ it "should return 404 status when looking for a missing template in production" do
183
+ get '/missing-template'
184
+
185
+ last_response.status.should == 404
186
+ last_response.body.should_not =~ /Sinatra can't find/
187
+ end
188
+ end
189
+
190
+ describe Sinatra::RespondTo::UnhandledFormat do
191
+ it "should return with a 404 when an extension is not supported in production" do
192
+ get '/missing-template.txt'
193
+
194
+ last_response.status.should == 404
195
+ last_response.body.should_not =~ /respond_to/
196
+ end
197
+ end
198
+ end
199
+
200
+ describe "error pages in development:" do
201
+
202
+ it "should allow access to the /__sinatra__/*.png images" do
203
+ get '/__sinatra__/404.png'
204
+
205
+ last_response.should be_ok
206
+ end
207
+
208
+ describe Sinatra::RespondTo::MissingTemplate do
209
+ it "should return 500 status when looking for a missing template" do
210
+ get '/missing-template'
211
+
212
+ last_response.status.should == 500
213
+ end
214
+
215
+ it "should provide a helpful error message for a missing template when in development" do
216
+ get '/missing-template'
217
+
218
+ last_response.body.should =~ /missing\.html\.haml/
219
+ end
220
+
221
+ it "should show the /__sinatra__/500.png" do
222
+ get '/missing-template'
223
+
224
+ last_response.body.should =~ %r{src='/__sinatra__/500.png'}
225
+ end
226
+
227
+ it "should provide a contextual code example for the template engine" do
228
+ # Haml
229
+ get '/missing-template'
230
+
231
+ last_response.body.should =~ %r{app.html.haml}
232
+ last_response.body.should =~ %r{missing-template.html.haml}
233
+ last_response.body.should =~ %r{get '/missing-template' do respond_to do |wants| wants.html \{ haml :missing-template, layout => :app \} end end}
234
+
235
+ # ERB
236
+ get '/missing-template.js'
237
+
238
+ last_response.body.should =~ %r{app.html.erb}
239
+ last_response.body.should =~ %r{missing-template.html.erb}
240
+ last_response.body.should =~ %r{get '/missing-template' do respond_to do |wants| wants.html \{ erb :missing-template, layout => :app \} end end}
241
+
242
+ # Builder
243
+ get '/missing-template.xml'
244
+
245
+ last_response.body.should =~ %r{app.xml.builder}
246
+ last_response.body.should =~ %r{missing-template.xml.builder}
247
+ last_response.body.should =~ %r{get '/missing-template' do respond_to do |wants| wants.xml \{ builder :missing-template, layout => :app \} end end}
248
+ end
249
+ end
250
+
251
+ describe Sinatra::RespondTo::UnhandledFormat do
252
+ it "should return with a 404 when an extension is not supported" do
253
+ get '/missing-template.txt'
254
+
255
+ last_response.status.should == 404
256
+ end
257
+
258
+ it "should provide a helpful error message for an unhandled format" do
259
+ get '/missing-template.txt'
260
+
261
+ last_response.body.should =~ %r{get '/missing-template' do respond_to do |wants| wants.txt \{ "Hello World" \} end end}
262
+ end
263
+
264
+ it "should show the /__sinatra__/404.png" do
265
+ get '/missing-template.txt'
266
+
267
+ last_response.body.should =~ %r{src='/__sinatra__/404.png'}
268
+ end
269
+ end
270
+ end
271
+
272
+ describe "helpers:" do
273
+ include Sinatra::RespondTo::Helpers
274
+
275
+ before(:each) do
276
+ stub!(:response).and_return({'Content-Type' => 'text/html'})
277
+ end
278
+
279
+ describe "charset" do
280
+ it "should set the working charset when called with a non blank string" do
281
+ response['Content-Type'].should_not =~ /charset/
282
+
283
+ charset 'utf-8'
284
+
285
+ response['Content-Type'].split(';').should include("charset=utf-8")
286
+ end
287
+
288
+ it "should remove the charset when called with a blank string" do
289
+ charset 'utf-8'
290
+ charset ''
291
+
292
+ response['Content-Type'].should_not =~ /charset/
293
+ end
294
+
295
+ it "should return the current charset when called with nothing" do
296
+ charset 'utf-8'
297
+
298
+ charset.should == 'utf-8'
299
+ end
300
+
301
+ it "should fail when the response does not have a Content-Type" do
302
+ response.delete('Content-Type')
303
+
304
+ lambda { charset }.should raise_error
305
+ end
306
+
307
+ it "should not modify the Content-Type when given no argument" do
308
+ response['Content-Type'] = "text/html;charset=iso-8859-1"
309
+
310
+ charset
311
+
312
+ response['Content-Type'].should == "text/html;charset=iso-8859-1"
313
+ end
314
+ end
315
+
316
+ describe "format" do
317
+ before(:each) do
318
+ stub!(:request).and_return(Sinatra::Request.new({}))
319
+ end
320
+
321
+ it "should set the correct mime type when given an extension" do
322
+ format :xml
323
+
324
+ response['Content-Type'].split(';').should include(media_type(:xml))
325
+ end
326
+
327
+ it "should fail when set to an unknown extension type" do
328
+ lambda { format :bogus }.should raise_error
329
+ end
330
+
331
+ it "should return the current mime type extension" do
332
+ format :js
333
+
334
+ format.should == :js
335
+ end
336
+
337
+ it "should not modify the Content-Type when given no argument" do
338
+ response['Content-Type'] = "application/xml;charset=utf-8"
339
+
340
+ format
341
+
342
+ response['Content-Type'].should == "application/xml;charset=utf-8"
343
+ end
344
+ end
345
+
346
+ describe "static_file?" do
347
+ before(:all) do
348
+ TestApp.enable :static
349
+ @static_folder = "/static folder/"
350
+ @reachable_static_file = "/static.txt"
351
+ @unreachable_static_file = "/../unreachable_static.txt"
352
+ end
353
+
354
+ after(:all) do
355
+ TestApp.disable :static
356
+ end
357
+
358
+ def options
359
+ TestApp
360
+ end
361
+
362
+ def unescape(path)
363
+ Rack::Utils.unescape(path)
364
+ end
365
+
366
+ it "should return true if the request path points to a file in the public directory" do
367
+ static_file?(@reachable_static_file).should be_true
368
+ end
369
+
370
+ it "should return false when pointing to files outside of the public directory" do
371
+ static_file?(@unreachable_static_file).should be_false
372
+ end
373
+
374
+ it "should return false when the path is for a folder" do
375
+ static_file?(@static_folder).should be_false
376
+ end
377
+ end
378
+
379
+ describe "respond_to" do
380
+ before(:each) do
381
+ stub!(:request).and_return(Sinatra::Request.new({}))
382
+ end
383
+
384
+ it "should fail for an unknown extension" do
385
+ lambda do
386
+ respond_to do |wants|
387
+ wants.bogus
388
+ end
389
+ end.should raise_error
390
+ end
391
+
392
+ it "should call the block corresponding to the current format" do
393
+ format :html
394
+
395
+ respond_to do |wants|
396
+ wants.js { "Some JS" }
397
+ wants.html { "Some HTML" }
398
+ wants.xml { "Some XML" }
399
+ end.should == "Some HTML"
400
+ end
401
+ end
402
+ end
403
+ end
@@ -0,0 +1,18 @@
1
+ #$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ require 'rubygems'
4
+ require 'spec'
5
+ require 'rack/test'
6
+
7
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'sinatra', 'respond_to')
8
+ require File.join(File.dirname(__FILE__), 'app', 'test_app')
9
+
10
+ Spec::Runner.configure do |config|
11
+ def app
12
+ @app ||= Rack::Builder.new do
13
+ run TestApp
14
+ end
15
+ end
16
+
17
+ config.include Rack::Test::Methods
18
+ end
@@ -0,0 +1,38 @@
1
+ - @_uses_fluo = true
2
+
3
+ %h2 Expression #{@expression.fei.wfid}/#{@expression.fei.expid}
4
+
5
+ .options
6
+ %ul.nolist
7
+ %li.b5
8
+ %form{ :method => 'post' }
9
+ %input{ :type => 'hidden', :name => '_method', :value => 'delete' }
10
+ = button "Cancel", "cancel force-block"
11
+ %span.description DELETE /_ruote/expressions/#{@expression.fei.wfid}/#{@expression.fei.expid}
12
+ %li.b5
13
+ %form{ :method => 'post' }
14
+ %input{ :type => 'hidden', :name => '_method', :value => 'delete' }
15
+ %input{ :type => 'hidden', :name => '_kill', :value => '1' }
16
+ = button "Kill", "cancel force-block"
17
+ %span.description DELETE /_ruote/expressions/#{@expression.fei.wfid}/#{@expression.fei.expid}?_kill=1
18
+
19
+ %ul.nolist
20
+ %li fei: #{@expression.fei.to_s}
21
+ %li class: #{@expression.class.name}
22
+ %li name: #{@expression.respond_to?(:participant_name) ? @expression.participant_name : @expression.name}
23
+ %li process: #{link_to @process}
24
+ %li
25
+ process expressions:
26
+ %a{ :href => "/_ruote/expressions/#{@process.wfid}" } GET /_ruote/expressions/#{@process.wfid}
27
+ - if @expression.parent
28
+ %li parent expression: #{link_to_expression @expression.parent}
29
+
30
+ %p &nbsp;
31
+
32
+ %canvas#fluo
33
+
34
+ :javascript
35
+ var proc_rep = #{process_tree( @process )};
36
+ FluoCan.renderFlow( 'fluo', proc_rep );
37
+ FluoCan.crop('fluo');
38
+ FluoCan.highlight('fluo', '#{@expression.fei.expid}');
@@ -0,0 +1,30 @@
1
+ - @_uses_fluo = true
2
+
3
+ - unless @process
4
+ %h2 Expressions
5
+ .flash
6
+ .message
7
+ .notice
8
+ %p Expressions are atomic pieces of process instances.
9
+ %p Have a look at the <a href="/_ruote/processes">processes</a> and then follow their links to their set of expressions.
10
+
11
+ - else
12
+ %h2 Expressions for #{@process.wfid}
13
+
14
+ %ul.nested_list
15
+ - @process.expressions.each do |expression|
16
+ %li
17
+ = link_to_expression expression
18
+ %ul.nested_details
19
+ %li fei: #{expression.fei.to_s}
20
+ %li class: #{expression.class.name}
21
+ %li name: #{expression.respond_to?(:participant_name) ? expression.participant_name : expression.name}
22
+
23
+ %p &nbsp;
24
+
25
+ %canvas#fluo
26
+
27
+ :javascript
28
+ var proc_rep = #{process_tree( @process )};
29
+ FluoCan.renderFlow( 'fluo', proc_rep );
30
+ FluoCan.crop('fluo');
@@ -0,0 +1 @@
1
+ %p Hello world
@@ -0,0 +1,19 @@
1
+ %h2 Launch a new process
2
+
3
+ %form.form{ :method => "POST", :action => "/_ruote/processes" }
4
+ .group
5
+ %label.label{ :for => "process_definition" } Process definition
6
+ %textarea.text_area{ :name => "process_definition", :cols => 80, :rows => 10 }
7
+ %span.description Provide your process definition here in any of the formats supported by ruote
8
+ .group
9
+ %label.label{ :for => "process_fields" } Process fields
10
+ %textarea.text_area{ :name => "process_fields", :cols => 80, :rows => 10 }
11
+ %span.description Provide process fields as a JSON string
12
+ .group
13
+ %label.label{ :for => "process_variables" } Process variables
14
+ %textarea.text_area{ :name => "process_variables", :cols => 80, :rows => 10 }
15
+ %span.description Provide process variables as a JSON string
16
+ .group.navform
17
+ %input.submit{ :type => "submit", "value" => "Launch" }
18
+ or
19
+ %a{ :href => "/_ruote/processes" } Cancel
@@ -0,0 +1,46 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title ruote-kit
5
+ %link{ :type => "text/css", :href => "/_ruote/stylesheets/base.css", :rel => "stylesheet" }
6
+ %link{ :type => "text/css", :href => "/_ruote/stylesheets/style.css", :rel => "stylesheet" }
7
+ %link{ :type => "text/css", :href => "/_ruote/stylesheets/SimplyButtons.css", :rel => "stylesheet" }
8
+ %link{ :type => "text/css", :href => "/_ruote/stylesheets/rk.css", :rel => "stylesheet" }
9
+ %script{ :type => "text/javascript", :src => "/_ruote/javascripts/SimplyButtons.js" }
10
+ - if @_uses_fluo
11
+ %script{ :type => "text/javascript", :src => "/_ruote/javascripts/fluo-can.js" }
12
+ %script{ :type => "text/javascript", :src => "/_ruote/javascripts/fluo-dial.js" }
13
+ %script{ :type => "text/javascript", :src => "/_ruote/javascripts/fluo-json.js" }
14
+ %script{ :type => "text/javascript", :src => "/_ruote/javascripts/fluo-tred.js" }
15
+
16
+ :javascript
17
+ window.onload = function() { SimplyButtons.init(); }
18
+ %body
19
+ #container
20
+ #header
21
+ %h1 ruote-kit
22
+ #user-navigation
23
+ %ul
24
+ %li
25
+ %a{ :href => "/_ruote/processes/new" } Launch a new process
26
+ #main-navigation
27
+ %ul
28
+ = navigate_to "Processes", "/_ruote/processes"
29
+ = navigate_to "Expressions", "/_ruote/expressions"
30
+ = navigate_to "Workitems", "/_ruote/workitems"
31
+ .clear
32
+ #wrapper
33
+ #main
34
+ .block
35
+ .content
36
+ .inner= yield
37
+ #footer
38
+ .block
39
+ %p
40
+ &copy; 2009 Kenneth Kalmer
41
+ |
42
+ %a{ :href => "http://www.opensourcery.co.za" } Blog
43
+ |
44
+ %a{ :href => "http://github.com/kennethkalmer/ruote-kit" } Source
45
+ |
46
+ %a{ :href => "http://ruote.rubyforge.org" } Powered by ruote
@@ -0,0 +1,55 @@
1
+ - @_uses_fluo = true
2
+
3
+ %h2
4
+ = @process.wfid
5
+ (#{@process.definition_name})
6
+
7
+ .options
8
+ %ul.nolist
9
+ /
10
+ %li.b5
11
+ %form{ :method => 'post' }
12
+ %input{ :type => 'hidden', :name => '_method', :value => 'put' }
13
+ = button "Pause", 'force-block'
14
+ %span.description PUT /_ruote/processes/#{@process.wfid}?_pause=1
15
+ %li.b5
16
+ %form{ :method => 'post' }
17
+ %input{ :type => 'hidden', :name => '_method', :value => 'delete' }
18
+ = button "Cancel", "cancel force-block"
19
+ %span.description DELETE /_ruote/processes/#{@process.wfid}
20
+ %li.b5
21
+ %form{ :method => 'post' }
22
+ %input{ :type => 'hidden', :name => '_method', :value => 'delete' }
23
+ %input{ :type => 'hidden', :name => '_kill', :value => '1' }
24
+ = button "Kill", "cancel force-block"
25
+ %span.description DELETE /_ruote/processes/#{@process.wfid}?_kill=1
26
+
27
+ %ul.nolist
28
+ %li wfid: #{@process.wfid}
29
+ %li launch: #{@process.launched_time}
30
+ %li paused:
31
+ %li: tags: #{@process.all_tags.keys.join(', ')}
32
+ %li
33
+ expressions:
34
+ %a{ :href => "/_ruote/expressions/#{@process.wfid}" } GET /_ruote/expressions/#{@process.wfid}
35
+ %li
36
+ workitems:
37
+ %a{ :href => "/_ruote/workitems/#{@process.wfid}" } GET /_ruote/workitems/#{@process.wfid}
38
+ %li errors: #{@process.errors.size}
39
+
40
+ %ul
41
+ %li TODO
42
+ %li Branches
43
+ %li Process variables
44
+ %li Scheduled jobs
45
+ %li Active expression
46
+ %li Tree
47
+
48
+ %p &nbsp;
49
+
50
+ %canvas#fluo
51
+
52
+ :javascript
53
+ var proc_rep = #{process_tree( @process )};
54
+ FluoCan.renderFlow( 'fluo', proc_rep );
55
+ FluoCan.crop('fluo');
@@ -0,0 +1,27 @@
1
+ %h2 Processes
2
+
3
+ .flash
4
+ .message
5
+ - if @processes.empty?
6
+ .warn
7
+ %p No processes are currently running
8
+ - else
9
+ .notice
10
+ %p Currently running #{@processes.size} processes
11
+
12
+ %ul.nested_list
13
+ - @processes.each do |process|
14
+ %li
15
+ = link_to process
16
+ %ul.nested_details
17
+ %li wfid: #{process.wfid}
18
+ %li process: #{process.definition_name} (#{process.definition_revision})
19
+ %li launched: #{process.launched_time}
20
+ %li tags: #{process.all_tags.keys.join(', ')}
21
+ %li
22
+ expressions:
23
+ %a{ :href => "/_ruote/expressions/#{process.wfid}" } GET /_ruote/expressions/#{process.wfid}
24
+ %li
25
+ workitems:
26
+ %a{ :href => "/_ruote/workitems/#{process.wfid}" } GET /_ruote/workitems/#{process.wfid}
27
+ %li errors: #{process.errors.size}
@@ -0,0 +1,7 @@
1
+ %h2 Resource not found
2
+
3
+ .flash
4
+ .message.error
5
+ %p
6
+ The resource you requested could not be found.
7
+ %a{ :href => "javascript:history.go(-1)" } Go back to the previous page
@@ -0,0 +1,39 @@
1
+ - @_uses_fluo = true
2
+
3
+ %h2 Workitem #{@workitem.fei.wfid}/#{@workitem.fei.expid}
4
+
5
+ %ul.nolist
6
+ %li fei: #{@workitem.fei.to_s}
7
+ %li participant: #{@workitem.participant_name}
8
+ %li dispatched:
9
+ %li last modified:
10
+ %li process: #{link_to engine.process( @workitem.fei.wfid) }
11
+ %li expressions:
12
+ %li workitems of this process: #{link_to "GET /_ruote/workitems/#{@workitem.fei.wfid}", "/_ruote/workitems/#{@workitem.fei.wfid}" }
13
+
14
+ %p &nbsp;
15
+
16
+ %form.form{ :method => 'post' }
17
+ %input{ :type => 'hidden', :name => '_method', :value => 'put' }
18
+ %input{ :type => 'hidden', :name => '_procced', :value => '1' }
19
+ .group
20
+ %label.label{ :for => "fields" } Fields
21
+ %textarea.text_area{ :name => "fields", :cols => 80, :rows => 10 }
22
+ = @workitem.fields.to_json
23
+ %span.description The current workitem fields in JSON format
24
+ .group
25
+ %input{ :type => 'checkbox', :name => '_proceed', :value => '1' }
26
+ %label{ :for => '_proceed' } Proceed the workflow (_proceed=1)
27
+ %br
28
+ %span.description Check to let the workflow proceed, leave unchecked to just update workitem fields
29
+ .group.navform
30
+ %input.submit{ :type => 'submit', :value => "PUT /_ruote/workitems/#{@workitem.fei.wfid}/#{@workitem.fei.expid}" }
31
+
32
+ %p &nbsp;
33
+
34
+ %canvas#fluo
35
+
36
+ :javascript
37
+ var proc_rep = #{process_tree( @workitem )};
38
+ FluoCan.renderFlow( 'fluo', proc_rep, { 'workitems' : ['#{@workitem.fei.expid}'] } );
39
+ FluoCan.crop('fluo');