You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2019/09/07 01:20:17 UTC
svn commit: r1049752 [3/5] -
/websites/production/tapestry/content/5.4.5/coffeescript/
Added: websites/production/tapestry/content/5.4.5/coffeescript/fields.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/fields.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/fields.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,530 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>fields.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>fields.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Copyright 2012-2013 The Apache Software Foundation</p>
+<p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-fields">t5/core/fields</h2>
+<p>Module for logic relating to form input fields (input, select, textarea); specifically
+presenting validation errors and perfoming input validation when necessary.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>define [<span class="hljs-string">"underscore"</span>, <span class="hljs-string">"./events"</span>, <span class="hljs-string">"./dom"</span>, <span class="hljs-string">"./utils"</span>, <span class="hljs-string">"./forms"</span>],
+ <span class="hljs-function"><span class="hljs-params">(_, events, dom, utils)</span> -></span>
+<span class="hljs-function">
+ <span class="hljs-title">ensureFieldId</span> = <span class="hljs-params">(field)</span> -></span>
+ fieldId = field.attr <span class="hljs-string">"id"</span>
+
+ <span class="hljs-keyword">unless</span> fieldId
+ fieldId = _.uniqueId <span class="hljs-string">"field"</span>
+ field.attr <span class="hljs-string">"id"</span>, fieldId
+
+ <span class="hljs-keyword">return</span> fieldId</pre></div></div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>Finds any <code>.help-block</code> used for presenting errors for the provided field.
+Returns the found block(s) as an array of ElementWrapper. Returns null
+if no blocks can be found.</p>
+<p>Normally, you would expect just a single help block for a field, but in some cases,
+such as to support responsive layout, there will be multiple help blocks for a single field.</p>
+<ul>
+<li>field - element wrapper for the field</li>
+</ul>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">findHelpBlocks</span> = <span class="hljs-params">(field)</span> -></span>
+ fieldId = field.attr <span class="hljs-string">"id"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-4">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-4">¶</a>
+ </div>
+ <p>When the field has an id (the normal case!), search the body for
+the matching help blocks.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> fieldId
+ blocks = dom.body.find <span class="hljs-string">"[data-error-block-for='<span class="hljs-subst">#{fieldId}</span>']"</span>
+
+ <span class="hljs-keyword">return</span> blocks <span class="hljs-keyword">if</span> blocks.length > <span class="hljs-number">0</span>
+ <span class="hljs-keyword">else</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-5">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-5">¶</a>
+ </div>
+ <p>Assign a unique (hopefully!) client id for the field, which will be
+used to link the field and the new help-block together.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> fieldId = ensureFieldId field</pre></div></div>
+
+ </li>
+
+
+ <li id="section-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">¶</a>
+ </div>
+ <p>Not found by id, but see if an empty placeholder was provided within
+the same .form-group.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+ group = field.findParent <span class="hljs-string">".form-group"</span>
+
+ <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span> <span class="hljs-keyword">unless</span> group</pre></div></div>
+
+ </li>
+
+
+ <li id="section-7">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-7">¶</a>
+ </div>
+ <p>This happens less often, now that the Errors component ensures (at render time)
+a fieldId and a data-error-block-for element. Even so, sometimes a template
+will just contain a div.help-block[data-presentation=error]</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> block = group.findFirst <span class="hljs-string">"[data-presentation=error]"</span>
+
+ <span class="hljs-keyword">if</span> block
+ block.attr <span class="hljs-string">"data-error-block-for"</span>, fieldId
+ <span class="hljs-keyword">return</span> [block]</pre></div></div>
+
+ </li>
+
+
+ <li id="section-8">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-8">¶</a>
+ </div>
+ <p>Not found, so perhaps it will be created dynamically.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>
+<span class="hljs-function">
+ <span class="hljs-title">createHelpBlock</span> = <span class="hljs-params">(field)</span> -></span>
+ fieldId = ensureFieldId field</pre></div></div>
+
+ </li>
+
+
+ <li id="section-9">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-9">¶</a>
+ </div>
+ <p>No containing group ⦠this is a problem, probably an old 5.3 application upgraded to 5.4
+or beyond. Place the block just after the field.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+ container = field.parent()
+
+ block = dom.create "p",
+ class: "help-block"
+ "data-error-block-for": fieldId</pre></div></div>
+
+ </li>
+
+
+ <li id="section-10">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-10">¶</a>
+ </div>
+ <p>The .input-group selectors are used to attach buttons or markers to the field.
+In which case, the help block can go after the group instead.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">if</span> container.hasClass(<span class="hljs-string">"input-group"</span>)
+ container.insertAfter block
+ <span class="hljs-keyword">else</span>
+ field.insertAfter block
+
+ <span class="hljs-keyword">return</span> block
+<span class="hljs-function">
+ <span class="hljs-title">showValidationError</span> = <span class="hljs-params">(id, message)</span> -></span>
+ dom.wrap(id).trigger events.field.showValidationError, { message }
+<span class="hljs-function">
+ <span class="hljs-title">collectOptionValues</span> = <span class="hljs-params">(wrapper)</span> -></span>
+ _.pluck wrapper.element.options, <span class="hljs-string">"value"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-11">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-11">¶</a>
+ </div>
+ <p>Default registrations:</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+ dom.onDocument events.field.inputValidation, <span class="hljs-function"><span class="hljs-params">(event, formMemo)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-12">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-12">¶</a>
+ </div>
+ <p>Fields that are disbled, or not visible to the user are not subject to
+validation. Typically, a field will only be invisible due to the
+core/FormFragment component.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-property">@element</span>.disabled <span class="hljs-keyword">or</span> (<span class="hljs-keyword">not</span> <span class="hljs-property">@deepVisible</span>())
+
+ failure = <span class="hljs-literal">false</span>
+
+ fieldValue =
+ <span class="hljs-keyword">if</span> (<span class="hljs-property">@attr</span> <span class="hljs-string">"data-value-mode"</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">"options"</span>
+ collectOptionValues <span class="hljs-keyword">this</span>
+ <span class="hljs-keyword">else</span>
+ <span class="hljs-property">@value</span>()
+
+ memo = <span class="hljs-attribute">value</span>: fieldValue
+<span class="hljs-function">
+ <span class="hljs-title">postEventTrigger</span> = =></span>
+ <span class="hljs-keyword">if</span> memo.error</pre></div></div>
+
+ </li>
+
+
+ <li id="section-13">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-13">¶</a>
+ </div>
+ <p>Assume the event handler displayed the message.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> failure = <span class="hljs-literal">true</span>
+
+ <span class="hljs-keyword">if</span> _.isString memo.error
+
+ <span class="hljs-property">@trigger</span> events.field.showValidationError, { <span class="hljs-attribute">message</span>: memo.error }
+
+ <span class="hljs-property">@trigger</span> events.field.optional, memo
+
+ postEventTrigger()
+
+ <span class="hljs-keyword">unless</span> failure <span class="hljs-keyword">or</span> (utils.isBlank memo.value)
+
+ <span class="hljs-property">@trigger</span> events.field.translate, memo
+
+ postEventTrigger()
+
+ <span class="hljs-keyword">unless</span> failure
+ <span class="hljs-keyword">if</span> _.isUndefined memo.translated
+ memo.translated = memo.value
+
+ <span class="hljs-property">@trigger</span> events.field.validate, memo
+
+ postEventTrigger()
+
+ <span class="hljs-keyword">if</span> failure
+ formMemo.error = <span class="hljs-literal">true</span>
+ <span class="hljs-keyword">else</span>
+ <span class="hljs-property">@trigger</span> events.field.clearValidationError
+
+ <span class="hljs-keyword">return</span>
+
+ dom.onDocument events.field.clearValidationError, <span class="hljs-function">-></span>
+ blocks = exports.findHelpBlocks <span class="hljs-keyword">this</span>
+
+ <span class="hljs-keyword">for</span> block <span class="hljs-keyword">in</span> blocks <span class="hljs-keyword">or</span> []
+ block.hide().update(<span class="hljs-string">""</span>)
+ block.parent().removeClass <span class="hljs-string">"has-error"</span>
+
+ group = <span class="hljs-property">@findParent</span> <span class="hljs-string">".form-group"</span>
+
+ group <span class="hljs-keyword">and</span> group.removeClass <span class="hljs-string">"has-error"</span>
+
+ <span class="hljs-keyword">return</span>
+
+ dom.onDocument events.field.showValidationError, <span class="hljs-function"><span class="hljs-params">(event, memo)</span> -></span>
+ blocks = exports.findHelpBlocks <span class="hljs-keyword">this</span>
+
+ <span class="hljs-keyword">unless</span> blocks
+ blocks = [exports.createHelpBlock <span class="hljs-keyword">this</span>]
+
+ <span class="hljs-keyword">for</span> block <span class="hljs-keyword">in</span> blocks
+ block.removeClass(<span class="hljs-string">"invisible"</span>).show().update(memo.message)</pre></div></div>
+
+ </li>
+
+
+ <li id="section-14">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-14">¶</a>
+ </div>
+ <p>Add âhas-errorâ to the help-blockâs immediate container; this assist with some layout issues
+where the help block canât be under the same .form-group element as the field (more common
+with a horizontal form layout).</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> block.parent().addClass(<span class="hljs-string">"has-error"</span>)
+
+ group = <span class="hljs-property">@findParent</span> <span class="hljs-string">".form-group"</span>
+
+ container = group <span class="hljs-keyword">or</span> <span class="hljs-property">@parent</span>().closest(<span class="hljs-string">":not(.input-group)"</span>)
+
+ container.addClass <span class="hljs-string">"has-error"</span>
+
+ <span class="hljs-keyword">return</span>
+
+ exports = {findHelpBlocks, createHelpBlock, showValidationError}</pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>
Added: websites/production/tapestry/content/5.4.5/coffeescript/form-fragment.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/form-fragment.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/form-fragment.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,368 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>form-fragment.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>form-fragment.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-form-fragment">t5/core/form-fragment</h2>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>define [<span class="hljs-string">"underscore"</span>, <span class="hljs-string">"./dom"</span>, <span class="hljs-string">"./events"</span>, <span class="hljs-string">"./forms"</span>],
+ <span class="hljs-function"><span class="hljs-params">(_, dom, events)</span> -></span>
+
+ SELECTOR = <span class="hljs-string">"[data-component-type='core/FormFragment']"</span>
+
+ REENABLE = <span class="hljs-string">"data-re-enable-when-fragment-visible"</span>
+<span class="hljs-function">
+ <span class="hljs-title">disableInputFields</span> = <span class="hljs-params">(fragment)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>This is an example of where the t5/core/dom abstraction label is problematic,
+as this is very inefficient vs. the native jQuery approach.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">for</span> field <span class="hljs-keyword">in</span> fragment.find <span class="hljs-string">"input:not(:disabled)"</span>
+ field.attr <span class="hljs-string">"disabled"</span>, <span class="hljs-literal">true</span>
+ field.attr REENABLE, <span class="hljs-literal">true</span>
+<span class="hljs-function">
+ <span class="hljs-title">renableInputFields</span> = <span class="hljs-params">(fragment)</span> -></span>
+
+ <span class="hljs-keyword">for</span> field <span class="hljs-keyword">in</span> fragment.find <span class="hljs-string">"input[<span class="hljs-subst">#{REENABLE}</span>]"</span>
+ field.attr <span class="hljs-string">"disabled"</span>, <span class="hljs-literal">null</span>
+ field.attr REENABLE, <span class="hljs-literal">null</span>
+<span class="hljs-function">
+ <span class="hljs-title">updateFields</span> = <span class="hljs-params">(fragment, makeVisible)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-4">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-4">¶</a>
+ </div>
+ <p>This is a server side option that says the content of the fragment should always be submitted,
+even if the fragment is not currently visible.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> fragment.attr <span class="hljs-string">"data-always-submit"</span>
+
+ f = <span class="hljs-keyword">if</span> makeVisible <span class="hljs-keyword">then</span> renableInputFields <span class="hljs-keyword">else</span> disableInputFields
+
+ f fragment</pre></div></div>
+
+ </li>
+
+
+ <li id="section-5">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-5">¶</a>
+ </div>
+ <p>Again, a DOM event to make the FormFragment visible or invisible; this is useful
+because of the didShow/didHide events ⦠but weâre really just seeing the evolution
+from the old style (the FormFragment class as controller) to the new style (DOM events and
+top-level event handlers).</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> dom.onDocument events.formfragment.changeVisibility, SELECTOR, <span class="hljs-function"><span class="hljs-params">(event)</span> -></span>
+ makeVisible = event.memo.visible
+
+ <span class="hljs-keyword">this</span>[<span class="hljs-keyword">if</span> makeVisible <span class="hljs-keyword">then</span> <span class="hljs-string">"show"</span> <span class="hljs-keyword">else</span> <span class="hljs-string">"hide"</span>]()
+
+ updateFields <span class="hljs-keyword">this</span>, makeVisible
+
+ <span class="hljs-property">@trigger</span> events.element[<span class="hljs-keyword">if</span> makeVisible <span class="hljs-keyword">then</span> <span class="hljs-string">"didShow"</span> <span class="hljs-keyword">else</span> <span class="hljs-string">"didHide"</span>]
+
+ <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">¶</a>
+ </div>
+ <p>When a FormFragment is initially rendered as hidden, then we need to do some
+book-keeping on the client side.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">hide</span> = <span class="hljs-params">(id)</span> -></span>
+ field = dom(id)
+
+ updateFields field, <span class="hljs-literal">false</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-7">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-7">¶</a>
+ </div>
+ <p>Initializes a trigger for a FormFragment</p>
+<ul>
+<li>spec.triggerId - id of checkbox or radio button</li>
+<li>spec.fragmentId - id of FormFragment element</li>
+<li>spec.invert - (optional) if true, then checked trigger hides (not shows) the fragment</li>
+</ul>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">linkTrigger</span> = <span class="hljs-params">(spec)</span> -></span>
+ <span class="hljs-keyword">unless</span> spec.triggerId? <span class="hljs-keyword">then</span> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Incomplete parameters, triggerId is null"</span>
+ <span class="hljs-keyword">unless</span> spec.fragmentId? <span class="hljs-keyword">then</span> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Incomplete parameters, fragmentId is null"</span>
+ trigger = dom spec.triggerId
+ fragment = dom spec.fragmentId
+ <span class="hljs-keyword">if</span> fragment <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span>
+ <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> Error <span class="hljs-string">"Invalid configuration, fragment with id <span class="hljs-subst">#{spec.fragmentId}</span> not found"</span>
+
+ invert = spec.invert <span class="hljs-keyword">or</span> <span class="hljs-literal">false</span>
+<span class="hljs-function">
+ <span class="hljs-title">update</span> = -></span>
+ checked = trigger.element.checked
+ makeVisible = checked <span class="hljs-keyword">isnt</span> invert
+
+ fragment.trigger events.formfragment.changeVisibility, <span class="hljs-attribute">visible</span>: makeVisible
+
+ <span class="hljs-keyword">return</span>
+
+ <span class="hljs-keyword">if</span> trigger.element.type <span class="hljs-keyword">is</span> <span class="hljs-string">"radio"</span>
+ dom.<span class="hljs-literal">on</span> trigger.element.form, <span class="hljs-string">"click"</span>, update
+ <span class="hljs-keyword">else</span>
+ trigger.<span class="hljs-literal">on</span> <span class="hljs-string">"click"</span>, update</pre></div></div>
+
+ </li>
+
+
+ <li id="section-8">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-8">¶</a>
+ </div>
+ <p>Module exports:</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> { linkTrigger, hide }</pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>
Added: websites/production/tapestry/content/5.4.5/coffeescript/forms.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/forms.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/forms.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,619 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>forms.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>forms.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Copyright 2012, 2013 The Apache Software Foundation</p>
+<p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-forms">t5/core/forms</h2>
+<p>Defines handlers for HTML forms and HTML field elements, specifically to control input validation.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+define [<span class="hljs-string">"./events"</span>, <span class="hljs-string">"./dom"</span>, <span class="hljs-string">"underscore"</span>],
+ <span class="hljs-function"><span class="hljs-params">(events, dom, _)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>Meta-data name that indicates the next submission should skip validation (typically, because
+the form was submitted by a âcancelâ button).</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> SKIP_VALIDATION = <span class="hljs-string">"t5:skip-validation"</span>
+<span class="hljs-function">
+ <span class="hljs-title">clearSubmittingHidden</span> = <span class="hljs-params">(form)</span> -></span>
+ hidden = form.findFirst <span class="hljs-string">"[name='t:submit']"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-4">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-4">¶</a>
+ </div>
+ <p>Clear if found</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> hidden <span class="hljs-keyword">and</span> hidden.value <span class="hljs-literal">null</span>
+
+ form.meta SKIP_VALIDATION, <span class="hljs-literal">null</span>
+
+ <span class="hljs-keyword">return</span>
+<span class="hljs-function">
+ <span class="hljs-title">setSubmittingHidden</span> = <span class="hljs-params">(form, submitter)</span> -></span>
+
+ mode = submitter.attr <span class="hljs-string">"data-submit-mode"</span>
+ isCancel = mode <span class="hljs-keyword">is</span> <span class="hljs-string">"cancel"</span>
+ <span class="hljs-keyword">if</span> mode <span class="hljs-keyword">and</span> mode <span class="hljs-keyword">isnt</span> <span class="hljs-string">"normal"</span>
+ form.meta SKIP_VALIDATION, <span class="hljs-literal">true</span>
+
+ hidden = form.findFirst <span class="hljs-string">"[name='t:submit']"</span>
+
+ <span class="hljs-keyword">unless</span> hidden
+ firstHidden = form.findFirst <span class="hljs-string">"input[type=hidden]"</span>
+ hidden = dom.create <span class="hljs-string">"input"</span>, <span class="hljs-attribute">type</span>: <span class="hljs-string">"hidden"</span>, <span class="hljs-attribute">name</span>: <span class="hljs-string">"t:submit"</span>
+ firstHidden.insertBefore hidden</pre></div></div>
+
+ </li>
+
+
+ <li id="section-5">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-5">¶</a>
+ </div>
+ <p>TODO: Research why we need id and name and get rid of one if possible.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> name = <span class="hljs-keyword">if</span> isCancel <span class="hljs-keyword">then</span> <span class="hljs-string">"cancel"</span> <span class="hljs-keyword">else</span> submitter.element.name</pre></div></div>
+
+ </li>
+
+
+ <li id="section-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">¶</a>
+ </div>
+ <p>Not going to drag in all of json2 just for this one purpose, but even
+so, Iâd like to get rid of this. Prototype includes Object.toJSON(), but jQuery
+is curiously absent an equivalent.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> hidden.value <span class="hljs-string">"[\"<span class="hljs-subst">#{submitter.element.id}</span>\",\"<span class="hljs-subst">#{name}</span>\"]"</span>
+
+ <span class="hljs-keyword">return</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-7">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-7">¶</a>
+ </div>
+ <p>Passed the element wrapper for a form element, returns a map of all the values
+for all non-disabled fields (including hidden fields, select, textarea). This is primarily
+used when assembling an Ajax request for a form submission.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">gatherParameters</span> = <span class="hljs-params">(form)</span> -></span>
+ result = {}
+
+ fields = form.find <span class="hljs-string">"input, select, textarea"</span>
+
+ _.each fields, <span class="hljs-function"><span class="hljs-params">(field)</span> -></span>
+ <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> field.attr <span class="hljs-string">"disabled"</span>
+
+ type = field.element.type</pre></div></div>
+
+ </li>
+
+
+ <li id="section-8">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-8">¶</a>
+ </div>
+ <p>Ignore types file and submit; file doesnât make sense for Ajax, and submit
+is handled by keeping a hidden field active with the data Tapestry needs
+on the server.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> type <span class="hljs-keyword">is</span> <span class="hljs-string">"file"</span> <span class="hljs-keyword">or</span> type <span class="hljs-keyword">is</span> <span class="hljs-string">"submit"</span>
+
+ <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> (type <span class="hljs-keyword">is</span> <span class="hljs-string">"checkbox"</span> <span class="hljs-keyword">or</span> type <span class="hljs-keyword">is</span> <span class="hljs-string">"radio"</span>) <span class="hljs-keyword">and</span> field.checked() <span class="hljs-keyword">is</span> <span class="hljs-literal">false</span>
+
+ value = field.value()
+
+ <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> value <span class="hljs-keyword">is</span> <span class="hljs-literal">null</span>
+
+ name = field.element.name</pre></div></div>
+
+ </li>
+
+
+ <li id="section-9">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-9">¶</a>
+ </div>
+ <p>Many modern UIs create name-less elements on the fly (e.g., Backbone); these may be mixed
+in with normal elements managed by Tapestry but should be ignored (not sent to the server in a POST
+or Ajax update).</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> name <span class="hljs-keyword">is</span> <span class="hljs-string">""</span>
+
+ existing = result[name]
+
+ <span class="hljs-keyword">if</span> _.isArray existing
+ existing.push value
+ <span class="hljs-keyword">return</span>
+
+ <span class="hljs-keyword">if</span> existing
+ result[name] = [existing, value]
+ <span class="hljs-keyword">return</span>
+
+ result[name] = value
+
+ <span class="hljs-keyword">return</span> result
+<span class="hljs-function">
+
+ <span class="hljs-title">defaultValidateAndSubmit</span> = -></span>
+<span class="hljs-function">
+ <span class="hljs-title">where</span> = -></span> <span class="hljs-string">"processing form submission"</span>
+
+ <span class="hljs-keyword">try</span>
+
+ <span class="hljs-keyword">if</span> ((<span class="hljs-property">@attr</span> <span class="hljs-string">"data-validate"</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">"submit"</span>) <span class="hljs-keyword">and</span>
+ (<span class="hljs-keyword">not</span> <span class="hljs-property">@meta</span> SKIP_VALIDATION)
+
+ <span class="hljs-property">@meta</span> SKIP_VALIDATION, <span class="hljs-literal">null</span>
+
+ hasError = <span class="hljs-literal">false</span>
+ focusField = <span class="hljs-literal">null</span>
+
+ <span class="hljs-keyword">for</span> field <span class="hljs-keyword">in</span> <span class="hljs-property">@find</span> <span class="hljs-string">"[data-validation]"</span>
+ memo = {}
+<span class="hljs-function"> <span class="hljs-title">where</span> = -></span> <span class="hljs-string">"triggering <span class="hljs-subst">#{events.field.inputValidation}</span> event on <span class="hljs-subst">#{field.toString()}</span>"</span>
+ field.trigger events.field.inputValidation, memo
+
+ <span class="hljs-keyword">if</span> memo.error
+ hasError = <span class="hljs-literal">true</span>
+ focusField = field <span class="hljs-keyword">unless</span> focusField</pre></div></div>
+
+ </li>
+
+
+ <li id="section-10">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-10">¶</a>
+ </div>
+ <p>Only do form validation if all individual field validation
+was successful.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">unless</span> hasError
+ memo = {}
+<span class="hljs-function"> <span class="hljs-title">where</span> = -></span> <span class="hljs-string">"trigging cross-form validation event"</span>
+ <span class="hljs-property">@trigger</span> events.form.validate, memo
+
+ hasError = memo.error
+
+ <span class="hljs-keyword">if</span> hasError
+ clearSubmittingHidden <span class="hljs-keyword">this</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-11">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-11">¶</a>
+ </div>
+ <p>If a specific field has been identified as the source of the validation error, then
+focus on it.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> focusField.focus() <span class="hljs-keyword">if</span> focusField</pre></div></div>
+
+ </li>
+
+
+ <li id="section-12">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-12">¶</a>
+ </div>
+ <p>Trigger an event to inform that form validation results in error</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">where</span> = -></span> <span class="hljs-string">"triggering validation in error event"</span>
+ <span class="hljs-property">@trigger</span> events.form.validateInError</pre></div></div>
+
+ </li>
+
+
+ <li id="section-13">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-13">¶</a>
+ </div>
+ <p>Cancel the original submit event when thereâs an error</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-14">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-14">¶</a>
+ </div>
+ <p>Allow certain types of elements to do last-moment set up. Basically, this is for
+FormFragment, or similar, to make their hidden field enabled or disabled to match
+their UIâs visible/hidden status. This is assumed to work or throw an exception; there
+is no memo.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">where</span> = -></span> <span class="hljs-string">"triggering <span class="hljs-subst">#{events.form.prepareForSubmit}</span> event (after validation)"</span>
+
+ <span class="hljs-property">@trigger</span> events.form.prepareForSubmit
+
+ <span class="hljs-keyword">catch</span> error
+ <span class="hljs-built_in">console</span>.error <span class="hljs-string">"Form validiation/submit error `<span class="hljs-subst">#{error.toString()}</span>', in form <span class="hljs-subst">#{<span class="hljs-keyword">this</span>.toString()}</span>, <span class="hljs-subst">#{where()}</span>"</span>
+ <span class="hljs-built_in">console</span>.error error
+ <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-15">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-15">¶</a>
+ </div>
+ <p>Otherwise, the event is good, there are no validation problems, let the normal processing commence.
+Possibly, the document event handler provided by the t5/core/zone module will intercept form submission if this
+is an Ajax submission.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span>
+
+ dom.onDocument <span class="hljs-string">"submit"</span>, <span class="hljs-string">"form"</span>, defaultValidateAndSubmit</pre></div></div>
+
+ </li>
+
+
+ <li id="section-16">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-16">¶</a>
+ </div>
+ <p>On any click on a submit or image, update the containing form to indicate that the element
+was responsible for the eventual submit; this is very important to Ajax updates, otherwise the
+information about which control triggered the submit gets lost.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> dom.onDocument <span class="hljs-string">"click"</span>, <span class="hljs-string">"input[type=submit], input[type=image]"</span>, <span class="hljs-function">-></span>
+ setSubmittingHidden (dom <span class="hljs-property">@element</span>.form), <span class="hljs-keyword">this</span>
+ <span class="hljs-keyword">return</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-17">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-17">¶</a>
+ </div>
+ <p>Support for link submits. <code>data-submit-mode</code> will be non-null, possibly âcancelâ.
+Update the hidden field, but also cancel the default behavior for the click.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> dom.onDocument <span class="hljs-string">"click"</span>, <span class="hljs-string">"a[data-submit-mode]"</span>, <span class="hljs-function">-></span>
+ form = <span class="hljs-property">@findParent</span> <span class="hljs-string">"form"</span>
+
+ <span class="hljs-keyword">unless</span> form
+ <span class="hljs-built_in">console</span>.error <span class="hljs-string">"Submitting link element not contained inside a form element."</span>
+ <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>
+
+ setSubmittingHidden form, <span class="hljs-property">@closest</span> <span class="hljs-string">"a[data-submit-mode]"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-18">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-18">¶</a>
+ </div>
+ <p>Now the ugly part; if we just invoke submit() on the form, it does not trigger
+the formâs âsubmitâ event, which we need.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+ form.trigger <span class="hljs-string">"submit"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-19">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-19">¶</a>
+ </div>
+ <p>And cancel the default behavior for the original click event</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>
+
+ exports =
+ <span class="hljs-attribute">gatherParameters</span>: gatherParameters
+
+ <span class="hljs-attribute">setSubmittingElement</span>: setSubmittingHidden</pre></div></div>
+
+ </li>
+
+
+ <li id="section-20">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-20">¶</a>
+ </div>
+ <p>Sets a flag on the form to indicate that client-side validation should be bypassed.
+This is typically associated with submit buttons that âcancelâ the form.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-attribute">skipValidation</span>: <span class="hljs-function"><span class="hljs-params">(form)</span> -></span>
+ form.meta SKIP_VALIDATION, <span class="hljs-literal">true</span></pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>
Added: websites/production/tapestry/content/5.4.5/coffeescript/init.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/init.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/init.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,238 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>init.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>init.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Copyright 2012 The Apache Software Foundation</p>
+<p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-init">t5/core/init</h2>
+<p>Compatibility module, invokes functions on the T5.initializers namespace.</p>
+<p>Introduced in 5.4, to be removed at some point in the future, when T5.initializers is itself no more.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>define [<span class="hljs-string">"./console"</span>],
+
+ <span class="hljs-function"><span class="hljs-params">(<span class="hljs-built_in">console</span>)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>Exports a single function that finds an initializer in <code>T5.initializers</code> and invokes it.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> (initName, args...) ->
+ fn = T5.initializers[initName]
+ <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> fn
+ <span class="hljs-built_in">console</span>.error <span class="hljs-string">"Initialization function '<span class="hljs-subst">#{initName}</span>' not found in T5.initializers namespace."</span>
+ <span class="hljs-keyword">else</span>
+ fn.apply <span class="hljs-literal">null</span>, args</pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>
Added: websites/production/tapestry/content/5.4.5/coffeescript/localdate.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/localdate.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/localdate.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,246 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>localdate.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>localdate.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Copyright 2013 The Apache Software Foundation</p>
+<p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-localdate">t5/core/localdate</h2>
+<p>Used with the LocalDate component to present a Date in a particular format, in the
+browserâs time zone.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>
+define [<span class="hljs-string">"./dom"</span>, <span class="hljs-string">"./moment"</span>],
+<span class="hljs-function"><span class="hljs-params">(dom, moment)</span> -></span>
+
+ ATTR = <span class="hljs-string">"data-localdate-format"</span>
+
+ dom.scanner <span class="hljs-string">"[<span class="hljs-subst">#{ATTR}</span>]"</span>, <span class="hljs-function"><span class="hljs-params">(el)</span> -></span>
+ format = el.attr ATTR
+
+ isoString = el.text()
+
+ m = moment isoString
+
+ el.update m.format format</pre></div></div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>A good scanner callback always removes itself from future scans.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> el.attr ATTR, <span class="hljs-literal">null</span>
+
+ <span class="hljs-keyword">return</span></pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>
Added: websites/production/tapestry/content/5.4.5/coffeescript/messages.html
==============================================================================
--- websites/production/tapestry/content/5.4.5/coffeescript/messages.html (added)
+++ websites/production/tapestry/content/5.4.5/coffeescript/messages.html Sat Sep 7 01:20:17 2019
@@ -0,0 +1,296 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>messages.coffee</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div id="container">
+ <div id="background"></div>
+
+ <ul id="jump_to">
+ <li>
+ <a class="large" href="javascript:void(0);">Jump To …</a>
+ <a class="small" href="javascript:void(0);">+</a>
+ <div id="jump_wrapper">
+ <div id="jump_page">
+
+
+ <a class="source" href="beanvalidator-validation.html">
+ beanvalidator-validation.coffee
+ </a>
+
+
+ <a class="source" href="ajax.html">
+ ajax.coffee
+ </a>
+
+
+ <a class="source" href="ajaxformloop.html">
+ ajaxformloop.coffee
+ </a>
+
+
+ <a class="source" href="alert.html">
+ alert.coffee
+ </a>
+
+
+ <a class="source" href="autocomplete.html">
+ autocomplete.coffee
+ </a>
+
+
+ <a class="source" href="bootstrap.html">
+ bootstrap.coffee
+ </a>
+
+
+ <a class="source" href="confirm-click.html">
+ confirm-click.coffee
+ </a>
+
+
+ <a class="source" href="console.html">
+ console.coffee
+ </a>
+
+
+ <a class="source" href="datefield.html">
+ datefield.coffee
+ </a>
+
+
+ <a class="source" href="events.html">
+ events.coffee
+ </a>
+
+
+ <a class="source" href="exception-display.html">
+ exception-display.coffee
+ </a>
+
+
+ <a class="source" href="exception-frame.html">
+ exception-frame.coffee
+ </a>
+
+
+ <a class="source" href="fields.html">
+ fields.coffee
+ </a>
+
+
+ <a class="source" href="form-fragment.html">
+ form-fragment.coffee
+ </a>
+
+
+ <a class="source" href="forms.html">
+ forms.coffee
+ </a>
+
+
+ <a class="source" href="init.html">
+ init.coffee
+ </a>
+
+
+ <a class="source" href="localdate.html">
+ localdate.coffee
+ </a>
+
+
+ <a class="source" href="messages.html">
+ messages.coffee
+ </a>
+
+
+ <a class="source" href="moment.html">
+ moment.coffee
+ </a>
+
+
+ <a class="source" href="pageinit.html">
+ pageinit.coffee
+ </a>
+
+
+ <a class="source" href="palette.html">
+ palette.coffee
+ </a>
+
+
+ <a class="source" href="select.html">
+ select.coffee
+ </a>
+
+
+ <a class="source" href="time-interval.html">
+ time-interval.coffee
+ </a>
+
+
+ <a class="source" href="tree.html">
+ tree.coffee
+ </a>
+
+
+ <a class="source" href="utils.html">
+ utils.coffee
+ </a>
+
+
+ <a class="source" href="validation.html">
+ validation.coffee
+ </a>
+
+
+ <a class="source" href="zone-refresh.html">
+ zone-refresh.coffee
+ </a>
+
+
+ <a class="source" href="zone.html">
+ zone.coffee
+ </a>
+
+ </div>
+ </li>
+ </ul>
+
+ <ul class="sections">
+
+ <li id="title">
+ <div class="annotation">
+ <h1>messages.coffee</h1>
+ </div>
+ </li>
+
+
+
+ <li id="section-1">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-1">¶</a>
+ </div>
+ <p>Copyright 2012-2013 The Apache Software Foundation</p>
+<p>Licensed under the Apache License, Version 2.0 (the âLicenseâ);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at</p>
+<pre><code><span class="hljs-attribute">http</span>:<span class="hljs-comment">#www.apache.org/licenses/LICENSE-2.0</span>
+</code></pre><p>Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an âAS ISâ BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-2">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-2">¶</a>
+ </div>
+ <h2 id="t5-core-messages">t5/core/messages</h2>
+<p>For all of these modules, weâve turned off CoffeeScriptâs normal outer function
+wrapper, as each module is just a call to <code>define()</code> with a function that fulfills
+the same purpose. This one is different, as it is necessary to compute one of the dependencies.
+On the server <code>t5/core/messages/<locale></code> is actually generated dynamically, as is a simple
+mapping of message keys to message values, from the global application message catalog.</p>
+<p>This module provides access to localized messages from the Tapestry applicationsâ server-side
+application message catalog (which is, itself, built from multiple resources, some provided by
+the framework, others provided by the application, or third-party libraries).</p>
+<p>Messages in the catalog that contain Java-style format specifiers are not included, as there
+is no facility for formatting those on the client. This is actually done as a simple test for the
+presence of the <code>%</code> character. In addition, any message key that begins with âprivate-â is
+assumed to contain sensitive data (such as database URLs or passwords) and will not be
+exposed to the client.</p>
+
+ </div>
+
+ </li>
+
+
+ <li id="section-3">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-3">¶</a>
+ </div>
+ <p>In the unexpected case that the data-locale attribute is missing, assume English</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre>locale = (<span class="hljs-built_in">document</span>.documentElement.getAttribute <span class="hljs-string">"data-locale"</span>) <span class="hljs-keyword">or</span> <span class="hljs-string">"en"</span>
+
+define [<span class="hljs-string">"./messages/<span class="hljs-subst">#{locale}</span>"</span>, <span class="hljs-string">"underscore"</span>, <span class="hljs-string">"./console"</span>],
+ <span class="hljs-function"><span class="hljs-params">(messages, _, <span class="hljs-built_in">console</span>)</span> -></span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-4">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-4">¶</a>
+ </div>
+ <p>Returns the application message catalog message for the given key. Returns
+a placeholder if the key is not found.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre><span class="hljs-function"> <span class="hljs-title">get</span> = <span class="hljs-params">(key)</span> -></span>
+ value = messages[key]
+
+ <span class="hljs-keyword">if</span> value
+ <span class="hljs-keyword">return</span> value
+ <span class="hljs-keyword">else</span>
+ <span class="hljs-built_in">console</span>.error <span class="hljs-string">"No value for message catalog key '<span class="hljs-subst">#{key}</span>' exists."</span>
+ <span class="hljs-keyword">return</span> <span class="hljs-string">"[[Missing Key: '<span class="hljs-subst">#{key}</span>']]"</span></pre></div></div>
+
+ </li>
+
+
+ <li id="section-5">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-5">¶</a>
+ </div>
+ <p>Returns all keys that are defined by the underlying catalog, in no specific order.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> get.keys = <span class="hljs-function">-></span> _.keys messages</pre></div></div>
+
+ </li>
+
+
+ <li id="section-6">
+ <div class="annotation">
+
+ <div class="pilwrap ">
+ <a class="pilcrow" href="#section-6">¶</a>
+ </div>
+ <p>Export get as the main function.</p>
+
+ </div>
+
+ <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">return</span> get</pre></div></div>
+
+ </li>
+
+ </ul>
+ </div>
+</body>
+</html>