Skip to content

Commit

Permalink
Provides a description of ASSIGNJS helper in the section where view h…
Browse files Browse the repository at this point in the history
…elpers are described.

(see issue #366)
  • Loading branch information
snidelytoo committed Aug 16, 2017
1 parent f288f41 commit 8970e73
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion sources/29-web2py-english/05.markmin
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,18 @@ attributes = {'_id':'123', '_class':'myclass'}

The following set of helpers:

``A``, ``B``, ``BEAUTIFY``, ``BODY``, ``BR``, ``CAT``, ``CENTER``, ``CODE``, ``COL``, ``COLGROUP``, ``DIV``, ``EM``, ``EMBED``, ``FIELDSET``, ``FORM``, ``H1``, ``H2``, ``H3``, ``H4``, ``H5``, ``H6``, ``HEAD``, ``HR``, ``HTML``, ``I``, ``IFRAME``, ``IMG``, ``INPUT``, ``LABEL``, ``LEGEND``, ``LI``, ``LINK``, ``MARKMIN``, ``MENU``, ``META``, ``OBJECT``, ``ON``, ``OL``, ``OPTGROUP``, ``OPTION``, ``P``, ``PRE``, ``SCRIPT``, ``SELECT``, ``SPAN``, ``STYLE``, ``TABLE``, ``TAG``, ``TBODY``, ``TD``, ``TEXTAREA``, ``TFOOT``, ``TH``, ``THEAD``, ``TITLE``, ``TR``, ``TT``, ``UL``, ``URL``, ``XHTML``, ``XML``, ``embed64``, ``xmlescape``
``A``, ``ASSIGNJS``, ``B``, ``BEAUTIFY``, ``BODY``, ``BR``,
``CAT``, ``CENTER``, ``CODE``, ``COL``, ``COLGROUP``, ``DIV``,
``EM``, ``EMBED``, ``FIELDSET``, ``FORM``,
``H1``, ``H2``, ``H3``, ``H4``, ``H5``, ``H6``, ``HEAD``,
``HR``, ``HTML``, ``I``, ``IFRAME``, ``IMG``, ``INPUT``,
``LABEL``, ``LEGEND``, ``LI``, ``LINK``,
``MARKMIN``, ``MENU``, ``META``, ``OBJECT``, ``ON``, ``OL``,
``OPTGROUP``, ``OPTION``, ``P``, ``PRE``,
``SCRIPT``, ``SELECT``, ``SPAN``, ``STYLE``,
``TABLE``, ``TAG``, ``TBODY``, ``TD``, ``TEXTAREA``, ``TFOOT``,
``TH``, ``THEAD``, ``TITLE``, ``TR``, ``TT``,
``UL``, ``URL``, ``XHTML``, ``XML``, ``embed64``, ``xmlescape``

can be used to build complex expressions that can then be serialized to XML``xml-w``:cite ``xml-o``:cite. For example:
``
Expand Down Expand Up @@ -440,6 +451,32 @@ and a click on the link causes the content to be loaded in the div. This is simi

These ajax features require jQuery and "static/js/web2py_ajax.js", which are automatically included by placing ``{{include 'web2py_ajax.html'}}`` in the layout head. "views/web2py_ajax.html" defines some variables based on ``request`` and includes all necessary js and css files.

#### ``ASSIGNJS``
``ASSIGNJS``:inxx

ASSIGNJS allows a server-side value to be used as a client-side
javascript value.

For instance, if in a controller you write

``
return dict(stra='abcd', obj=alist)
``:code

and in a view write

``
<script>
{{=ASSIGNJS(o=obj)}}
...
``:code

Then the javascript variable o will have the value passed in obj,
which is alist.

A further example is shown below under
[[Javascript In Views #Javascriptinviews]].


#### ``B``
``B``:inxx
Expand Down Expand Up @@ -1897,6 +1934,7 @@ we get:


``javascript``:inxx
[[Javascriptinviews]]
### Javascript in views

Helpers can be used within external code by placing it in a template and then including the template where needed. For example, if some javascript code is in a file "/views/my.js", then it can be included in a view file:
Expand Down

0 comments on commit 8970e73

Please sign in to comment.