| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Inline Edit Box Test</title> |
| 6 |
|
| 7 |
<script type="text/javascript" src="boilerplate.js"></script> |
| 8 |
|
| 9 |
<style type="text/css"> |
| 10 |
.inlineEdit { background-color: #CCC76A; } |
| 11 |
|
| 12 |
/* some style rules on nodes just to test that style gets copied to the edit widget */ |
| 13 |
p { font-family: cursive; } |
| 14 |
.letter p { font-family: monospace; } |
| 15 |
h3 { font-family: helvetica; font-style: italic; } |
| 16 |
</style> |
| 17 |
|
| 18 |
<script type="text/javascript"> |
| 19 |
require([ |
| 20 |
"dojo/parser", |
| 21 |
"dijit/InlineEditBox", |
| 22 |
|
| 23 |
// used by parser |
| 24 |
"dojo/data/ItemFileReadStore", |
| 25 |
"dijit/form/Textarea", |
| 26 |
"dijit/form/TextBox", |
| 27 |
"dijit/form/DateTextBox", |
| 28 |
"dijit/form/CurrencyTextBox", |
| 29 |
"dojo/currency", |
| 30 |
"dijit/form/ComboBox", |
| 31 |
"dijit/form/FilteringSelect", |
| 32 |
"dijit/form/NumberSpinner", |
| 33 |
"dijit/form/Select", |
| 34 |
"dijit/Editor", |
| 35 |
"dijit/_editor/plugins/AlwaysShowToolbar", |
| 36 |
"dojo/domReady!" |
| 37 |
], function(parser, InlineEditBox){ |
| 38 |
parser.parse(); |
| 39 |
|
| 40 |
// programmatic creation |
| 41 |
programmaticCreate = function(){ |
| 42 |
programmatic = new InlineEditBox({renderAsHtml: true, onChange:myHandler }, |
| 43 |
document.createElement("div")); // shouldn't have to specify a srcNodeRef, but you do. |
| 44 |
programmatic.placeAt("programmaticContainer"); |
| 45 |
}; |
| 46 |
}); |
| 47 |
|
| 48 |
function myHandler(newValue){ |
| 49 |
this._onChangeValue = newValue; // used by robot test file |
| 50 |
console.debug("onChange for id = " + this.id + ", value: " + newValue); |
| 51 |
} |
| 52 |
</script> |
| 53 |
</head> |
| 54 |
<body class="claro"> |
| 55 |
|
| 56 |
<h1 class="testTitle">Dijit InlineEditBox Test</h1> |
| 57 |
|
| 58 |
<span data-dojo-id="stateStore" data-dojo-type="dojo/data/ItemFileReadStore" data-dojo-props='url:"_data/states.json"'></span> |
| 59 |
<span data-dojo-id="countryStore" data-dojo-type="dojo/data/ItemFileReadStore" data-dojo-props='url:"_data/countries.json"'></span> |
| 60 |
<span data-dojo-id="productStore" data-dojo-type="dojo/data/ItemFileReadStore" > |
| 61 |
<script type="dojo/method"> |
| 62 |
this._jsonData = |
| 63 |
{ identifier: 'name', |
| 64 |
label: 'name', |
| 65 |
items: [ |
| 66 |
{ name: "refrigerator" }, |
| 67 |
{ name: "freezer" }, |
| 68 |
{ name: "stove" }, |
| 69 |
{ name: "heater" } |
| 70 |
]}; |
| 71 |
</script> |
| 72 |
</span> |
| 73 |
|
| 74 |
<h2>Form Letter with blanks</h2> |
| 75 |
<div class="letter"> |
| 76 |
<h3 id="editable" data-dojo-type="dijit/InlineEditBox" data-dojo-props='value:"markup value", onChange:myHandler, autoSave:true, title:"company name"'></h3> |
| 77 |
<p> |
| 78 |
Dear <span id="MrSmith" data-dojo-type="dijit/InlineEditBox" data-dojo-props='width:"200px", title:"recipient name"'></span>, |
| 79 |
</p> |
| 80 |
<p class="letter"> |
| 81 |
Thank you for your recent order. |
| 82 |
Please remit |
| 83 |
<span id="dollar_as" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/CurrencyTextBox", editorParams:{currency: "USD"}, width:"100px", title:"dollar amount"'></span> for |
| 84 |
your purchase of |
| 85 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/NumberSpinner", editorParams:{constraints: {places:0} }, width:"70px", title:"quantity"'></span> deluxe |
| 86 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/ComboBox", title:"item name", |
| 87 |
editorParams:{searchAttr: "name", store: productStore, autocomplete: false, hasDownArrow: false}, |
| 88 |
width:"200px"'></span> on |
| 89 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/DateTextBox", width:"200px", title:"purchase date as mm/dd/yy"'></span> in |
| 90 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/FilteringSelect", |
| 91 |
editorParams:{searchAttr: "name", keyAttr: "abbreviation", store: stateStore, autocomplete: true, hasDownArrow: true}, |
| 92 |
width:"200px", title:"state of purchase"'></span> |
| 93 |
<nobr>(<span data-dojo-type="dijit/InlineEditBox" |
| 94 |
data-dojo-props='editor:"dijit/form/Select", width:"200px", title:"country", editorParams:{ store: countryStore }' |
| 95 |
></span>)</nobr>. |
| 96 |
</p> |
| 97 |
<p id="textarea" data-dojo-type="dijit/InlineEditBox" data-dojo-props='autoSave:true, editor:"dijit/form/Textarea", title:"additional details"'></p> |
| 98 |
<p> |
| 99 |
Sincerely, |
| 100 |
</p> |
| 101 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='style:"margin-left: 2em; font-family: cursive;", width:"400px", title:"sender name" '></span> |
| 102 |
</div> |
| 103 |
<hr style="margin-bottom: 1em;"/> |
| 104 |
|
| 105 |
<h2>Form Letter with <span id="predefined">predefined values</span>, and no auto-save</h2> |
| 106 |
<div class="letter"> |
| 107 |
<h3 id="editable2" data-dojo-type="dijit/InlineEditBox" data-dojo-props='onChange:myHandler, autoSave:false, title:"company name"'> |
| 108 |
Bob Vance Refrigeration |
| 109 |
</h3> |
| 110 |
<p> |
| 111 |
Dear <span data-dojo-type="dijit/InlineEditBox" data-dojo-props='width:"200px", autoSave:false, title:"recipient name"'>John</span>, |
| 112 |
</p> |
| 113 |
<p class="letter"> |
| 114 |
Thank you for your recent order. |
| 115 |
Please remit |
| 116 |
<span id="dollar" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/CurrencyTextBox", editorParams:{currency: "USD"}, width:"100px", autoSave:false, title:"dollar amount"'>$2,000</span> |
| 117 |
for your purchase of |
| 118 |
<span id="quantity" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/NumberSpinner", editorParams:{constraints: {places:0} }, width:"70px", autoSave:false, title:"quantity"'>3</span> |
| 119 |
deluxe |
| 120 |
<span id="item" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/ComboBox", |
| 121 |
editorParams:{searchAttr: "name", store: productStore, autocomplete: false, hasDownArrow: false}, |
| 122 |
width:"200px", autoSave:false, title:"item name"'>refrigerators</span> |
| 123 |
on |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
<span id="purchase" data-dojo-type="dijit/InlineEditBox" |
| 131 |
data-dojo-props='editor:"dijit/form/DateTextBox", editorParams:{constraints: {datePattern: "MM/dd/yyyy"}}, |
| 132 |
width:"200px", autoSave:false, title:"purchase date as mm/dd/yy"'>01/05/2007</span> |
| 133 |
in |
| 134 |
<span id="state" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/FilteringSelect", |
| 135 |
editorParams:{searchAttr: "name", keyAttr: "abbreviation", store: stateStore, autocomplete: true, hasDownArrow: false}, |
| 136 |
width:"200px", autoSave:false, title:"state of purchase"'> |
| 137 |
Pennsylvania |
| 138 |
</span> |
| 139 |
<nobr>(<span id="country" data-dojo-type="dijit/InlineEditBox" |
| 140 |
data-dojo-props='editor:"dijit/form/Select", width:"200px", autoSave:false, title:"country", |
| 141 |
editorParams:{ store: countryStore }' |
| 142 |
>United States of America</span>)</nobr>. |
| 143 |
</p> |
| 144 |
<p data-dojo-type="dijit/InlineEditBox" data-dojo-props='autoSave:false, editor:"dijit/form/Textarea", title:"additional details"'> |
| 145 |
We sincerely appreciate your business and hope we can do business again. |
| 146 |
</p> |
| 147 |
<p> |
| 148 |
Sincerely, |
| 149 |
</p> |
| 150 |
<span data-dojo-type="dijit/InlineEditBox" data-dojo-props='style:"margin-left: 2em; font-family: cursive;", width:"400px", autoSave:false, title:"sender name"'>Bob Vance</span> |
| 151 |
</div> |
| 152 |
<hr style="margin-bottom: 1em;"/> |
| 153 |
|
| 154 |
|
| 155 |
<h2>Inline-block Text (of 400px width)</h2> |
| 156 |
<div> |
| 157 |
The following section uses inline block text of 400px. |
| 158 |
When clicking the editable text it should bring up an editor which is also 400px wide. |
| 159 |
</div> |
| 160 |
(before plain inline) <fieldset class="dijitInline"><div style="width: 400px;">hello world</div></fieldset> (after plain inline) |
| 161 |
<br> |
| 162 |
(before editable inline) |
| 163 |
<fieldset class="dijitInline"><div data-dojo-type="dijit/InlineEditBox" data-dojo-props='onChange:myHandler, width:"400px", style:"width: 400px;"'> |
| 164 |
hello world |
| 165 |
</div></fieldset> |
| 166 |
(after editable inline) |
| 167 |
<hr style="width:100%;"/> |
| 168 |
|
| 169 |
<h2>Pararagraph</h2> |
| 170 |
(before plain paragraph) |
| 171 |
<p> |
| 172 |
Aliquam vitae enim. Duis scelerisque metus auctor est venenatis |
| 173 |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem |
| 174 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in |
| 175 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In |
| 176 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra |
| 177 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia, |
| 178 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut |
| 179 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla |
| 180 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut |
| 181 |
semper velit ante id metus. Praesent massa dolor, porttitor sed, |
| 182 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit |
| 183 |
tortor pharetra congue. Suspendisse pulvinar. |
| 184 |
</p> |
| 185 |
(before editable paragraph. the editable paragraph has Save/Cancel buttons when open.) |
| 186 |
<p id="areaEditable" data-dojo-type="dijit/InlineEditBox" data-dojo-props='autoSave:false, editor:"dijit/form/Textarea"'> |
| 187 |
Aliquam vitae enim. Duis scelerisque metus auctor est venenatis |
| 188 |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem |
| 189 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in |
| 190 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In |
| 191 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra |
| 192 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia, |
| 193 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut |
| 194 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla |
| 195 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut |
| 196 |
semper velit ante id metus. Praesent massa dolor, porttitor sed, |
| 197 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit |
| 198 |
tortor pharetra congue. Suspendisse pulvinar. |
| 199 |
</p> |
| 200 |
These buttons will |
| 201 |
<button id="disableAreaEditable" onClick="dijit.byId('areaEditable').set('disabled', true)">disable</button> / |
| 202 |
<button onClick="dijit.byId('areaEditable').set('disabled', false)">enable</button> |
| 203 |
the InlineEditBox above. |
| 204 |
<hr style="width:100%;"/> |
| 205 |
|
| 206 |
<h2>Editor</h2> |
| 207 |
<div id="inlineRTE" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit.Editor", |
| 208 |
autoSave:false, renderAsHtml:true, |
| 209 |
editorParams:{height: "", extraPlugins: ["dijit._editor.plugins.AlwaysShowToolbar"]}'> |
| 210 |
<b>Aliquam</b> vitae enim. <i>Duis</i> scelerisque metus auctor est venenatis |
| 211 |
imperdiet. <span style="text-decoration: underline;"> Fusce</span> dignissim porta augue. Nulla vestibulum. Integer lorem |
| 212 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in |
| 213 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In |
| 214 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra |
| 215 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia, |
| 216 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut |
| 217 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla |
| 218 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut |
| 219 |
semper velit ante id metus. Praesent massa dolor, porttitor sed, |
| 220 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit |
| 221 |
tortor pharetra congue. Suspendisse pulvinar. |
| 222 |
</div> |
| 223 |
<p> |
| 224 |
Note: since the Editor may return a result containing one or more <p> nodes, |
| 225 |
don't make the InlineEditBox itself a <p> because that would cause nested |
| 226 |
<p>s, which is illegal, and messes up IE |
| 227 |
</p> |
| 228 |
|
| 229 |
<h2>FilteringSelect (no down arrow, and save/cancel buttons):</h2> |
| 230 |
before |
| 231 |
<span id="filteringSelect2" data-dojo-type="dijit/InlineEditBox" data-dojo-props='editor:"dijit/form/FilteringSelect", |
| 232 |
editorParams:{searchAttr: "name", keyAttr: "abbreviation", store: stateStore, autocomplete: true, hasDownArrow: false}, |
| 233 |
width:"200px", autoSave:false'> |
| 234 |
Indiana |
| 235 |
</span> |
| 236 |
<button onclick="dijit.byId('filteringSelect2').edit();return false;">Edit previous value</button> |
| 237 |
after |
| 238 |
<hr style="width:100%;"/> |
| 239 |
|
| 240 |
<h2>Programmatically created:</h2> |
| 241 |
<button type=button onclick="programmaticCreate();">create</button> |
| 242 |
<button type=button onclick="programmatic.destroy();">destroy</button> |
| 243 |
<div id="programmaticContainer"></div> |
| 244 |
|
| 245 |
<hr style="width:100%;"/> |
| 246 |
<h2>Complex renderAsHtml="false"</h2> |
| 247 |
<div id="renderAsHtml_false" data-dojo-type="dijit/InlineEditBox" data-dojo-props='renderAsHtml:false, width:"400px", style:"width:400px;"'> |
| 248 |
<B>not bold</B>&lt;input&gt; |
| 249 |
</div> |
| 250 |
<hr style="width:100%;"/> |
| 251 |
<h2>Complex renderAsHtml="true"</h2> |
| 252 |
<div id="renderAsHtml_true" data-dojo-type="dijit/InlineEditBox" data-dojo-props='renderAsHtml:true, width:"400px", style:"width:400px;"'> |
| 253 |
<B>not bold</B><B>bold</B>&lt;input&gt; |
| 254 |
</div> |
| 255 |
</body> |
| 256 |
</html> |