Seaside - Scaffolding
Last published: July 6, 2009 by 'jkott'
Defines 9 Classes
Extends 33 Classes
Seaside-Scaffolding provides a set of reusable Create, Read, Update and Delete WAComponents for Seaside which reflect off of Glorps ActiveRecord.
This package provides a set of conventions and practices that can simplify and reduce the work involved in hooking up a Seaside WAComponent to a Glorp.ActiveRecord class for querying, searching, creating, updating and deleting records from the database.
There are three classes provided for users of this package to subclass from:
GenericListUI -- provides a list page of records for the target active record class
GenericGridUI -- provides a grid page of records for the target active record class
GenericViewUI -- provides a view page of a single record for the target active record class
GenericEditUI -- provides an edit page for a single record for the target active record class.
Some of the classes also provide alternate ways to view or interact with the information from the active record class, for example a JSON view or an ATOM view, so see each of the above classes for more details on how they work and how to customize them.
The idea is to create a subclass of one or all of the GenericUI subclasses for each of your ActiveRecord subclasses, at least the ones you want to have UIs for. The naming of the subclass is used to identify which ActiveRecord you want to edit. For example, if we have a Person active record subclass, we can create subclasses PersonListUI, PersonViewUI and PersonEditUI from the generics, GenericListUI, GenericGridUI GenericViewUI and GenericEditUI. The names of the classes will match back to Person and the UIs will then customize themselves based on the descirptor system in use.
The different GenericUI subclasses will reflect off the active record classes mappings from the active descriptor system to produce a standard Create, Read, Update and Delete sort of application. Each mapping describes a field on the class that can be displayed to the user. Subclasses can override this list or reorder it.
The mappings are used differently depending on the kind of subclass. For example, a list ui will use the mappings as the columns for the results that are found; the view will show a records mappings as a sort of report view; and the edit page will show the mappings as label-value with edit widgets to modify the page where the edit widget is a reflection of the mapping type and attribute type read from the database.
The list page does not current paginate, so it will pull back all the records to render in one hit.