Skip to content

Latest commit

 

History

History
201 lines (144 loc) · 2.66 KB

LAYOUT.md

File metadata and controls

201 lines (144 loc) · 2.66 KB

TEXT

Just Text

{
    "text": "Could be line here"
}

Variable

{
    "text": "Could be variable here {{$user.value}}"
}

Few lines

{
    "text": ["Could be", "Few lines"]
}

Localized

{
    "text": {
       "ru": "...",
       "en": "...",
       "ua": "...",
       "langVar": "$user.lang"
    }
}

langVar stores the name of varible where to get the current language

$user.lang = "en";

console.log($user.lang); //=> en

Images

Single Image

{
    "images": "https://.....com/image.png"
}

Few Images

{
    "images": ["https://.....com/image.png", "https://.....com/image2.png"]
}

BUTTONS

Just buttons

{
    "buttons": {
        "hello": "goto:another-step1",
        "world": "goto:another-step2"
    }
}

Buttons with store

{
    "buttons": {
        "hello": {
            "store": "$user.action = 'hello'",
            "goto": "another-step"
        }
    }
}

Use Livescript syntax inside store

Available variables: $user,$global

Localized buttons

{
    "buttons": {
        "button" : {
            "ru": {"buttonRUtext": { "goto" : "...", "store": "..." } },
            "en": {"buttonENtext": { "goto" : "...", "store": "..." } },
            "ua": {"buttonUAtext": { "goto" : "...", "store": "..." } },
            "langVar": "$user.lang"
        }
    }
}

MENU

Just menu

{
    "menu": {
        "hello": "goto:another-step1",
        "world": "goto:another-step2"
    }
}

Menu with store

{
    "menu": {
        "hello": {
            "store": "$user.action = 'hello'",
            "goto": "another-step"
        }
    }
}

Use Livescript syntax inside store

Available variables: $user,$global

Localized menu

{
    "menu": {
        "button" : {
            "ru": {"buttonRUtext": { "goto" : "...", "store": "..." } },
            "en": {"buttonENtext": { "goto" : "...", "store": "..." } },
            "ua": {"buttonUAtext": { "goto" : "...", "store": "..." } },
            "langVar": "$user.lang"
        }
    }
}

CONDITIONS

onText

{
    "onText": {
        "validate": ["^[a-z]+[@][a-z]+$"],
        "store": "$user.firstname = $text"
    }
}

Use Livescript syntax inside store

Available variables: $user,$global, $text

validate field contains the array of regexp validations

redirectCondition

{
    "redirectCondition": {
        "($user.lang ? '').length is 2": "choose-action-step"
    }
}

redirectCondition is object where

  • keys are conditions
  • values are step names