Differences between revisions 4 and 5
Revision 4 as of 2006-08-11 12:36:28
Size: 1646
Editor: BenGolding
Comment:
Revision 5 as of 2006-08-11 12:44:24
Size: 2053
Editor: BenGolding
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
    If check1 isn't already set in your context, in your {{{page_setup}}} method you can initialise it using:
    {{{#!python
    ctx.locals.check1 = 1
    }}}
    Invoke the html in your html view:
    {{{
Line 9: Line 15:
    }}}
    When the page comes back from the server, you can inspect the value using:
    {{{#!python
    if ctx.local.check1:
        selected()
    else:
        unselected()
    }}}

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>

      • If check1 isn't already set in your context, in your page_setup method you can initialise it using:

           1     ctx.locals.check1 = 1
        
        Invoke the html in your html view:
            <al-input type="checkbox" name="group" value="check1">
        When the page comes back from the server, you can inspect the value using:
           1     if ctx.local.check1:
           2         selected()
           3     else:
           4         unselected()
        
    • <al-select>/<al-option>

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

      • 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. When using other Albatross execution contexts you would need to import btsvalues in the module which called run_template() or run_template_once() to execute the <al-lookup> tag.

        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)