Helma Logo
main list history

Basic Scaffolding

While I prefer Helma over RubyOnRails, I have been influenced by reading about Rails and the convenience of their scaffolding system.
So I've created a basic work-alike system (but not a straight port!) using actions/skins for HopObject that depends on following some coding conventions.

The conventions are:
Ensure each Prototype defines a _children collection of its own type

  _children = collection(User)

Create mountpoints for each Prototype you want to access directly

  users = mountPoint(User)

Ensure there is a skin named itemList available for each prototype in order to render each HopObject item in the list skin.

        <% this.id %>            
        <% this.username %>
    <% this.href name="editDelete" %>

and HopObject/skins/editDelete.skin has something like:
    <a href="<% this.href %>edit" >EDIT</a>
    <a href="<% this.href %>delete" >DELETE</a>

Then copy the action files (.hac file attachments at the bottom of this page), actions, HopObject.js and skins into your apps HopObject folder.
Copy the attached htmlpage.skin into your apps Global folder.

You can now use the default create, list, etc. actions with urls like:


While I have generic create.skin, edit.skin, etc. in HopObject, if you put a more customised one in any of your prototypes it will "override" my generic ones in the HopObject prototype. Likewise you can create your own edit function that will be called instead of the generic one in HopObject.

Likewise the generic processForm() in HopObject that is called by create.hac and edit.hac can be over-ridden by a custom one if you need to do special processing on form data for any particular prototype and finally you can of course create custom create,edit,list, delete actions in each prototype to completely change this default processing.

Note: make sure you add the jala.ListRender.js as one of your applications repositories, eg:

  myapp.repository.2 = modules/jala/code/ListRenderer.js
create.hacundefined bytes
delete.hacundefined bytes
edit.hacundefined bytes
list.hacundefined bytes
main.hacundefined bytes
htmlpage.skinundefined bytes
HopObject.jsundefined bytes

Links to this page: maks


#1 by tree at 2007/12/12 07:43

where are the "provided" js files?

#2 by maks at 2008/01/25 00:35

sorry, I was referring to the .hac files attached to this page. I've edited the text to hopefully make that clear now.