Declarative (Streamlined) View Options

Streamlined allows you to declaratively control the data and access views for your models. Our intent was to provide a place for view-related declarations that would not involve changes to ActiveRecord. In addition, we don't want to muddy your ActiveRecord model classes with view-specific configuration information. In order to separate these concerns, we've created a new entity that lives parallel to your controllers, models, views and helpers. This entity lives in the folder app/streamlined and is called the UI file.

Each model that you want to configure should have its own UI file. For example, let's say you are using Streamlined to control a model called Person. In app/streamlined, you would create a file called person_ui.rb (i.e. app/models/person.rb -> app/streamlined/person_ui.rb). Inside that file, create the basic structure:

Streamlined.ui_for(Person) do
end

Additionally, there is a rake task you can use to create the file:

> rake streamlined:model MODEL=Person

You're now ready to begin adding declarative view options for your new model. Note that typically Streamlined displays 'everything' for all of its models (except the edit view, which seems to not allow for many to many editing unless you tell it to). So creating this file overrides that.

Declarations

See Declarations

Column Options

See ColumnOptions

Original Syntax

Up until version 0.9 of Streamlined, the UI syntax relied on subclassing:

class PersonUI < Streamlined::UI
end

This has been replaced with a new syntax to allow for more future flexibility in how UI declarations are handled.