Page blocks

Each page contain 'blocks' section. Blocks is a build material for pages in hush. Each block may contain:

  • 'class' - which mostly is used for specifying width of the block.
  • 'title' - which describes content of title line, there commonly are located buttons for block actions. It may contain:

    • 'text' - will be printed on top of the block. May contain key of the translation or closure.
    • 'buttons' - describes buttons which will be printed on top of the block. Each button may contain:

      • 'permission' - if user does not have that permission, button will not be shown.
      • 'form' - if is set, button will submit form with id, which you enter as value for this attribute.
      • 'class' - will be applied to button. For example it may serve to change button color.
      • 'text' of the button.
      • 'icon' - will be printed to the left of the button text.
      • 'link' of the button. Does not work in pair with 'form'.
      • 'in-new-tab' - works only with 'link', will open link in new tab.
    • 'add' - shortcut for adding add button. Value may be bool or string which represents permission.

    • 'search' - shortcut for adding search button.
  • 'content' - which describes page content. It contain required property 'type' which describes content type, currently it can be table, form or view. More about types you can read below.

Table

Table type expectedly will build a table. It supports current properties:

  • 'checkboxes' - enables or disables checkbox column and multiple actions for that.
  • 'pagination' - enables or disables displaying of pagination row.
  • 'modal' - if is set to true, add and edit actions will be performed in modal window.
  • 'columns' - describes columns of the table. Column key must have name of model property, which it represents. Each column may contain:

    • 'label' - if you want customize the text, which should be printed.
    • 'type' if not specified, will be printed value from model property with name of the column. May have values image or closure. If set to image, then value will be located in img src attribute.
    • 'closure' - if 'type' is set to closure, then you can define this property which should describe a custom logic which will be performed for column value.
    • 'class' - will be attached to td column.
    • 'sortable' - if set to true, then user can click on column name and page will be reloaded with get params 'sort' and 'direction'. For sorting you may perform custom logic or use Sortable trait.
  • 'rows' - closure, which should return paginable result (if pagination is enabled).

  • 'actions' - describes actions, which can be performed on row. Each action can contain:

    • 'class' - class which will be attached to button.
    • 'condition' - closure, which result will be checked before drawing the button.
    • 'permission' - which will be checked before printing the button.
    • 'link' of button.
    • 'text' of button.
    • 'in-new-tab' - if is set to true, link will be opened in new tab.
    • 'icon' of button.
  • 'edit' - shortcut for edit button. You can specify permission in its value.

  • 'delete' - shortcut for delete button. You can specify permission in its value.
  • 'multiple-actions' - describes actions, which may be performed on multiple rows, when user checks the checkboxes.

    • 'link' - location, where to send request.
    • 'type' - request type (post, put, patch, delete).
    • 'confirmation' - if is set to true, user will see warning window before sending the request.
    • 'text' of button.

Form

Form type expectedly will build a form. It supports current properties:

  • 'link' - which will be printed to form action attribute.
  • 'id' of the form.
  • 'grid' - may be defined, if you want to print inputs in more than one column. Contains array of columns, each column contains from:

    • 'size' of the column (class, which will be attached to it), in most cases here can be used bootstrap grid system.
    • 'inputs' - array of inputs, which will be located here.
  • 'inputs' - array of inputs.

More about inputs you can read in Inputs section.

View

If type is set to view, then custom view will be printed to the block content. Supports only single property - 'view', which should contain name of the view, which should be drawed.