• Rendered into HTML

  • Rendered into PDF

  • Rendered into CSV

Top level DSL that is responsible for arranging page graphical elements and update ajaxBlocks altogether. In case we are rendering a complete page, we also have to specify the page menu description via the Menu DSL.

This DSL is also responsible for managing modal windows stack. Open a modal using modal or close modal using closeModalAndUpdateBlock (and other variants).

Block Building Code Sample

screenshot dsl block
Figure 1. Sample Block with Tabs (see Block Sample with Tabs).
Block Sample with Tabs
def editSlideshow(CmsPage slideshow) {
    UiBlockSpecifier b = new UiBlockSpecifier()

    Boolean createNew = slideshow == null
    if (!slideshow)
        slideshow = new CmsPage(pageType: CmsPageType.SLIDESHOW)

b.ui {
    if (createNew)
        modal {
    else {
        anonymousBlock BlockSpec.Width.HALF, {          (1)

        blockTabs BlockSpec.Width.HALF, {
            blockTab "Images", buildImagesTab(slideshow)(2)
            blockTab "Videos", buildVideosTab(slideshow)
taackUiService.show(b, buildMenu())                     (3)
  1. Declare an invisible block of 1/2 window width

  2. Declare 2 tabs inside, the first one is displayed when the page appear

  3. Send the bloc along with the menu description to the browser.

Modal Stack Code Sample

After processing a form, you can refresh the content of the page, or another modal below the current one. You also can reload the page, or display another page. Reloading the page allows the code to be reusable, since it does not depend on the current URL (remember the redirectAction params you see in First App (Adding buttons to a table block) .

Usually a modal is closed after processing a form. Either it is not valid, and errors are shown into the browser directly into the form, either we save the object and refresh the content.


Close Modal and reload the page

def saveCmsInsert() {

If no error is detected saving CmsInsert, the page is simply reloaded.

Close Modal and load a page

def saveCmsPage() {
    taackSaveService.saveThenRedirectOrRenderErrors(  (1)
        CmsPage, this.&pages as MethodClosure
  1. The method closure in this controller will be loaded (respecting URL Mappings)

Close Modal and refresh page ajax blocks

Complex Use Case: close the modal window and refresh ajaxBlock present in the page
    EngineeringChangeRequest,                                   (1)
    new UiBlockSpecifier().ui {                                 (2)
        closeModalAndUpdateBlock {                              (3)
            show "Projects", buildShowProjects(ecr),
                BlockSpec.Width.MAX, {
                        Ecr2Controller.&projectsForm as MC,
                        [id: ecr.id, ajaxBlockId: ajaxBlockId]
  1. After an action implying to save an object is called into a modal, you can close the modal and refresh page elements in one action

  2. saveThenDisplayBlockOrRenderErrors take a UiBlockSpecifier as parameter

  3. closeModalAndUpdateBlock will first close the last opened modal and then apply the modification

Block DSL Symbols Hierarchy

Figure 2. Symbols hierachy diagram for Block DSL

ajaxBlock can surround other elements and allows to update only a portion of the page.