Hi!

I fear I'll confuse you even more, but I'll try my best to shed some
light on the usage of ruote-kit (furthermore abbreviated as rk) and
Ruote in a Rails app.

Christian wrote:
> I was looking into the directory structure to find out how to start
> developing some views and participants, but I'm completely lost.

There's no need to change rk if you want to use it. rk is (something
like) a RESTful wrapper to Ruote itself. If you want to use the REST
interface rk provides, you could (and probably should) use the client
library ruote-kit-client (http://github.com/kennethkalmer/ruote-kit-client).

> I have little experiences with rails so far.

You don't have to use rk if you just need Ruote in your Rails app (and
btw, you don't even need Rails for rk nor Ruote -- rk is a Sinatra app).

You may:
1. use Ruote directly from your own (Rails|Sinatra|whatever) application
   (with or without rk to peep into the running workflow processes)
2. use rk-client to access a running rk instance
3. put rk into your Rack app's middleware stack (see rk's Readme)

I'll use the first option here at my place, so Kenneth will have to
provide some more information on the other two, especially the third
one, which sounds pretty nice (less configuration needs on your side).
The second option would be most useful when your app and rk won't run on
the same server, I suppose.

> Are views completly edited by hand or is it possible to generate them
> via something like a scaffolding?

There's no scaffolding at the moment.

> Where do I put my views in?

What do you like to do with the 'views'?

You'll have to start a new (Rails|Sinatra|whatever) application if you
want to use Ruote or rk. Ruote and rk won't bother where you're views
are ;-)

OK, let's assume you choose the first option mentioned above (sorry,
this is not the answer to your original question, but I hope it helps
anyway) and you plan to write a shiny new Rails app. You could re-use my
configuration example here:

http://gist.github.com/286669

Then, you could use

Ruote.engine

anywhere in your app to access the Ruote engine instance.

Ruote.storage_participant

would be the shortcut to the storage participant registered for
workflow_step_.*.

So let's have an example controller action which simply fetches all
workitems from the storage participant:
class WorklistController < ActionController::Base
  def index
    @workitems = Ruote.storage_participant.all
  end
end

and the corresponding view (app/views/worklist/index.html.haml):
.workitems
  - @workitems.each do |wi|
    %div[wi]
      &= wi.fields['foo']

Note that you'll have to run a Ruote worker by calling

$ rake ruote:run_worker

if you don't want your processes to be stalled.

The mentioned gist includes an example for a custom participant
implementation.


For using rk-client see its Readme, it should be enough to get going.
The controller action could then be rewritten to:
def index
  client = RuoteKit::Client(RUOTE_KIT_URL)
  @workitems = client.workitems
end

Hope this helps, fire away with further questions,
Torsten

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to