Differences between revisions 7 and 8
Revision 7 as of 2006-08-11 13:11:16
Size: 2939
Editor: BenGolding
Comment:
Revision 8 as of 2006-08-11 13:49:38
Size: 2932
Editor: BenGolding
Comment:
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
    ctx.locals. Here's an example: if check1 isn't already set in your context, in your
    {{{page_setup}}} method you can initialise it using:
    ctx.locals. Here's an example: if check1 isn't already set in your context, your
    {{{page_setup}}} method can initialise it using:

Albatross's templating engine supports a number of special html tags which interact with the application framework.

  • Application tags
    • <al-value>

    • <al-a>

    • <al-form>

    • <al-input>

      • Each of the al-input types has the same style, each reading and setting a named value in ctx.locals. Here's an example: if check1 isn't already set in your context, your

        page_setup method can initialise it using:

           1     ctx.locals.check1 = 1
        
        Invoke the html in your html view:
            <al-input type="checkbox" name="check1">

        When the page comes back from the server, you can inspect the value in page_process using:

           1     if ctx.local.check1:
           2         selected()
           3     else:
           4         unselected()
        
        Text field:
            <al-input name="text">
        Singleton checkbox:
            <al-input type="checkbox" name="singleton">
        Checkbox group:
            <al-input type="checkbox" name="group" value="check1">
            <al-input type="checkbox" name="group" value="check2">
        Radio buttons:
            <al-input type="radio" name="radio" value="radio1">
            <al-input type="radio" name="radio" value="radio2">
        Option menu: XXX describe how to set up an option list
            <al-select name="select1" optionexpr="option_list1"/>
            <al-select name="select2" optionexpr="option_list2"/>
        Input button
            <al-input type="submit" value="submit">
        XXX example here of how to take different action based on save/cancel buttons
    • <al-select>/<al-option>

    • <al-lookup>/<al-item>

      • Al-lookup does a simple table lookup of a value and is replaced with the matching result or nothing if no value is matched. The following is a table which translates the internal program value into HTML for display.
        <al-lookup name="bug-severity">
         <al-item expr="btsvalues.TRIVIAL"><font color="green">Trivial</font></al-item>
         <al-item expr="btsvalues.MINOR">Minor</al-item>
         <al-item expr="btsvalues.NORMAL">Normal</al-item>
         <al-item expr="btsvalues.MAJOR"><font color="red">Major</font></al-item>
         <al-item expr="btsvalues.CRITICAL"><font color="red"><b>Critical</b></font></al-item>
        </al-lookup>

        The btsvalues module must be visible when the <al-lookup> tag is executed. You can place the btsvalues module in the the global namespace of the execution context by importing the btsvalues module in the same module which creates the execution context.

        We invoke the lookup table by using the lookup attribute of the <al-value> tag.

        Severity: <al-value expr="bug.severity" lookup="bug-severity">
        Note that the btsvalues module does not need to be in the namespace at this point.
  • Flow control
    • <al-for>

    • <al-if>/<al-else>

    • <al-exec>

  • Substitution
    • <al-include>

    • <al-macro>/<al-expand>

None: Tags (last edited 2011-02-15 06:05:18 by localhost)