Hobo Cookbook

View Source

Rapid

<delete-button>

Provides either an ajax or non-ajax delete button to send a RESTful “DELETE”. The context should be a record for which you to want provide a delete button.

The Rapid Library has a convention of marking (in the output HTML, using a special CSS class) elements as “object elements”, with the class and ID of the ActiveRecord object that they represent. <delete-button> assumes it is placed inside such an element, and will automatically find the right element to remove (fade out) from the DOM. The <collection> tag adds this metadata (CSS class) automatically, so <delete-button> works well when used inside a <collection>. This is a Clever Trick which needs to be revisted and perhaps simplified.

If used within a <collection>, <delete-button> also knows how to add an “empty message” such as “no comments to display” when you delete the last item. Clever Tricks abound.

Current limitation: There is no support for the ajax callbacks at this time.

All the standard ajax attributes except the callbacks are supported (see the main taglib documention for Rapid Forms).

Attributes

  • label: The label for the button. Default: “Remove”

  • in-place: delete in place (ajax)? Default: true, or false if the record to be deleted is the same as the top level context of the page

  • image: URL of an image for the button. Changes the rendered tag from <input type='button'> to <input type='image' src='...'>

  • fade: Perform the fade effect (true/false)? Default: true

Show Source

Comments

No comments to display