Top level form options

Top level attributes define options which are common to all sections of form or can not be placed into other sections.

 

table: mandatory

Defines table (collection) name which will be processed by this form.

 

Example:

table: dc_page

 

 

title: optional

Title name which will be displayed on the top of browser. If omitted title can also be defined in helpers.label.table_name.tabletitle locale definition and can thus be localized.

 

Example:

title: Pages table

 

 

extend: optional

Form can extend another form. Extended (original) form is read into memory and then patched with definitions found in current form. If we assume that form on the previous page is named dc_book.yml, we may extend it like:

 

Example:

extend: dc_book

title: Book with additional field defined

index:
  filter: title, author
  actions: /

form:

  fields:

    50:
      name: additional_field
      type: text_field
      html:
        size: 60

 

The resulting form will have filter option updated to 'title, author', actions option removed and field name aditional_field added to the end of form.

 

 

permission: optional

There are many ways how to enforce which users may perform editing operations on document. One of them is by specifying role name required to run specific operation in permission option. If user doesn't have required role assigned he will be presented with error dialog.

So far possible operations options are:

can_view: role_name

 

Example:

permission:
  can_view: regular_user

 

 

readonly: optional

This form is used only for displaying data.

 

Example:

readonly: yes or 1

 

 

controls: optional

Control methods file name is by default defined by collection (table) name define in form. So when editing dc_book collection, controls file will be named drgcms_control/dc_book.rb and module definition will be named module DrgcmsControls::DcBook. This behavior may be changed with controls keyword.

 

Example:

controls: my_own_controls  # => DrgcmsControls::MyOwnControls

 

 


Last update: 08.05.2018