[ANN] Amrita2 initial release

I released Amrita2 1.9.1, the first version of new Amrita.
Get it from


This release contains Amrita2-Rails bridge based on Jamis Buck's work
and the Amrita2 version of Todo list Tutorial.

Here is one of two Amrita2-Rails sample applications. I think you can
get a feeling of Amrita2 if you know Todo list tutorial of Rails.


A part of template


    Not done:<br />
    <div id='not_done'>
       <input id="item_done" name="item[done]" type="checkbox" value="1" />
       <span> </span>
       <span id='description' />
       <span> </span>
       <a id='edit_link' href="/todo/edit/">Edit</a>
       <span> </span>
       <a id='destroy_link' href="/todo/destroy/">


Helper methods for VIEW code.
module TodoHelper
  # Presentation Object for Todo Record
  class TodoPO
    def initialize(r)
      @r = r

    # passive PO method:
    # The result of this method will be inserted in HTML output.
    def description

    # active PO method:
    # m is a template Module with method for dynamic element.
    # If a method has a parameter for it, one of methods of that module
    # should be called by PO object.
    def item_done(m)
      m.item_done(nil, :onclick => %[document.location.href="/todo/toggle_check/#{@r.id}"])

    def edit_link(m)
      m.edit_link("Edit", :href=>"/todo/edit/#{@r.id}")

    def destroy_link(m)
      m.destroy_link("Destroy", :href=>"/todo/destroy/#{@r.id}",
                     :onclick=>%[return confirm("Are you sure you want to delete this entry: #{description}")])

  # Presentation Object for 'list' method
  # The result of this method will be used by Amrita2 for tempalte expansion
  def list_po
      :done => controller.done.collect do |r|
      :not_done => controller.not_done.collect do |r|

And there is another version which I think is more flexible and better
for maintainance. This version uses the new parts template like this.
       <div id='parts'>
         <input id='checkbox_on' checked="checked" type="checkbox"
           value="$1" onclick='document.location.href="$2"' />
         <input id='checkbox_off' type="checkbox" value="$1"
           onclick='document.location.href="$2"' />
         <a id='link' href="$2">$1</a>
         <a id='confirm_link' href="$2" onclick="return confirm('$3');">$1</a>

The view codes uses these fragments and body template . So everything
in the view is in HTML format and separated from view code. You can
modify each independently.

Taku Nakajima