Difference between revisions of "ARK2/View"

From ARK
Jump to: navigation, search
(View Elements)
(Tables)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
= VIew =
+
= View =
  
ARK2 provides a table driven configuration of View Elements such as Pages, Forms and Tables. View Elements can be nested to build up  
+
ARK2 provides a table driven configuration of Views on Data Schemas and Items, such as Pages, Forms and Tables. View Elements can be nested to build up complex layouts.
  
 
== View Elements ==
 
== View Elements ==
Line 9: Line 9:
 
Basic Elements
 
Basic Elements
 
* Widget - An object embedded in a page, e.g. a form element, text element, button, etc
 
* Widget - An object embedded in a page, e.g. a form element, text element, button, etc
* Field - A widget that is linked to a specific Attribute in a Schema and inherits its behaviour from that Attribute, e.g. an Actor's name is a text field with defined size constraints
+
* Field - A widget that is linked to a specific Attribute in a Schema and inherits its behaviour from that Attribute, e.g. an Actor's name is a text form field with defined size constraints
 
* Nav - A widget that is used for site navigation, e.g. a clickable link with or without an icon
 
* Nav - A widget that is used for site navigation, e.g. a clickable link with or without an icon
  
Line 17: Line 17:
 
* Form - An HTML5 Form
 
* Form - An HTML5 Form
 
* Table - An HTML5 Table
 
* Table - An HTML5 Table
* Tree - Currently not implemented, a layout of other elements in a hierarchical tree
+
* Tree - Currently not implemented, a layout of other elements in a hierarchical tree, e.g. a navigation menu
  
 
== View Tables / Classes ==
 
== View Tables / Classes ==
Line 32: Line 32:
 
  ark_view_type - ARK\View\Type
 
  ark_view_type - ARK\View\Type
 
  ark_view_widget - ARK\View\Widget
 
  ark_view_widget - ARK\View\Widget
 +
 +
== Tables ==
 +
 +
Tables are a Compound Element defined by the ARK\View\Table class, and can only embed ARK\View\Field or ARK\View\Widget Basic Elements. They cannot embed other Compound Elements. When a Table embeds Field Elements, then all Fields must belong to a single Schema, i.e. a Table embeds a Schema, with each row embedding an Item that is an instance of that Schema.
 +
 +
The Table Element is defined in the ark_view_table table, which is mapped by Doctrine to the ARK\View\Table class. The definition seeks to abstract the HTML5 Table definition and the currently chosen JavaScript Table widget in a generic way to avoid implementation specifics. The Twig or JavaScript frontends are expected to translate this generic definition into the specific implementation being used.
 +
 +
{| class="wikitable"
 +
 +
|+ Table Definition
 +
 +
! Database Field
 +
! Class Method
 +
! Datatype
 +
! Description
 +
 +
|-
 +
| element
 +
| id()
 +
| string
 +
| The unique ID of the Table element
 +
|-
 +
| name
 +
| name()
 +
| string
 +
|
 +
|-
 +
|
 +
| type()
 +
| ARK\View\Type
 +
|
 +
|-
 +
| mode
 +
| mode()
 +
| boolean
 +
|
 +
|-
 +
| caption
 +
| showCaption()
 +
| boolean
 +
| Whether to show the HTML5 table caption element
 +
|-
 +
| header
 +
| showHeader()
 +
| boolean
 +
| Whether to show the HTML5 table header element
 +
|-
 +
| footer
 +
| showFooter()
 +
| boolean
 +
| Whether to show the HTML5 table footer element
 +
|-
 +
| sortable
 +
| isSortable()
 +
| boolean
 +
| Whether the table rows can be sorted
 +
|-
 +
| searchable
 +
| isSearchable()
 +
| boolean
 +
| Whether the table data is searchable
 +
|-
 +
| list
 +
| enableListView()
 +
| boolean
 +
| Whether the table list view is enabled
 +
|-
 +
| detail
 +
| enableDetailView()
 +
| boolean
 +
| Whether the table detail view is enabled
 +
|-
 +
| expand
 +
| enableExpandListView()
 +
| boolean
 +
| Whether the table expand view is enabled (only if list and detail views are enabled)
 +
|-
 +
| card
 +
| enableCardView()
 +
| boolean
 +
| Whether the table card view is enabled
 +
|-
 +
| thumb
 +
| enableThumbnailView()
 +
| boolean
 +
| Whether the table thumbnail view is enabled
 +
|-
 +
| view
 +
| defaultView()
 +
| string
 +
| Which table view is the default view, choice of list, card, or thumb
 +
|-
 +
| image
 +
| image()
 +
| string
 +
| The data field to use for images, i.e. thumbnails
 +
|-
 +
| export
 +
| canExportData()
 +
| boolean
 +
| Whether the table data can be exported
 +
|-
 +
| columns
 +
| canChooseColumns()
 +
| boolean
 +
| Whether the table columns displayed can be selected
 +
|-
 +
| pagination
 +
| pagination(), pageSize()
 +
| boolean, integer
 +
| The number of rows per page, defaults to 10
 +
|-
 +
| selection
 +
| selection()
 +
| string
 +
| Whether data rows can be selected
 +
|-
 +
| keyword
 +
| keyword()
 +
| string, ARK\Translation\Keyword
 +
| The translation keyword used for the table
 +
|-
 +
| classes
 +
| classes()
 +
| string
 +
| Any extra CSS classes to add to the table
 +
|-
 +
| template
 +
| template()
 +
| string
 +
| The TWIG template to use instead of the default table template
 +
|-
 +
| url
 +
| dataUrl()
 +
| string
 +
| The server-side pagination URL
 +
|-
 +
 +
|}

Latest revision as of 14:22, 22 March 2018

View

ARK2 provides a table driven configuration of Views on Data Schemas and Items, such as Pages, Forms and Tables. View Elements can be nested to build up complex layouts.

View Elements

View elements are either Basic Elements, or Compound Elements made up of other Basic and/or Compound Elements.

Basic Elements

  • Widget - An object embedded in a page, e.g. a form element, text element, button, etc
  • Field - A widget that is linked to a specific Attribute in a Schema and inherits its behaviour from that Attribute, e.g. an Actor's name is a text form field with defined size constraints
  • Nav - A widget that is used for site navigation, e.g. a clickable link with or without an icon

Compound Elements

  • Page - A layout of other elements in a page, with standard elements such as header, sidebar, footer, and content
  • Grid - A layout of other elements in rows and columns, both basic and compound
  • Form - An HTML5 Form
  • Table - An HTML5 Table
  • Tree - Currently not implemented, a layout of other elements in a hierarchical tree, e.g. a navigation menu

View Tables / Classes

ark_view_cell - ARK\View\Cell
ark_view_element - ARK\View\Element
ark_view_field - ARK\View\Field
ark_view_form - ARK\View\Form
ark_view_group - ARK\View\Grid
ark_view_nav - ARK\View\Nav
ark_view_page - ARK\View\Page
ark_view_table - ARK\View\Table
ark_view_tree - ARK\View\Tree
ark_view_type - ARK\View\Type
ark_view_widget - ARK\View\Widget

Tables

Tables are a Compound Element defined by the ARK\View\Table class, and can only embed ARK\View\Field or ARK\View\Widget Basic Elements. They cannot embed other Compound Elements. When a Table embeds Field Elements, then all Fields must belong to a single Schema, i.e. a Table embeds a Schema, with each row embedding an Item that is an instance of that Schema.

The Table Element is defined in the ark_view_table table, which is mapped by Doctrine to the ARK\View\Table class. The definition seeks to abstract the HTML5 Table definition and the currently chosen JavaScript Table widget in a generic way to avoid implementation specifics. The Twig or JavaScript frontends are expected to translate this generic definition into the specific implementation being used.

Table Definition
Database Field Class Method Datatype Description
element id() string The unique ID of the Table element
name name() string
type() ARK\View\Type
mode mode() boolean
caption showCaption() boolean Whether to show the HTML5 table caption element
header showHeader() boolean Whether to show the HTML5 table header element
footer showFooter() boolean Whether to show the HTML5 table footer element
sortable isSortable() boolean Whether the table rows can be sorted
searchable isSearchable() boolean Whether the table data is searchable
list enableListView() boolean Whether the table list view is enabled
detail enableDetailView() boolean Whether the table detail view is enabled
expand enableExpandListView() boolean Whether the table expand view is enabled (only if list and detail views are enabled)
card enableCardView() boolean Whether the table card view is enabled
thumb enableThumbnailView() boolean Whether the table thumbnail view is enabled
view defaultView() string Which table view is the default view, choice of list, card, or thumb
image image() string The data field to use for images, i.e. thumbnails
export canExportData() boolean Whether the table data can be exported
columns canChooseColumns() boolean Whether the table columns displayed can be selected
pagination pagination(), pageSize() boolean, integer The number of rows per page, defaults to 10
selection selection() string Whether data rows can be selected
keyword keyword() string, ARK\Translation\Keyword The translation keyword used for the table
classes classes() string Any extra CSS classes to add to the table
template template() string The TWIG template to use instead of the default table template
url dataUrl() string The server-side pagination URL