Merge lp:~sidnei/lazr-js/combo-service into lp:lazr-js
- combo-service
- Merge into toolchain
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~sidnei/lazr-js/combo-service |
Merge into: | lp:lazr-js |
Diff against target: |
2210 lines (+1015/-564) 32 files modified
Makefile (+7/-4) combo.tac (+30/-0) examples/activator/index.html (+15/-21) examples/anim/index.html (+27/-18) examples/autocomplete/index.html (+273/-276) examples/choiceedit/index.html (+26/-37) examples/combo.html (+201/-0) examples/effects/index.html (+46/-27) examples/error/index.html (+18/-37) examples/formoverlay/index.html (+24/-28) examples/inlineeditor/index.html (+25/-16) examples/lazr/index.html (+27/-17) examples/overlay/index.html (+24/-27) examples/picker/index.html (+20/-20) src-js/lazrjs/activator/activator.js (+3/-2) src-js/lazrjs/autocomplete/autocomplete.js (+2/-1) src-js/lazrjs/choiceedit/assets/choiceedit-core.css (+1/-1) src-js/lazrjs/choiceedit/assets/skins/sam/choiceedit-skin.css (+3/-0) src-js/lazrjs/choiceedit/choiceedit.js (+4/-3) src-js/lazrjs/effects/effects.js (+2/-1) src-js/lazrjs/error/assets/skins/sam/error-skin.css (+3/-0) src-js/lazrjs/error/error.js (+1/-1) src-js/lazrjs/formoverlay/assets/skins/sam/formoverlay-skin.css (+3/-0) src-js/lazrjs/formoverlay/formoverlay.js (+1/-1) src-js/lazrjs/inlineedit/editor.js (+2/-1) src-js/lazrjs/lazr/lazr.js (+1/-1) src-js/lazrjs/overlay/assets/pretty-overlay-core.css (+10/-5) src-js/lazrjs/overlay/overlay.js (+2/-2) src-js/lazrjs/picker/picker.js (+2/-1) src-py/lazr/js/build.py (+0/-11) src-py/lazr/js/meta.py (+94/-2) src-py/lazr/js/tests/test_meta.py (+118/-3) |
To merge this branch: | bzr merge lp:~sidnei/lazr-js/combo-service |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Māris Fogels (community) | Approve | ||
Edwin Grubbs | Pending | ||
Review via email: mp+15009@code.launchpad.net |
Commit message
Description of the change
Sidnei da Silva (sidnei) wrote : | # |
Māris Fogels (mars) wrote : | # |
Hi Sidnei,
This looks good. If you have to, I think you could land it as-is, but I do have some comments about the branch:
• Nice formoverlay example in combo.html. It is very straight forward
• Why did some of the lazr module dependencies get updated?
• Do we need to include the css* module dependencies, or can they be inlined on the page? I worry about the two approaches confusing developers.
• test_extract_
• Use Y.one() instead of Y.get()
I think we can define a global LAZR() function in lazr-meta to replace YUI(), but that can be saved for another branch.
Maris
Francis J. Lacoste (flacoste) wrote : | # |
On November 19, 2009, Māris Fogels wrote:
> I think we can define a global LAZR() function in lazr-meta to replace
> YUI(), but that can be saved for another branch.
>
I don't think that is particularly interesting since all applications will
need to merge in their own modules in the LAZR config. So why define a LAZR()
wrapper, when you'll need to define a LP(), U1(), LANDSCAPE() one?
--
Francis J. Lacoste
<email address hidden>
- 194. By Sidnei da Silva
-
- Move css modules inline
Sidnei da Silva (sidnei) wrote : | # |
Thanks for the review.
- CSS modules: I've updated the examples to inline them.
- Module dependencies: Only overlay was changed, to make the dependencies more explicit, the other changes were about adding 'skinnable'.
- Tests: they look very similar, you have to look a bit closer to notice the difference yeah. :)
- Y.get(): I didn't introduce any new one. But it would be nice to do a once-over and clear them all.
Sidnei da Silva (sidnei) wrote : | # |
FWIW, I don't think it's a good idea to define a global LAZR, since the plan to include lazr-meta.js other projects, each of which will have to define it's own YUI() instance.
Māris Fogels (mars) wrote : | # |
On Thu, Nov 19, 2009 at 12:34 PM, Sidnei da Silva
<email address hidden> wrote:
> FWIW, I don't think it's a good idea to define a global LAZR, since the plan to include lazr-meta.js other projects, each of which will have to define it's own YUI() instance.
So, I was suggesting the global LAZR() YUI wrapper because there is
code in each example that constructs a LAZR_YUI_CONFIG, and then
passes that into a YUI() constructor. Instead of doing so, why not
combine the two steps into a project-specific LZR() convenience
function? The function would *not* be for use outside of lazr-js,
just for convenience inside. I can see every individual YUI project
going this route, wrapping the YUI constructor as their needs dictate.
Regarding including lazr-meta.js: we will have to see how it works in
practice. I assumed that lazr-meta was for the purpose of running the
lazr project for development and demonstration purposes. I did not
think other projects would ever import lazr-meta.
I am wary of the idea of combining meta-dependencies like this: at
most, you could pull in the YUI config object's "modules" section.
All of the other configuation settings should be left to the
individual project.
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2009-11-13 20:43:37 +0000 |
3 | +++ Makefile 2009-11-19 17:33:11 +0000 |
4 | @@ -21,11 +21,12 @@ |
5 | |
6 | # Update the build directory |
7 | build: $(PY) |
8 | - $(PYTHON) -S bin/jsbuild |
9 | + cp -r src-js/lazrjs/yui/* build |
10 | + $(PYTHON) -S bin/jsbuild -b build/lazr -s src-js/lazrjs -n lazr -x lazr/yui |
11 | $(PYTHON) -S bin/yuimeta -n LAZR_MODULES \ |
12 | - -s build \ |
13 | - -p lazrjs -x "(-min|-debug|-all|-meta|build/lazr.js|lazr/yui|test)" \ |
14 | - -o build/lazrjs-meta.js |
15 | + -s build/lazr \ |
16 | + -p lazr -x "(-min|-debug|-all|-meta|build/lazr/lazr.js|test)" \ |
17 | + -o build/lazr/lazr-meta.js |
18 | |
19 | lint: |
20 | $(PYTHON) -S bin/jslint |
21 | @@ -51,6 +52,8 @@ |
22 | $(PY): bin/buildout buildout.cfg setup.py |
23 | $(PYTHON) -S ./bin/buildout |
24 | |
25 | +run: $(PY) |
26 | + $(PY) `which twistd` -ny combo.tac |
27 | |
28 | clean: |
29 | rm -fr build/* bin |
30 | |
31 | === added file 'combo.tac' |
32 | --- combo.tac 1970-01-01 00:00:00 +0000 |
33 | +++ combo.tac 2009-11-19 17:33:11 +0000 |
34 | @@ -0,0 +1,30 @@ |
35 | +import os |
36 | + |
37 | +from lazr.js.combo import combo_app |
38 | + |
39 | +from twisted.application import service, strports |
40 | +from twisted.internet import reactor |
41 | +from twisted.python import threadpool |
42 | +from twisted.web import server, wsgi |
43 | +from twisted.web.static import File |
44 | +from twisted.web.resource import Resource |
45 | + |
46 | + |
47 | +resource = Resource() |
48 | +for path in os.listdir("build"): |
49 | + folder = os.path.join("build", path) |
50 | + if os.path.isdir(folder): |
51 | + resource.putChild(path, File(folder)) |
52 | + |
53 | +threadpool = threadpool.ThreadPool(0, 10) |
54 | +threadpool.start() |
55 | +reactor.addSystemEventTrigger("during", "shutdown", threadpool.stop) |
56 | + |
57 | +resource.putChild("combo", wsgi.WSGIResource(reactor, threadpool, |
58 | + combo_app("build"))) |
59 | + |
60 | +application = service.Application("combo-service") |
61 | +site = server.Site(resource) |
62 | + |
63 | +s = strports.service("tcp:9876", site) |
64 | +s.setServiceParent(application) |
65 | |
66 | === modified file 'examples/activator/index.html' |
67 | --- examples/activator/index.html 2009-10-22 20:22:12 +0000 |
68 | +++ examples/activator/index.html 2009-11-19 17:33:11 +0000 |
69 | @@ -3,17 +3,24 @@ |
70 | <html> |
71 | <head> |
72 | <title>Lazr-js examples: Activator</title> |
73 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
74 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
75 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
76 | - <script type="text/javascript" src="../../build/activator/activator.js"></script> |
77 | + |
78 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
79 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
80 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
81 | + |
82 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
83 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
84 | + <script type="text/javascript"> |
85 | + var LAZR_YUI_CONFIG = { |
86 | + filter: "min", |
87 | + base: "../../build/", |
88 | + modules: LAZR_MODULES, |
89 | + }; |
90 | + </script> |
91 | |
92 | <script id="example-script" type="text/javascript"> |
93 | |
94 | -YUI({ |
95 | - base: '../../build/yui/current/build/', |
96 | - filter: 'raw' |
97 | - }).use('node', 'lazr.activator', function(Y) { |
98 | +YUI(LAZR_YUI_CONFIG).use('node', 'lazr.activator', function(Y) { |
99 | |
100 | Y.log('hooking up widget'); |
101 | var content_box = Y.get('#example-activator'); |
102 | @@ -92,19 +99,6 @@ |
103 | }); |
104 | </script> |
105 | |
106 | - <!-- |
107 | - We need to include individual css files because some of them have |
108 | - relative paths to images. |
109 | - --> |
110 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
111 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
112 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
113 | - |
114 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
115 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
116 | - <link type="text/css" rel="stylesheet" href="../../build/activator/assets/activator-core.css"></link> |
117 | - <link type="text/css" rel="stylesheet" href="../../build/activator/assets/skins/sam/activator-skin.css"></link> |
118 | -</head> |
119 | <body class="yui-skin-sam" style="margin: 1em"> |
120 | |
121 | <h1>Activator Widget</h1> |
122 | |
123 | === modified file 'examples/anim/index.html' |
124 | --- examples/anim/index.html 2009-11-10 22:57:58 +0000 |
125 | +++ examples/anim/index.html 2009-11-19 17:33:11 +0000 |
126 | @@ -1,21 +1,26 @@ |
127 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
128 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
129 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
130 | <html> |
131 | <head> |
132 | <title>Lazr-js examples: anim</title> |
133 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui-min.js"></script> |
134 | - <script type="text/javascript" src="../../build/yui/current/build/oop/oop-min.js"></script> |
135 | - <script type="text/javascript" src="../../build/yui/current/build/event/event-min.js"></script> |
136 | - <script type="text/javascript" src="../../build/yui/current/build/attribute/attribute-min.js"></script> |
137 | - <script type="text/javascript" src="../../build/yui/current/build/base/base-min.js"></script> |
138 | - <script type="text/javascript" src="../../build/yui/current/build/dom/dom-min.js"></script> |
139 | - <script type="text/javascript" src="../../build/yui/current/build/node/node-min.js"></script> |
140 | - <script type="text/javascript" src="../../build/yui/current/build/anim/anim-min.js"></script> |
141 | - |
142 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
143 | - <script type="text/javascript"> |
144 | - |
145 | -YUI().use('node', 'event', 'lazr.anim', function(Y) { |
146 | + |
147 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
148 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
149 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
150 | + |
151 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
152 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
153 | + <script type="text/javascript"> |
154 | + var LAZR_YUI_CONFIG = { |
155 | + filter: "min", |
156 | + base: "../../build/", |
157 | + modules: LAZR_MODULES, |
158 | + insertBefore: "style-overrides", |
159 | + }; |
160 | + </script> |
161 | + <script type="text/javascript"> |
162 | + |
163 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'lazr.anim', function(Y) { |
164 | |
165 | Y.on('click', function(ev) { |
166 | var id = ev.target ? ev.target.getAttribute('id') : null; |
167 | @@ -64,9 +69,8 @@ |
168 | }); |
169 | |
170 | </script> |
171 | - <style> |
172 | - #flash |
173 | - { |
174 | + <style id="style-overrides" type="text/css"> |
175 | + #flash { |
176 | width:200px; |
177 | height: 200px; |
178 | margin-bottom: 20px; |
179 | @@ -92,7 +96,12 @@ |
180 | pre-configured animation objects.</p> |
181 | |
182 | <pre> |
183 | -YUI().use('lazr.anim', function(Y) { |
184 | +var LAZR_YUI_CONFIG = { |
185 | + filter: "min", |
186 | + base: "../../build/", |
187 | + modules: LAZR_MODULES, |
188 | +}; |
189 | +YUI(LAZR_YUI_CONFIG).use('lazr.anim', function(Y) { |
190 | |
191 | var yellow = Y.lazr.anim.flash_in(...); // A yellow flash. |
192 | var green = Y.lazr.anim.green_flash(...); // A green flash. |
193 | |
194 | === modified file 'examples/autocomplete/index.html' |
195 | --- examples/autocomplete/index.html 2009-11-12 18:00:07 +0000 |
196 | +++ examples/autocomplete/index.html 2009-11-19 17:33:11 +0000 |
197 | @@ -4,284 +4,274 @@ |
198 | <head> |
199 | <title>Lazr-js examples: autocomplete</title> |
200 | |
201 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"></link> |
202 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"></link> |
203 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"></link> |
204 | - |
205 | - |
206 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
207 | - <script type="text/javascript" src="../../build/yui/current/build/widget/widget-position-debug.js"></script> |
208 | - <script type="text/javascript" src="../../build/yui/current/build/widget/widget-position-ext-debug.js"></script> |
209 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
210 | - <script type="text/javascript" src="../../build/autocomplete/autocomplete.js"></script> |
211 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
212 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
213 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
214 | + |
215 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
216 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
217 | <script type="text/javascript"> |
218 | - |
219 | -var LP = YUI({ |
220 | - base: '../../build/yui/current/build/', |
221 | - filter: 'raw' |
222 | -}); |
223 | - |
224 | -var countries = [ |
225 | - "European Union", |
226 | - "United States", |
227 | - "Japan", |
228 | - "Germany", |
229 | - "China (PRC)", |
230 | - "United Kingdom", |
231 | - "France", |
232 | - "Italy", |
233 | - "Spain", |
234 | - "Canada", |
235 | - "Brazil", |
236 | - "Russia", |
237 | - "India", |
238 | - "South Korea", |
239 | - "Australia", |
240 | - "Mexico", |
241 | - "Netherlands", |
242 | - "Turkey", |
243 | - "Sweden", |
244 | - "Belgium", |
245 | - "Indonesia", |
246 | - "Switzerland", |
247 | - "Poland", |
248 | - "Norway", |
249 | - "Republic of China", |
250 | - "Saudi Arabia", |
251 | - "Austria", |
252 | - "Greece", |
253 | - "Denmark", |
254 | - "Iran", |
255 | - "South Africa", |
256 | - "Argentina", |
257 | - "Ireland", |
258 | - "Thailand", |
259 | - "Finland", |
260 | - "Venezuela", |
261 | - "Portugal", |
262 | - "Hong Kong", |
263 | - "United Arab Emirates", |
264 | - "Malaysia", |
265 | - "Czech Republic", |
266 | - "Colombia", |
267 | - "Nigeria", |
268 | - "Romania", |
269 | - "Chile", |
270 | - "Israel", |
271 | - "Singapore", |
272 | - "Philippines", |
273 | - "Pakistan", |
274 | - "Ukraine", |
275 | - "Hungary", |
276 | - "Algeria", |
277 | - "New Zealand", |
278 | - "Egypt", |
279 | - "Kuwait", |
280 | - "Peru", |
281 | - "Kazakhstan", |
282 | - "Slovakia", |
283 | - "Morocco", |
284 | - "Bangladesh", |
285 | - "Vietnam", |
286 | - "Qatar", |
287 | - "Angola", |
288 | - "Libya", |
289 | - "Iraq", |
290 | - "Croatia", |
291 | - "Luxembourg", |
292 | - "Sudan", |
293 | - "Slovenia", |
294 | - "Cuba", |
295 | - "Belarus", |
296 | - "Ecuador", |
297 | - "Serbia", |
298 | - "Oman", |
299 | - "Bulgaria", |
300 | - "Lithuania", |
301 | - "Syria", |
302 | - "Dominican Republic", |
303 | - "Tunisia", |
304 | - "Guatemala", |
305 | - "Azerbaijan", |
306 | - "Sri Lanka", |
307 | - "Kenya", |
308 | - "Latvia", |
309 | - "Turkmenistan", |
310 | - "Costa Rica", |
311 | - "Lebanon", |
312 | - "Uruguay", |
313 | - "Uzbekistan", |
314 | - "Yemen", |
315 | - "Cyprus", |
316 | - "Estonia", |
317 | - "Trinidad and Tobago", |
318 | - "Cameroon", |
319 | - "El Salvador", |
320 | - "Iceland", |
321 | - "Panama", |
322 | - "Bahrain", |
323 | - "Ivory Coast", |
324 | - "Ethiopia", |
325 | - "Tanzania", |
326 | - "Jordan", |
327 | - "Ghana", |
328 | - "Bosnia and Herzegovina", |
329 | - "Macau", |
330 | - "Burma", |
331 | - "Bolivia", |
332 | - "Brunei", |
333 | - "Botswana", |
334 | - "Honduras", |
335 | - "Gabon", |
336 | - "Uganda", |
337 | - "Jamaica", |
338 | - "Zambia", |
339 | - "Senegal", |
340 | - "Paraguay", |
341 | - "Albania", |
342 | - "Equatorial Guinea", |
343 | - "Georgia", |
344 | - "Democratic Republic of the Congo", |
345 | - "Nepal", |
346 | - "Afghanistan", |
347 | - "Cambodia", |
348 | - "Armenia", |
349 | - "Republic of the Congo", |
350 | - "Mozambique", |
351 | - "Republic of Macedonia", |
352 | - "Malta", |
353 | - "Namibia", |
354 | - "Madagascar", |
355 | - "Chad", |
356 | - "Burkina Faso", |
357 | - "Mauritius", |
358 | - "Mali", |
359 | - "The Bahamas", |
360 | - "Papua New Guinea", |
361 | - "Nicaragua", |
362 | - "Haiti", |
363 | - "Benin", |
364 | - "Palestinian flag West Bank and Gaza", |
365 | - "Jersey", |
366 | - "Fiji", |
367 | - "Guinea", |
368 | - "Moldova", |
369 | - "Niger", |
370 | - "Laos", |
371 | - "Mongolia", |
372 | - "French Polynesia", |
373 | - "Kyrgyzstan", |
374 | - "Barbados", |
375 | - "Tajikistan", |
376 | - "Malawi", |
377 | - "Liechtenstein", |
378 | - "New Caledonia", |
379 | - "Kosovo", |
380 | - "Rwanda", |
381 | - "Montenegro", |
382 | - "Swaziland", |
383 | - "Guam", |
384 | - "Mauritania", |
385 | - "Guernsey", |
386 | - "Isle of Man", |
387 | - "Togo", |
388 | - "Somalia", |
389 | - "Suriname", |
390 | - "Aruba", |
391 | - "North Korea", |
392 | - "Zimbabwe", |
393 | - "Central African Republic", |
394 | - "Faroe Islands", |
395 | - "Greenland", |
396 | - "Sierra Leone", |
397 | - "Lesotho", |
398 | - "Cape Verde", |
399 | - "Eritrea", |
400 | - "Bhutan", |
401 | - "Belize", |
402 | - "Antigua and Barbuda", |
403 | - "Gibraltar", |
404 | - "Maldives", |
405 | - "San Marino", |
406 | - "Guyana", |
407 | - "Burundi", |
408 | - "Saint Lucia", |
409 | - "Djibouti", |
410 | - "British Virgin Islands", |
411 | - "Liberia", |
412 | - "Seychelles", |
413 | - "The Gambia", |
414 | - "Northern Mariana Islands", |
415 | - "Grenada", |
416 | - "Saint Vincent and the Grenadines", |
417 | - "Saint Kitts and Nevis", |
418 | - "East Timor", |
419 | - "Vanuatu", |
420 | - "Comoros", |
421 | - "Samoa", |
422 | - "Solomon Islands", |
423 | - "Guinea-Bissau", |
424 | - "American Samoa", |
425 | - "Dominica", |
426 | - "Micronesia", |
427 | - "Tonga", |
428 | - "Cook Islands", |
429 | - "Palau", |
430 | - "Marshall Islands", |
431 | - "S o Tom and Pr ncipe", |
432 | - "Anguilla", |
433 | - "Kiribati", |
434 | - "Tuvalu", |
435 | - "Niue" |
436 | -]; |
437 | - |
438 | + var LAZR_YUI_CONFIG = { |
439 | + filter: "min", |
440 | + base: "../../build/", |
441 | + modules: LAZR_MODULES, |
442 | + insertBefore: "style-overrides", |
443 | + }; |
444 | + |
445 | + var LP = YUI(LAZR_YUI_CONFIG); |
446 | + |
447 | + var countries = [ |
448 | + "European Union", |
449 | + "United States", |
450 | + "Japan", |
451 | + "Germany", |
452 | + "China (PRC)", |
453 | + "United Kingdom", |
454 | + "France", |
455 | + "Italy", |
456 | + "Spain", |
457 | + "Canada", |
458 | + "Brazil", |
459 | + "Russia", |
460 | + "India", |
461 | + "South Korea", |
462 | + "Australia", |
463 | + "Mexico", |
464 | + "Netherlands", |
465 | + "Turkey", |
466 | + "Sweden", |
467 | + "Belgium", |
468 | + "Indonesia", |
469 | + "Switzerland", |
470 | + "Poland", |
471 | + "Norway", |
472 | + "Republic of China", |
473 | + "Saudi Arabia", |
474 | + "Austria", |
475 | + "Greece", |
476 | + "Denmark", |
477 | + "Iran", |
478 | + "South Africa", |
479 | + "Argentina", |
480 | + "Ireland", |
481 | + "Thailand", |
482 | + "Finland", |
483 | + "Venezuela", |
484 | + "Portugal", |
485 | + "Hong Kong", |
486 | + "United Arab Emirates", |
487 | + "Malaysia", |
488 | + "Czech Republic", |
489 | + "Colombia", |
490 | + "Nigeria", |
491 | + "Romania", |
492 | + "Chile", |
493 | + "Israel", |
494 | + "Singapore", |
495 | + "Philippines", |
496 | + "Pakistan", |
497 | + "Ukraine", |
498 | + "Hungary", |
499 | + "Algeria", |
500 | + "New Zealand", |
501 | + "Egypt", |
502 | + "Kuwait", |
503 | + "Peru", |
504 | + "Kazakhstan", |
505 | + "Slovakia", |
506 | + "Morocco", |
507 | + "Bangladesh", |
508 | + "Vietnam", |
509 | + "Qatar", |
510 | + "Angola", |
511 | + "Libya", |
512 | + "Iraq", |
513 | + "Croatia", |
514 | + "Luxembourg", |
515 | + "Sudan", |
516 | + "Slovenia", |
517 | + "Cuba", |
518 | + "Belarus", |
519 | + "Ecuador", |
520 | + "Serbia", |
521 | + "Oman", |
522 | + "Bulgaria", |
523 | + "Lithuania", |
524 | + "Syria", |
525 | + "Dominican Republic", |
526 | + "Tunisia", |
527 | + "Guatemala", |
528 | + "Azerbaijan", |
529 | + "Sri Lanka", |
530 | + "Kenya", |
531 | + "Latvia", |
532 | + "Turkmenistan", |
533 | + "Costa Rica", |
534 | + "Lebanon", |
535 | + "Uruguay", |
536 | + "Uzbekistan", |
537 | + "Yemen", |
538 | + "Cyprus", |
539 | + "Estonia", |
540 | + "Trinidad and Tobago", |
541 | + "Cameroon", |
542 | + "El Salvador", |
543 | + "Iceland", |
544 | + "Panama", |
545 | + "Bahrain", |
546 | + "Ivory Coast", |
547 | + "Ethiopia", |
548 | + "Tanzania", |
549 | + "Jordan", |
550 | + "Ghana", |
551 | + "Bosnia and Herzegovina", |
552 | + "Macau", |
553 | + "Burma", |
554 | + "Bolivia", |
555 | + "Brunei", |
556 | + "Botswana", |
557 | + "Honduras", |
558 | + "Gabon", |
559 | + "Uganda", |
560 | + "Jamaica", |
561 | + "Zambia", |
562 | + "Senegal", |
563 | + "Paraguay", |
564 | + "Albania", |
565 | + "Equatorial Guinea", |
566 | + "Georgia", |
567 | + "Democratic Republic of the Congo", |
568 | + "Nepal", |
569 | + "Afghanistan", |
570 | + "Cambodia", |
571 | + "Armenia", |
572 | + "Republic of the Congo", |
573 | + "Mozambique", |
574 | + "Republic of Macedonia", |
575 | + "Malta", |
576 | + "Namibia", |
577 | + "Madagascar", |
578 | + "Chad", |
579 | + "Burkina Faso", |
580 | + "Mauritius", |
581 | + "Mali", |
582 | + "The Bahamas", |
583 | + "Papua New Guinea", |
584 | + "Nicaragua", |
585 | + "Haiti", |
586 | + "Benin", |
587 | + "Palestinian flag West Bank and Gaza", |
588 | + "Jersey", |
589 | + "Fiji", |
590 | + "Guinea", |
591 | + "Moldova", |
592 | + "Niger", |
593 | + "Laos", |
594 | + "Mongolia", |
595 | + "French Polynesia", |
596 | + "Kyrgyzstan", |
597 | + "Barbados", |
598 | + "Tajikistan", |
599 | + "Malawi", |
600 | + "Liechtenstein", |
601 | + "New Caledonia", |
602 | + "Kosovo", |
603 | + "Rwanda", |
604 | + "Montenegro", |
605 | + "Swaziland", |
606 | + "Guam", |
607 | + "Mauritania", |
608 | + "Guernsey", |
609 | + "Isle of Man", |
610 | + "Togo", |
611 | + "Somalia", |
612 | + "Suriname", |
613 | + "Aruba", |
614 | + "North Korea", |
615 | + "Zimbabwe", |
616 | + "Central African Republic", |
617 | + "Faroe Islands", |
618 | + "Greenland", |
619 | + "Sierra Leone", |
620 | + "Lesotho", |
621 | + "Cape Verde", |
622 | + "Eritrea", |
623 | + "Bhutan", |
624 | + "Belize", |
625 | + "Antigua and Barbuda", |
626 | + "Gibraltar", |
627 | + "Maldives", |
628 | + "San Marino", |
629 | + "Guyana", |
630 | + "Burundi", |
631 | + "Saint Lucia", |
632 | + "Djibouti", |
633 | + "British Virgin Islands", |
634 | + "Liberia", |
635 | + "Seychelles", |
636 | + "The Gambia", |
637 | + "Northern Mariana Islands", |
638 | + "Grenada", |
639 | + "Saint Vincent and the Grenadines", |
640 | + "Saint Kitts and Nevis", |
641 | + "East Timor", |
642 | + "Vanuatu", |
643 | + "Comoros", |
644 | + "Samoa", |
645 | + "Solomon Islands", |
646 | + "Guinea-Bissau", |
647 | + "American Samoa", |
648 | + "Dominica", |
649 | + "Micronesia", |
650 | + "Tonga", |
651 | + "Cook Islands", |
652 | + "Palau", |
653 | + "Marshall Islands", |
654 | + "S o Tom and Pr ncipe", |
655 | + "Anguilla", |
656 | + "Kiribati", |
657 | + "Tuvalu", |
658 | + "Niue" |
659 | + ]; |
660 | </script> |
661 | |
662 | - <!-- |
663 | - We need to include individual css files because some of them have |
664 | - relative paths to images. |
665 | - --> |
666 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
667 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
668 | - <link type="text/css" rel="stylesheet" href="../../build/autocomplete/assets/skins/sam/autocomplete.css"></link> |
669 | - |
670 | - <style type="text/css"> |
671 | - #example { |
672 | - background-color: #ecf5fa; |
673 | - border: 1px solid #8899dd; |
674 | - padding: 2em; |
675 | - } |
676 | - |
677 | - #example label { display: block; line-height: 2em; font-weight: bold; } |
678 | - #example input { margin-bottom: 1em; } |
679 | - #example h4 { font-weight: normal; } |
680 | - #example #keys li { line-height: 2em; } |
681 | - #example #keys kbd { |
682 | - background-color: #eee; |
683 | - border: 1px solid #bbb; |
684 | - padding-left: 3px; |
685 | - padding-right: 3px; |
686 | - } |
687 | + <style id="style-overrides" type="text/css"> |
688 | + #example { |
689 | + background-color: #ecf5fa; |
690 | + border: 1px solid #8899dd; |
691 | + padding: 2em; |
692 | + } |
693 | + |
694 | + #example label { display: block; line-height: 2em; font-weight: bold; } |
695 | + #example input { margin-bottom: 1em; } |
696 | + #example h4 { font-weight: normal; } |
697 | + #example #keys li { line-height: 2em; } |
698 | + #example #keys kbd { |
699 | + background-color: #eee; |
700 | + border: 1px solid #bbb; |
701 | + padding-left: 3px; |
702 | + padding-right: 3px; |
703 | + } |
704 | </style> |
705 | </head> |
706 | |
707 | <body class="yui-skin-sam"> |
708 | |
709 | -<h1>A Simple auto-complete Widget</h1> |
710 | - |
711 | -<h2>Demonstration</h2> |
712 | -<div id="example"> |
713 | - <label for="ac-input">Enter a country name:</label> |
714 | - <input id="ac-input" type="text" value="" /> |
715 | - <h4>Some useful keyboard shortcuts:</h4> |
716 | - <ul id="keys"> |
717 | - <li><kbd>Tab</kbd> or <kbd>Enter</kbd> completes the current input.</li> |
718 | - <li><kbd>Up Arrow</kbd> and <kbd>Down Arrow</kbd> navigate the completions list</li> |
719 | - <li><kbd>Esc</kbd> closes the completion list</li> |
720 | - </ul> |
721 | - |
722 | - <script type="text/javascript"> |
723 | -LP.use('node', 'event', 'dump', 'lazr.autocomplete', function(Y) { |
724 | + <h1>A Simple auto-complete Widget</h1> |
725 | + |
726 | + <h2>Demonstration</h2> |
727 | + <div id="example"> |
728 | + <label for="ac-input">Enter a country name:</label> |
729 | + <input id="ac-input" type="text" value="" /> |
730 | + <h4>Some useful keyboard shortcuts:</h4> |
731 | + <ul id="keys"> |
732 | + <li><kbd>Tab</kbd> or <kbd>Enter</kbd> completes the current input.</li> |
733 | + <li><kbd>Up Arrow</kbd> and <kbd>Down Arrow</kbd> navigate the completions list</li> |
734 | + <li><kbd>Esc</kbd> closes the completion list</li> |
735 | + </ul> |
736 | + |
737 | + <script type="text/javascript"> |
738 | + LP.use('node', 'event', 'dump', 'lazr.autocomplete', function(Y) { |
739 | |
740 | function log(msg) { |
741 | Y.log(msg, 'info'); |
742 | @@ -319,8 +309,8 @@ |
743 | <h3>Javascript</h3> |
744 | Add the following javascript and css tags into your page. |
745 | <pre> |
746 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
747 | - <script type="text/javascript" src="../../build/autocomplete/autocomplete.js"></script> |
748 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
749 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
750 | </pre> |
751 | |
752 | <p> |
753 | @@ -338,11 +328,18 @@ |
754 | The AutoComplete widget requires two ATTRs on creation: a node id and an |
755 | array containing data. |
756 | <pre> |
757 | - var autocomplete = new Y.lazr.AutoComplete({ |
758 | - input: '#input-box', |
759 | - data: ['Mike', 'Fred', 'Barney'] |
760 | + var LAZR_YUI_CONFIG = { |
761 | + filter: "min", |
762 | + base: "../../build/", |
763 | + modules: LAZR_MODULES, |
764 | + }; |
765 | + YUI(LAZR_YUI_CONFIG).use("lazr.autocomplete", function(Y) { |
766 | + var autocomplete = new Y.lazr.AutoComplete({ |
767 | + input: '#input-box', |
768 | + data: ['Mike', 'Fred', 'Barney'] |
769 | + }); |
770 | + autocomplete.render(); |
771 | }); |
772 | - autocomplete.render(); |
773 | </pre> |
774 | </body> |
775 | </html> |
776 | |
777 | === modified file 'examples/choiceedit/index.html' |
778 | --- examples/choiceedit/index.html 2009-10-22 20:22:12 +0000 |
779 | +++ examples/choiceedit/index.html 2009-11-19 17:33:11 +0000 |
780 | @@ -2,27 +2,20 @@ |
781 | <html> |
782 | <head> |
783 | <title>Lazr-js examples: Choice editing</title> |
784 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
785 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
786 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
787 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
788 | - |
789 | - <!-- |
790 | - We need to include individual css files because some of them have |
791 | - relative paths to images. |
792 | - --> |
793 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
794 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
795 | - <link type="text/css" rel="stylesheet" href="../../build/inlineedit/assets/skins/sam/editor.css"></link> |
796 | - |
797 | - <script type="text/javascript" src="../../build/choiceedit/choiceedit.js"></script> |
798 | - |
799 | - <link type="text/css" rel="stylesheet" |
800 | - href="../../build/overlay/assets/pretty-overlay-core.css"> |
801 | - <link type="text/css" rel="stylesheet" |
802 | - href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"> |
803 | - <link type="text/css" rel="stylesheet" |
804 | - href="../../build/choiceedit/assets/choiceedit-core.css"> |
805 | + |
806 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
807 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
808 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
809 | + |
810 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
811 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
812 | + <script type="text/javascript"> |
813 | + var LAZR_YUI_CONFIG = { |
814 | + filter: "min", |
815 | + base: "../../build/", |
816 | + modules: LAZR_MODULES, |
817 | + }; |
818 | + </script> |
819 | </head> |
820 | <body class="yui-skin-sam"> |
821 | |
822 | @@ -36,23 +29,21 @@ |
823 | |
824 | <h2>Required include dependencies</h2> |
825 | <pre> |
826 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
827 | - <script type="text/javascript" src="../../build/choiceedit/choiceedit.js"></script> |
828 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
829 | - |
830 | - <!-- overlay required files --> |
831 | - <link type="text/css" rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"></link> |
832 | - <link type="text/css" rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"></link> |
833 | - <!-- choiceedit required files --> |
834 | - <link type="text/css" rel="stylesheet" href="../../build/choiceedit/assets/choiceedit-core.css"></link> |
835 | - |
836 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
837 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
838 | </pre> |
839 | |
840 | <h2>Example instantiation</h2> |
841 | |
842 | <pre> |
843 | - YUI().use('node', 'event', 'widget', 'plugin', 'overlay', 'lazr.choiceedit', function(Y) { |
844 | - |
845 | + var LAZR_YUI_CONFIG = { |
846 | + filter: "min", |
847 | + base: "../../build/", |
848 | + modules: LAZR_MODULES, |
849 | + }; |
850 | + YUI(LAZR_YUI_CONFIG).use('node', 'event', 'widget', 'plugin', 'overlay', |
851 | + 'lazr.choiceedit', function(Y) { |
852 | + |
853 | var choice_edit = new Y.ChoiceSource({ |
854 | contentBox: '#status', |
855 | value: 'incomplete', |
856 | @@ -175,10 +166,8 @@ |
857 | </pre> |
858 | |
859 | <script> |
860 | - YUI({ |
861 | - base: '../../build/yui/current/build/', |
862 | - filter: 'raw' |
863 | - }).use('node', 'event', 'widget', 'plugin', 'overlay', 'lazr.choiceedit', function(Y) { |
864 | + YUI(LAZR_YUI_CONFIG).use('node', 'event', 'widget', 'plugin', |
865 | + 'overlay', 'lazr.choiceedit', function(Y) { |
866 | |
867 | // Add a delay between the start and end of the inline editor widget's |
868 | // "save" event. |
869 | |
870 | === added file 'examples/combo.html' |
871 | --- examples/combo.html 1970-01-01 00:00:00 +0000 |
872 | +++ examples/combo.html 2009-11-19 17:33:11 +0000 |
873 | @@ -0,0 +1,201 @@ |
874 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
875 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
876 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
877 | +<head> |
878 | + <title>LAZR JS Examples: lazr.formoverlay</title> |
879 | + <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
880 | + |
881 | + <link rel="stylesheet" type="text/css" href="../build/cssreset/reset-min.css"></link> |
882 | + <link rel="stylesheet" type="text/css" href="../cssfonts/fonts-min.css"></link> |
883 | + <link rel="stylesheet" type="text/css" href="../cssbase/base-min.css"></link> |
884 | + |
885 | + <script type="text/javascript" src="../build/yui/yui.js"></script> |
886 | + <script type="text/javascript" src="../build/lazr/lazr-meta.js"></script> |
887 | + <script type="text/javascript"> |
888 | + var LAZR_YUI_CONFIG = { |
889 | + filter: "min", |
890 | + comboBase: "http://localhost:9876/combo?", |
891 | + root: "", |
892 | + combine: true, |
893 | + modules: LAZR_MODULES, |
894 | + }; |
895 | + </script> |
896 | + |
897 | + <script type="text/javascript"> |
898 | + |
899 | +YUI(LAZR_YUI_CONFIG).use('lazr.formoverlay', 'node', 'event', |
900 | + 'dump', function(Y) { |
901 | + |
902 | + var big_error = [ |
903 | + 'Traceback (most recent call last):', |
904 | + ' File "/foo/bar/baz.py", line 130, in publish', |
905 | + ' obj = request.traverse(obj)', |
906 | + ' File "/foo/bar/baz.py", line 1348, in traverse', |
907 | + ' result = super(WebServiceRequestTraversal, self).traverse(ob)', |
908 | + ' File "/foo/bar/baz.py", line 513, in traverse', |
909 | + ' ob = super(BrowserRequest, self).traverse(obj)', |
910 | + ' File "/foo/bar/baz.py", line 453, in traverse', |
911 | + ' ob = super(HTTPRequest, self).traverse(obj)', |
912 | + ' File "/foo/bar/baz.py", line 263, in traverse', |
913 | + ' obj = publication.traverseName(self, obj, entry_name)', |
914 | + ' File "/foo/bar/baz.py", line 1157, in traverseName', |
915 | + ' return super(WebServicePublication, self).traverseName(', |
916 | + ' File "/foo/bar/foo/bar/foo/bar/foo/bar/foo/bar/baz.py", ' + |
917 | + 'line 61, in traverseName', |
918 | + ' File "/foo/bar/baz.py", line 659, in publishTraverse', |
919 | + ' nextobj = self._publishTraverse(request, name)', |
920 | + ' File "/foo/bar/baz.py", line 763, in _publishTraverse', |
921 | + ' nextstep)', |
922 | + ' File "/foo/bar/baz.py", line 689, in _handle_next_object', |
923 | + ' raise NotFound(self.context, name)', |
924 | + "NotFound: Object: , name: u'1asdfasdf'" |
925 | + ].join("\n"); |
926 | + |
927 | + var formoverlay; |
928 | + var submit_callback = function(data){ |
929 | + if (data['firstname'][0] == "Harry"){ |
930 | + formoverlay.showError([ |
931 | + '"Harry" is not allowed.', |
932 | + big_error, |
933 | + ]); |
934 | + } |
935 | + |
936 | + Y.get("#data-display").set("innerHTML", Y.dump(data)); |
937 | + }; |
938 | + |
939 | + formoverlay = new Y.lazr.FormOverlay({ |
940 | + headerContent: '<h2>Your details</h2>', |
941 | + form_header: [ |
942 | + '<p>Enter the firstname "Harry" to see an example error.</p>', |
943 | + '<p id="formoverview">Please fill in the following details:</p>' |
944 | + ].join(""), |
945 | + form_content: [ |
946 | + '<div id="myform">', |
947 | + '<table>', |
948 | + '<tr>', |
949 | + ' <td><label for="firstname">First name: </label></td>', |
950 | + ' <td><input type="text" name="firstname" id="firstname"/></td>', |
951 | + '</tr>', |
952 | + '<tr>', |
953 | + ' <td><label for="lastname">Last name: </label></td>', |
954 | + ' <td><input type="text" name="lastname" id="lastname"/></td>', |
955 | + '</tr>', |
956 | + '<tr>', |
957 | + ' <td><label for="gender">Gender: </label></td>', |
958 | + ' <td><select name="gender">', |
959 | + ' <option value="female">Female</option>', |
960 | + ' <option value="male">Male</option>', |
961 | + ' </select></td>', |
962 | + '</tr>', |
963 | + '</table>', |
964 | + '</div>' |
965 | + ].join(""), |
966 | + form_submit_callback: submit_callback, |
967 | + centered: true, |
968 | + visible: false |
969 | + }); |
970 | + formoverlay.render(); |
971 | + |
972 | + Y.on("domready", function(){ |
973 | + formoverlay.show(); |
974 | + }); |
975 | + |
976 | + Y.on('click', function(e) { |
977 | + Y.log("Showing overlay", "info"); |
978 | + formoverlay.show(); |
979 | + }, '#show-overlay'); |
980 | +}); |
981 | + </script> |
982 | +</head> |
983 | + |
984 | +<body class="yui-skin-sam"> |
985 | + <h1>Using forms in a LAZR overlay</h1> |
986 | + |
987 | + <p>The <code>FormOverlay</code> widget allows the display and data |
988 | + extraction of any form. |
989 | + </p> |
990 | + |
991 | + <h2>Demonstration</h2> |
992 | + <div id="example"> |
993 | + <button id="show-overlay">Re-display form</button> |
994 | + |
995 | + <p>Data returned upon form submission: <span id="data-display"></span> |
996 | + </p> |
997 | + </div> |
998 | + |
999 | + <h2>Page Setup</h2> |
1000 | + <p>The following Javascript and CSS files will need to be included on your page:</p> |
1001 | + |
1002 | + <h3>Javascript</h3> |
1003 | + <pre> |
1004 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui-min.js"></script> |
1005 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1006 | + </pre> |
1007 | + |
1008 | + <h2>Widget Setup</h2> |
1009 | + <p>The FormOverlay requires only form content during initialization. |
1010 | + The normal Overlay attributes (such as headerContent) can be used |
1011 | + as expected.</p> |
1012 | + <pre><code> |
1013 | + var LAZR_YUI_CONFIG = { |
1014 | + filter: "min", |
1015 | + base: "../../build/", |
1016 | + modules: LAZR_MODULES, |
1017 | + }; |
1018 | + YUI(LAZR_YUI_CONFIG).use("lazr.formoverlay", function(Y){ |
1019 | + var form_content = 'Enter name: <input type="text" name="username" />'; |
1020 | + var formoverlay = new Y.lazr.FormOverlay({ |
1021 | + headerContent: '<h2>Your Form Title</h2>', |
1022 | + form_content: form_content}); |
1023 | + formoverlay.render(); |
1024 | + }); |
1025 | + </code></pre> |
1026 | + <p><strong>Note:</strong> The form content can be passed as either a string |
1027 | + of HTML (as is useful if the form is obtained via an AJAX request) or |
1028 | + as an instance of a Y.Node (as is useful if the form is obtained from |
1029 | + the current page). |
1030 | + </p> |
1031 | + <h3>Providing the submit callback</h3> |
1032 | + <p>To do something useful with the FormOverlay, you will want to provide |
1033 | + your own submit callback, so that you can do something with the data. |
1034 | + Data is returned to your callback as a hash, where each value is |
1035 | + a list, due to the ability to select multiple values for a single key |
1036 | + with HTML check input elements. |
1037 | + </p> |
1038 | + <pre><code> |
1039 | + ... |
1040 | + var submit_callback = function(data){ |
1041 | + // Do something useful with the data... |
1042 | + Y.get("#data-display").set("innerHTML", Y.dump(data)); |
1043 | + }; |
1044 | + var formoverlay = new Y.lazr.FormOverlay({ |
1045 | + headerContent: '<h2>Your Form Title</h2>', |
1046 | + form_content: form_content, |
1047 | + form_submit_callback: submit_callback}); |
1048 | + formoverlay.render(); |
1049 | + </code></pre> |
1050 | + |
1051 | + <h3>Displaying error messages</h3> |
1052 | + <p> The FormOverlay includes showError() and clearError() methods that |
1053 | + can be used to display an error (or a list of errors) inside the |
1054 | + FormOverlay, as demonstrated in the example. |
1055 | + </p> |
1056 | + |
1057 | + <h3>Providing a custom submit button</h3> |
1058 | + <p>By default, the FormOverlay will create a submit button and include |
1059 | + it in the form element. |
1060 | + If you would like your own submit button, with it's own text etc., |
1061 | + you can also pass it in as an attribute:</p> |
1062 | + <pre><code> |
1063 | + ... |
1064 | + var submit_button = Y.Node.create('<input type="submit" value="Hit me!">'); |
1065 | + var formoverlay = new Y.lazr.FormOverlay({ |
1066 | + headerContent: '<h2>Your Form Title</h2>', |
1067 | + form_content: form_content, |
1068 | + form_submit_callback: submit_callback, |
1069 | + form_submit_button: submit_button}); |
1070 | + formoverlay.render(); |
1071 | + </code></pre> |
1072 | + |
1073 | +</body> |
1074 | +</html> |
1075 | |
1076 | === modified file 'examples/effects/index.html' |
1077 | --- examples/effects/index.html 2009-10-22 20:22:12 +0000 |
1078 | +++ examples/effects/index.html 2009-11-19 17:33:11 +0000 |
1079 | @@ -4,23 +4,22 @@ |
1080 | <head> |
1081 | <title>Lazr-js examples: lazr.effects</title> |
1082 | |
1083 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"></link> |
1084 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"></link> |
1085 | - <link type="text/css" rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"></link> |
1086 | - |
1087 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1088 | - <script type="text/javascript" src="../../build/lazr.js"></script> |
1089 | - <script type="text/javascript" src="../../build/effects/effects.js"></script> |
1090 | - |
1091 | - <!-- |
1092 | - We need to include individual css files because some of them have |
1093 | - relative paths to images. |
1094 | - --> |
1095 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
1096 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"></link> |
1097 | - <link type="text/css" rel="stylesheet" href="../../build/effects/assets/skins/sam/effects.css"></link> |
1098 | - |
1099 | - <style type="text/css"> |
1100 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1101 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1102 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1103 | + |
1104 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1105 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1106 | + <script type="text/javascript"> |
1107 | + var LAZR_YUI_CONFIG = { |
1108 | + filter: "min", |
1109 | + base: "../../build/", |
1110 | + modules: LAZR_MODULES, |
1111 | + insertBefore: "style-overrides", |
1112 | + }; |
1113 | + </script> |
1114 | + |
1115 | + <style id="style-overrides" type="text/css"> |
1116 | .example { |
1117 | background-color: #ecf5fa; |
1118 | border: 1px solid #8899dd; |
1119 | @@ -76,7 +75,12 @@ |
1120 | |
1121 | <h3>Usage</h3> |
1122 | <pre> |
1123 | -YUI().use('node', 'event', 'lazr.effects', function(Y) { |
1124 | +var LAZR_YUI_CONFIG = { |
1125 | + filter: "min", |
1126 | + base: "../../build/", |
1127 | + modules: LAZR_MODULES, |
1128 | +}; |
1129 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'lazr.effects', function(Y) { |
1130 | |
1131 | var reset_height = null; |
1132 | var slide_node; |
1133 | @@ -107,7 +111,12 @@ |
1134 | |
1135 | <h3>Usage</h3> |
1136 | <pre> |
1137 | -YUI().use('node', 'event', 'lazr.effects', function(Y) { |
1138 | +var LAZR_YUI_CONFIG = { |
1139 | + filter: "min", |
1140 | + base: "../../build/", |
1141 | + modules: LAZR_MODULES, |
1142 | +}; |
1143 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'lazr.effects', function(Y) { |
1144 | |
1145 | var reset_height = null; |
1146 | var slide_node; |
1147 | @@ -147,7 +156,12 @@ |
1148 | </p> |
1149 | |
1150 | <pre> |
1151 | -YUI().use('node', 'event', 'lazr.effects', function(Y) { |
1152 | +var LAZR_YUI_CONFIG = { |
1153 | + filter: "min", |
1154 | + base: "../../build/", |
1155 | + modules: LAZR_MODULES, |
1156 | +}; |
1157 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'lazr.effects', function(Y) { |
1158 | |
1159 | var slide; |
1160 | |
1161 | @@ -176,7 +190,12 @@ |
1162 | |
1163 | <h3>Usage</h3> |
1164 | <pre> |
1165 | -YUI().use('lazr.effects-async', function(Y) { |
1166 | +var LAZR_YUI_CONFIG = { |
1167 | + filter: "min", |
1168 | + base: "../../build/", |
1169 | + modules: LAZR_MODULES, |
1170 | +}; |
1171 | +YUI(LAZR_YUI_CONFIG).use('lazr.effects-async', function(Y) { |
1172 | |
1173 | Y.lazr.effects.async_slideout( |
1174 | '#drawer', // The node to slide opened and closed. |
1175 | @@ -190,11 +209,12 @@ |
1176 | </pre> |
1177 | |
1178 | <script type="text/javascript"> |
1179 | - |
1180 | -YUI({ |
1181 | - base: '../../build/yui/current/build/', |
1182 | - filter: 'raw' |
1183 | - }).use('node', 'event', 'lazr.effects', function(Y) { |
1184 | +var LAZR_YUI_CONFIG = { |
1185 | + filter: "min", |
1186 | + base: "../../build/", |
1187 | + modules: LAZR_MODULES, |
1188 | +}; |
1189 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'lazr.effects', function(Y) { |
1190 | |
1191 | var reset_height = null; |
1192 | var slide_node; |
1193 | @@ -227,6 +247,5 @@ |
1194 | }); |
1195 | |
1196 | </script> |
1197 | - |
1198 | </body> |
1199 | </html> |
1200 | |
1201 | === modified file 'examples/error/index.html' |
1202 | --- examples/error/index.html 2009-11-13 16:15:25 +0000 |
1203 | +++ examples/error/index.html 2009-11-19 17:33:11 +0000 |
1204 | @@ -3,21 +3,28 @@ |
1205 | <html> |
1206 | <head> |
1207 | <title>Lazr-js examples: error</title> |
1208 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1209 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1210 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
1211 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1212 | - <script type="text/javascript" src="../../build/error/error.js"></script> |
1213 | + |
1214 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1215 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1216 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1217 | + |
1218 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1219 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1220 | + <script type="text/javascript"> |
1221 | + var LAZR_YUI_CONFIG = { |
1222 | + filter: "min", |
1223 | + base: "../../build/", |
1224 | + modules: LAZR_MODULES, |
1225 | + }; |
1226 | + </script> |
1227 | + |
1228 | <script type="text/javascript"> |
1229 | |
1230 | // We create a global variable here to reference our display_error |
1231 | // method only so that the call to setTimeout() below used for |
1232 | // demonstration has access to the function. |
1233 | var display_error; |
1234 | -YUI({ |
1235 | - base: '../../build/yui/current/build/', |
1236 | - filter: 'raw' |
1237 | - }).use( |
1238 | +YUI(LAZR_YUI_CONFIG).use( |
1239 | 'lazr.error', 'lazr.anim', 'node', 'event', |
1240 | 'dump', function(Y) { |
1241 | |
1242 | @@ -44,19 +51,6 @@ |
1243 | }); |
1244 | </script> |
1245 | |
1246 | - <!-- |
1247 | - We need to include individual css files because some of them have |
1248 | - relative paths to images. |
1249 | - --> |
1250 | - <link rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"/> |
1251 | - <link rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"/> |
1252 | - <link rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"/> |
1253 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"/> |
1254 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"/> |
1255 | - <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"/> |
1256 | - <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"/> |
1257 | - |
1258 | - <link type="text/css" rel="stylesheet" href="../../build/error/assets/error-core.css"/> |
1259 | </head> |
1260 | |
1261 | <body class="yui-skin-sam"> |
1262 | @@ -80,21 +74,8 @@ |
1263 | |
1264 | <h3>Javascript</h3> |
1265 | <pre> |
1266 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1267 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1268 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
1269 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1270 | - <script type="text/javascript" src="../../build/error/error.js"></script> |
1271 | -</pre> |
1272 | - |
1273 | -<h3>CSS</h3> |
1274 | -<pre> |
1275 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"/> |
1276 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css"/> |
1277 | - <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"/> |
1278 | - <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"/> |
1279 | - |
1280 | - <link type="text/css" rel="stylesheet" href="../../build/error/assets/error-core.css"/> |
1281 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1282 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1283 | </pre> |
1284 | |
1285 | <h2>Widget Setup</h2> |
1286 | |
1287 | === modified file 'examples/formoverlay/index.html' |
1288 | --- examples/formoverlay/index.html 2009-10-22 20:22:12 +0000 |
1289 | +++ examples/formoverlay/index.html 2009-11-19 17:33:11 +0000 |
1290 | @@ -5,24 +5,21 @@ |
1291 | <title>LAZR JS Examples: lazr.formoverlay</title> |
1292 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
1293 | |
1294 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1295 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1296 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1297 | - <script type="text/javascript" src="../../build/formoverlay/formoverlay.js"></script> |
1298 | - |
1299 | - <link rel="stylesheet" href="../../build/yui/current/build/cssreset/reset.css"/> |
1300 | - <link rel="stylesheet" href="../../build/yui/current/build/cssfonts/fonts.css"/> |
1301 | - <link rel="stylesheet" href="../../build/yui/current/build/cssbase/base.css"/> |
1302 | - <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css"/> |
1303 | - <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css"/> |
1304 | - <link rel="stylesheet" href="../../build/formoverlay/assets/formoverlay.css"/> |
1305 | - |
1306 | - <script type="text/javascript"> |
1307 | - |
1308 | -YUI({ |
1309 | - base: "../../build/yui/current/build/", |
1310 | - filter: 'raw', |
1311 | -}).use('lazr.formoverlay', 'node', 'event', 'dump', function(Y) { |
1312 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1313 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1314 | + <script type="text/javascript"> |
1315 | + var LAZR_YUI_CONFIG = { |
1316 | + filter: "min", |
1317 | + base: "../../build/", |
1318 | + modules: LAZR_MODULES, |
1319 | + }; |
1320 | + </script> |
1321 | + |
1322 | + <script type="text/javascript"> |
1323 | + |
1324 | +YUI(LAZR_YUI_CONFIG).use('cssreset', 'cssfonts', 'cssbase', |
1325 | + 'lazr.formoverlay', 'node', 'event', |
1326 | + 'dump', function(Y) { |
1327 | |
1328 | var big_error = [ |
1329 | 'Traceback (most recent call last):', |
1330 | @@ -126,16 +123,8 @@ |
1331 | |
1332 | <h3>Javascript</h3> |
1333 | <pre> |
1334 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1335 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1336 | - <script type="text/javascript" src="../../build/formoverlay/formoverlay.js"></script> |
1337 | - </pre> |
1338 | - |
1339 | - <h3>CSS</h3> |
1340 | - <pre> |
1341 | - <link rel="stylesheet" href="../../build/overlay/assets/pretty-overlay-core.css" /> |
1342 | - <link rel="stylesheet" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css" /> |
1343 | - <link rel="stylesheet" href="../../build/formoverlay/assets/formoverlay.css" /> |
1344 | + <script type="text/javascript" src="../../build/yui/current/build/yui/yui-min.js"></script> |
1345 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1346 | </pre> |
1347 | |
1348 | <h2>Widget Setup</h2> |
1349 | @@ -143,11 +132,18 @@ |
1350 | The normal Overlay attributes (such as headerContent) can be used |
1351 | as expected.</p> |
1352 | <pre><code> |
1353 | + var LAZR_YUI_CONFIG = { |
1354 | + filter: "min", |
1355 | + base: "../../build/", |
1356 | + modules: LAZR_MODULES, |
1357 | + }; |
1358 | + YUI(LAZR_YUI_CONFIG).use("lazr.formoverlay", function(Y){ |
1359 | var form_content = 'Enter name: <input type="text" name="username" />'; |
1360 | var formoverlay = new Y.lazr.FormOverlay({ |
1361 | headerContent: '<h2>Your Form Title</h2>', |
1362 | form_content: form_content}); |
1363 | formoverlay.render(); |
1364 | + }); |
1365 | </code></pre> |
1366 | <p><strong>Note:</strong> The form content can be passed as either a string |
1367 | of HTML (as is useful if the form is obtained via an AJAX request) or |
1368 | |
1369 | === modified file 'examples/inlineeditor/index.html' |
1370 | --- examples/inlineeditor/index.html 2009-11-13 23:59:22 +0000 |
1371 | +++ examples/inlineeditor/index.html 2009-11-19 17:33:11 +0000 |
1372 | @@ -3,17 +3,23 @@ |
1373 | <html> |
1374 | <head> |
1375 | <title>Lazr-js examples: In-line text editing</title> |
1376 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1377 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1378 | - <script type="text/javascript" src="../../build/anim/anim.js"></script> |
1379 | - <script type="text/javascript" src="../../build/inlineedit/editor.js"></script> |
1380 | - |
1381 | - <!-- |
1382 | - We need to include individual css files because some of them have |
1383 | - relative paths to images. |
1384 | - --> |
1385 | - <link type="text/css" rel="stylesheet" href="../../build/lazr-sam.css"></link> |
1386 | - <style> |
1387 | + |
1388 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1389 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1390 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1391 | + |
1392 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1393 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1394 | + <script type="text/javascript"> |
1395 | + var LAZR_YUI_CONFIG = { |
1396 | + filter: "min", |
1397 | + base: "../../build/", |
1398 | + modules: LAZR_MODULES, |
1399 | + insertBefore: "style-overrides", |
1400 | + }; |
1401 | + </script> |
1402 | + |
1403 | + <style id="style-overrides" type="text/css"> |
1404 | #example { |
1405 | margin-left: 20px; |
1406 | padding: 50px 200px 50px 200px; |
1407 | @@ -96,7 +102,12 @@ |
1408 | </pre> |
1409 | |
1410 | <pre> |
1411 | -YUI().use('lazr.editor', function(Y) { |
1412 | +var LAZR_YUI_CONFIG = { |
1413 | + filter: "min", |
1414 | + base: "../../build/", |
1415 | + modules: LAZR_MODULES, |
1416 | +}; |
1417 | +YUI(LAZR_YUI_CONFIG).use('lazr.editor', function(Y) { |
1418 | |
1419 | var editor = new Y.EditableText(...); |
1420 | |
1421 | @@ -352,10 +363,8 @@ |
1422 | |
1423 | <script type="text/javascript"> |
1424 | |
1425 | -YUI({ |
1426 | - base: '../../build/yui/current/build/', |
1427 | - filter: 'raw' |
1428 | - }).use('node', 'event', 'plugin', 'lazr.editor', function(Y) { |
1429 | +YUI(LAZR_YUI_CONFIG).use('node', 'event', 'plugin', |
1430 | + 'lazr.editor', function(Y) { |
1431 | |
1432 | // Add a delay between the start and end of the inline editor widget's |
1433 | // "save" event. |
1434 | |
1435 | === modified file 'examples/lazr/index.html' |
1436 | --- examples/lazr/index.html 2009-10-22 20:22:12 +0000 |
1437 | +++ examples/lazr/index.html 2009-11-19 17:33:11 +0000 |
1438 | @@ -5,15 +5,24 @@ |
1439 | <title>LAZR JS Examples: lazr.base</title> |
1440 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
1441 | |
1442 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1443 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1444 | - |
1445 | - <script type="text/javascript"> |
1446 | - |
1447 | -YUI({ |
1448 | - base: "../../build/yui/current/build/", |
1449 | - filter: 'raw', |
1450 | -}).use('node', 'lazr.base', function(Y) { |
1451 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1452 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1453 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1454 | + |
1455 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1456 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1457 | + <script type="text/javascript"> |
1458 | + var LAZR_YUI_CONFIG = { |
1459 | + filter: "min", |
1460 | + base: "../../build/", |
1461 | + modules: LAZR_MODULES, |
1462 | + insertBefore: "style-overrides", |
1463 | + }; |
1464 | + </script> |
1465 | + |
1466 | + <script type="text/javascript"> |
1467 | + |
1468 | +YUI(LAZR_YUI_CONFIG).use('node', 'lazr.base', function(Y) { |
1469 | |
1470 | Y.log(Y.lazr.ui.OK_BUTTON, 'info'); |
1471 | Y.log(Y.lazr.ui.CANCEL_BUTTON, 'info'); |
1472 | @@ -39,10 +48,7 @@ |
1473 | |
1474 | </script> |
1475 | |
1476 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css" /> |
1477 | - |
1478 | - <style> |
1479 | - |
1480 | + <style id="style-overrides" type="text/css"> |
1481 | #example { |
1482 | margin-left: 5em; |
1483 | padding: 3em; |
1484 | @@ -72,9 +78,8 @@ |
1485 | <p>The common usage:</p> |
1486 | |
1487 | <pre> |
1488 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1489 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1490 | - <script type="text/javascript" src="../../build/lazr/assets/skins/sam/lazr-skin.css"></script> |
1491 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1492 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1493 | </pre> |
1494 | |
1495 | <ul> |
1496 | @@ -107,7 +112,12 @@ |
1497 | <p>And here's the JavaScript to hook it up:</p> |
1498 | |
1499 | <pre> |
1500 | -YUI().use('node', 'lazr.base', function(Y) { |
1501 | +var LAZR_YUI_CONFIG = { |
1502 | + filter: "min", |
1503 | + base: "../../build/", |
1504 | + modules: LAZR_MODULES, |
1505 | +}; |
1506 | +YUI(LAZR_YUI_CONFIG).use('node', 'lazr.base', function(Y) { |
1507 | |
1508 | Y.get('#ok').appendChild( |
1509 | Y.Node.create(Y.lazr.ui.OK_BUTTON)); |
1510 | |
1511 | === modified file 'examples/overlay/index.html' |
1512 | --- examples/overlay/index.html 2009-10-22 20:22:12 +0000 |
1513 | +++ examples/overlay/index.html 2009-11-19 17:33:11 +0000 |
1514 | @@ -3,17 +3,22 @@ |
1515 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
1516 | <head> |
1517 | <title>LAZR JS Examples: lazr.overlay</title> |
1518 | + |
1519 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1520 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1521 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1522 | + |
1523 | <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
1524 | |
1525 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1526 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1527 | - |
1528 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
1529 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
1530 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
1531 | - |
1532 | - <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/pretty-overlay-core.css" /> |
1533 | - <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/skins/sam/pretty-overlay-skin.css" /> |
1534 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1535 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1536 | + <script type="text/javascript"> |
1537 | + var LAZR_YUI_CONFIG = { |
1538 | + filter: "min", |
1539 | + base: "../../build/", |
1540 | + modules: LAZR_MODULES, |
1541 | + }; |
1542 | + </script> |
1543 | </head> |
1544 | |
1545 | <body class="yui-skin-sam"> |
1546 | @@ -53,7 +58,12 @@ |
1547 | <h2>Usage</h2> |
1548 | <h3>Subclassing (probably what you want)</h3> |
1549 | <pre> |
1550 | -YUI().use('lazr.overlay', function(Y) { |
1551 | +var LAZR_YUI_CONFIG = { |
1552 | + filter: "min", |
1553 | + base: "../../build/", |
1554 | + modules: LAZR_MODULES, |
1555 | +}; |
1556 | +YUI(LAZR_YUI_CONFIG).use('lazr.overlay', function(Y) { |
1557 | |
1558 | var MyThing = function() { |
1559 | MyThing.superclass.constructor.apply(this, arguments); |
1560 | @@ -82,13 +92,11 @@ |
1561 | |
1562 | <h3>Instantiating directly (probably not what you want)</h3> |
1563 | <pre> |
1564 | -YUI().use('lazr.overlay', function(Y) { |
1565 | +YUI(LAZR_YUI_CONFIG).use('lazr.overlay', function(Y) { |
1566 | var overlay = new Y.lazr.PrettyOverlay({ |
1567 | bodyContent: 'hello', |
1568 | headerContent: 'heading', |
1569 | - align: { |
1570 | - points: [Y.WidgetPositionExt.CC, Y.WidgetPositionExt.CC] |
1571 | - }, |
1572 | + centered: true, |
1573 | progressbar: true, |
1574 | progress: 12 |
1575 | }); |
1576 | @@ -96,11 +104,6 @@ |
1577 | }); |
1578 | </pre> |
1579 | |
1580 | -<h2>CSS</h2> |
1581 | -<p>You need to include two CSS files, |
1582 | -<a href="../../lib/lazr/build/overlay/assets/pretty-overlay-core.css"><code>overlay/assets/pretty-overlay-core.css</code></a> and |
1583 | -<a href="../../lib/lazr/build/overlay/assets/skins/sam/pretty-overlay-skin.css"><code>overlay/assets/skins/sam/pretty-overlay-skin.css</code></a>.</p> |
1584 | - |
1585 | <h2>Limitations</h2> |
1586 | <p>You can only specify <code>progressbar: {true, false}</code> in the initial |
1587 | config object; it cannot be altered once <code>renderUI()</code> has been called.</p> |
1588 | @@ -108,18 +111,12 @@ |
1589 | |
1590 | |
1591 | <script type="text/javascript"> |
1592 | -YUI({ |
1593 | - base: '../../build/yui/current/build/', |
1594 | - filter: "raw", |
1595 | - combine: false |
1596 | -}).use('lazr.overlay', function(Y) { |
1597 | +YUI(LAZR_YUI_CONFIG).use('lazr.overlay', function(Y) { |
1598 | var overlay = new Y.lazr.PrettyOverlay({ |
1599 | bodyContent: 'hello', |
1600 | headerContent: '<h2>heading</h2>', |
1601 | steptitle: 'First step', |
1602 | - align: { |
1603 | - points: [Y.WidgetPositionExt.CC, Y.WidgetPositionExt.CC] |
1604 | - }, |
1605 | + centered: true, |
1606 | progressbar: true, |
1607 | progress: 12 |
1608 | }); |
1609 | |
1610 | === modified file 'examples/picker/index.html' |
1611 | --- examples/picker/index.html 2009-11-13 22:26:40 +0000 |
1612 | +++ examples/picker/index.html 2009-11-19 17:33:11 +0000 |
1613 | @@ -3,17 +3,25 @@ |
1614 | <html> |
1615 | <head> |
1616 | <title>Lazr-js examples: Picker widget</title> |
1617 | - <script type="text/javascript" src="../../build/yui/current/build/yui/yui.js"></script> |
1618 | - <script type="text/javascript" src="../../build/lazr/lazr.js"></script> |
1619 | - <script type="text/javascript" src="../../build/overlay/overlay.js"></script> |
1620 | - <script type="text/javascript" src="../../build/picker/picker.js"></script> |
1621 | - |
1622 | - <script type="text/javascript"> |
1623 | - |
1624 | -YUI({ |
1625 | - base: '../../build/yui/current/build/', |
1626 | - filter: 'raw' |
1627 | - }).use('lazr.picker', 'dump', function(Y) { |
1628 | + |
1629 | + <link rel="stylesheet" type="text/css" href="../../build/cssreset/reset-min.css"></link> |
1630 | + <link rel="stylesheet" type="text/css" href="../../build/cssfonts/fonts-min.css"></link> |
1631 | + <link rel="stylesheet" type="text/css" href="../../build/cssbase/base-min.css"></link> |
1632 | + |
1633 | + <script type="text/javascript" src="../../build/yui/yui-min.js"></script> |
1634 | + <script type="text/javascript" src="../../build/lazr/lazr-meta.js"></script> |
1635 | + <script type="text/javascript"> |
1636 | + var LAZR_YUI_CONFIG = { |
1637 | + filter: "min", |
1638 | + base: "../../build/", |
1639 | + modules: LAZR_MODULES, |
1640 | + insertBefore: "style-overrides", |
1641 | + }; |
1642 | + </script> |
1643 | + |
1644 | + <script type="text/javascript"> |
1645 | + |
1646 | +YUI(LAZR_YUI_CONFIG).use('lazr.picker', 'dump', function(Y) { |
1647 | // Parse the content of the textarea in the data structure |
1648 | // expected by the widget. |
1649 | function parse_items () { |
1650 | @@ -156,15 +164,7 @@ |
1651 | }); |
1652 | </script> |
1653 | |
1654 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssreset/reset.css" /> |
1655 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssfonts/fonts.css" /> |
1656 | - <link rel="stylesheet" type="text/css" href="../../build/yui/current/build/cssbase/base.css" /> |
1657 | - |
1658 | - <link rel="stylesheet" type="text/css" href="../../build/overlay/assets/skins/sam/pretty-overlay.css" /> |
1659 | - <link type="text/css" rel="stylesheet" href="../../build/lazr/assets/skins/sam/lazr.css" /> |
1660 | - <link type="text/css" rel="stylesheet" href="../../build/picker/assets/picker-core.css" /> |
1661 | - <link type="text/css" rel="stylesheet" href="../../build/picker/assets/skins/sam/picker-skin.css" /> |
1662 | - <style> |
1663 | + <style id="style-overrides" type="text/css"> |
1664 | #example { width: 500px; } |
1665 | #items { width: 500px; } |
1666 | body { |
1667 | |
1668 | === modified file 'src-js/lazrjs/activator/activator.js' |
1669 | --- src-js/lazrjs/activator/activator.js 2009-11-12 21:35:17 +0000 |
1670 | +++ src-js/lazrjs/activator/activator.js 2009-11-19 17:33:11 +0000 |
1671 | @@ -274,5 +274,6 @@ |
1672 | // Nuke the tabindex attribute. |
1673 | Y.augment(Activator, Y.lazr.ui.NoTabIndex, true); |
1674 | |
1675 | -}, "0.1", {"requires": |
1676 | - ["oop", "event", "node", "widget", "lazr.anim", "lazr.base"]}); |
1677 | +}, "0.1", {"skinnable": true, |
1678 | + "requires": ["oop", "event", "node", "widget", |
1679 | + "lazr.anim", "lazr.base"]}); |
1680 | |
1681 | === modified file 'src-js/lazrjs/autocomplete/autocomplete.js' |
1682 | --- src-js/lazrjs/autocomplete/autocomplete.js 2009-11-12 21:35:17 +0000 |
1683 | +++ src-js/lazrjs/autocomplete/autocomplete.js 2009-11-19 17:33:11 +0000 |
1684 | @@ -789,4 +789,5 @@ |
1685 | }; |
1686 | |
1687 | |
1688 | -}, "0.1", {"requires":["oop", "base", "event", "widget", "widget-stack", "node-menunav"]}); |
1689 | +}, "0.1", {"skinnable": true, "requires":["oop", "base", "event", "widget", |
1690 | + "widget-stack", "node-menunav"]}); |
1691 | |
1692 | === modified file 'src-js/lazrjs/choiceedit/assets/choiceedit-core.css' |
1693 | --- src-js/lazrjs/choiceedit/assets/choiceedit-core.css 2009-07-31 00:06:15 +0000 |
1694 | +++ src-js/lazrjs/choiceedit/assets/choiceedit-core.css 2009-11-19 17:33:11 +0000 |
1695 | @@ -30,7 +30,7 @@ |
1696 | .yui-ichoicelist li a:hover { |
1697 | background-color: #eee; |
1698 | } |
1699 | -.yui-ichoicelist #yui-pretty-overlay-modal h2 {/ |
1700 | +.yui-ichoicelist #yui-pretty-overlay-modal h2 { |
1701 | font-weight: bold; |
1702 | font-size: 1.2em; |
1703 | text-indent: 0; |
1704 | |
1705 | === added directory 'src-js/lazrjs/choiceedit/assets/skins' |
1706 | === added directory 'src-js/lazrjs/choiceedit/assets/skins/sam' |
1707 | === added file 'src-js/lazrjs/choiceedit/assets/skins/sam/choiceedit-skin.css' |
1708 | --- src-js/lazrjs/choiceedit/assets/skins/sam/choiceedit-skin.css 1970-01-01 00:00:00 +0000 |
1709 | +++ src-js/lazrjs/choiceedit/assets/skins/sam/choiceedit-skin.css 2009-11-19 17:33:11 +0000 |
1710 | @@ -0,0 +1,3 @@ |
1711 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
1712 | + |
1713 | +/* Placeholder for skinning of the Choice Edit Widget */ |
1714 | \ No newline at end of file |
1715 | |
1716 | === modified file 'src-js/lazrjs/choiceedit/choiceedit.js' |
1717 | --- src-js/lazrjs/choiceedit/choiceedit.js 2009-11-13 20:50:08 +0000 |
1718 | +++ src-js/lazrjs/choiceedit/choiceedit.js 2009-11-19 17:33:11 +0000 |
1719 | @@ -661,7 +661,8 @@ |
1720 | |
1721 | Y.NullChoiceSource = NullChoiceSource; |
1722 | |
1723 | -},"0.2", {"requires": ["oop", "event", "event-delegate", "node", |
1724 | - "widget", "widget-stdmod", "overlay", |
1725 | - "lazr.overlay", "lazr.anim", "lazr.base"]}); |
1726 | +},"0.2", {"skinnable": true, |
1727 | + "requires": ["oop", "event", "event-delegate", "node", |
1728 | + "widget", "widget-stdmod", "overlay", |
1729 | + "lazr.overlay", "lazr.anim", "lazr.base"]}); |
1730 | |
1731 | |
1732 | === modified file 'src-js/lazrjs/effects/effects.js' |
1733 | --- src-js/lazrjs/effects/effects.js 2009-11-12 21:35:17 +0000 |
1734 | +++ src-js/lazrjs/effects/effects.js 2009-11-19 17:33:11 +0000 |
1735 | @@ -183,4 +183,5 @@ |
1736 | } |
1737 | |
1738 | |
1739 | -}, null, { "requires":["anim", "node"] }); |
1740 | +}, null, {"skinnable": true, |
1741 | + "requires":["anim", "node"]}); |
1742 | |
1743 | === added directory 'src-js/lazrjs/error/assets/skins' |
1744 | === added directory 'src-js/lazrjs/error/assets/skins/sam' |
1745 | === added file 'src-js/lazrjs/error/assets/skins/sam/error-skin.css' |
1746 | --- src-js/lazrjs/error/assets/skins/sam/error-skin.css 1970-01-01 00:00:00 +0000 |
1747 | +++ src-js/lazrjs/error/assets/skins/sam/error-skin.css 2009-11-19 17:33:11 +0000 |
1748 | @@ -0,0 +1,3 @@ |
1749 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
1750 | + |
1751 | +/* Placeholder for skinning of the Error Widget */ |
1752 | \ No newline at end of file |
1753 | |
1754 | === modified file 'src-js/lazrjs/error/error.js' |
1755 | --- src-js/lazrjs/error/error.js 2009-11-16 14:39:47 +0000 |
1756 | +++ src-js/lazrjs/error/error.js 2009-11-19 17:33:11 +0000 |
1757 | @@ -165,4 +165,4 @@ |
1758 | Y.lazr.error.widget = error_widget; |
1759 | Y.lazr.error.BasicErrorWidget = BasicErrorWidget; |
1760 | |
1761 | -}, "0.1", {"requires":["lazr.overlay"]}); |
1762 | +}, "0.1", {"skinnable": true, "requires":["lazr.overlay"]}); |
1763 | |
1764 | === renamed file 'src-js/lazrjs/formoverlay/assets/formoverlay.css' => 'src-js/lazrjs/formoverlay/assets/formoverlay-core.css' |
1765 | === added directory 'src-js/lazrjs/formoverlay/assets/skins' |
1766 | === added directory 'src-js/lazrjs/formoverlay/assets/skins/sam' |
1767 | === added file 'src-js/lazrjs/formoverlay/assets/skins/sam/formoverlay-skin.css' |
1768 | --- src-js/lazrjs/formoverlay/assets/skins/sam/formoverlay-skin.css 1970-01-01 00:00:00 +0000 |
1769 | +++ src-js/lazrjs/formoverlay/assets/skins/sam/formoverlay-skin.css 2009-11-19 17:33:11 +0000 |
1770 | @@ -0,0 +1,3 @@ |
1771 | +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */ |
1772 | + |
1773 | +/* Placeholder for skinning of the Form Overlay Widget */ |
1774 | \ No newline at end of file |
1775 | |
1776 | === modified file 'src-js/lazrjs/formoverlay/formoverlay.js' |
1777 | --- src-js/lazrjs/formoverlay/formoverlay.js 2009-11-12 21:35:17 +0000 |
1778 | +++ src-js/lazrjs/formoverlay/formoverlay.js 2009-11-19 17:33:11 +0000 |
1779 | @@ -499,4 +499,4 @@ |
1780 | |
1781 | Y.lazr.FormOverlay = FormOverlay; |
1782 | |
1783 | -}, "0.1", { "requires": ["lazr.overlay"] }); |
1784 | +}, "0.1", {"skinnable": true, "requires": ["lazr.overlay"]}); |
1785 | |
1786 | === modified file 'src-js/lazrjs/inlineedit/editor.js' |
1787 | --- src-js/lazrjs/inlineedit/editor.js 2009-11-13 20:50:08 +0000 |
1788 | +++ src-js/lazrjs/inlineedit/editor.js 2009-11-19 17:33:11 +0000 |
1789 | @@ -1499,5 +1499,6 @@ |
1790 | |
1791 | //~ Y.log("Module loaded", 'info', 'lazr.editor'); |
1792 | |
1793 | -}, "0.2", {"requires": ["oop", "anim", "event", "node", "widget", |
1794 | +}, "0.2", {"skinnable": true, |
1795 | + "requires": ["oop", "anim", "event", "node", "widget", |
1796 | "lazr.anim", "lazr.base"]}); |
1797 | |
1798 | === modified file 'src-js/lazrjs/lazr/lazr.js' |
1799 | --- src-js/lazrjs/lazr/lazr.js 2009-11-12 21:35:17 +0000 |
1800 | +++ src-js/lazrjs/lazr/lazr.js 2009-11-19 17:33:11 +0000 |
1801 | @@ -145,4 +145,4 @@ |
1802 | }; |
1803 | |
1804 | |
1805 | -}, "0.1", {"requires": ["classnamemanager"]}); |
1806 | +}, "0.1", {"skinnable": true, "requires": ["classnamemanager"]}); |
1807 | |
1808 | === modified file 'src-js/lazrjs/overlay/assets/pretty-overlay-core.css' |
1809 | --- src-js/lazrjs/overlay/assets/pretty-overlay-core.css 2009-10-21 21:43:07 +0000 |
1810 | +++ src-js/lazrjs/overlay/assets/pretty-overlay-core.css 2009-11-19 17:33:11 +0000 |
1811 | @@ -3,11 +3,16 @@ |
1812 | /* blocking-div appears above everything else. */ |
1813 | .blocking-div { |
1814 | z-index: 999; |
1815 | - position: fixed; |
1816 | - left: 0px; |
1817 | - top: 0px; |
1818 | - right: 0px; |
1819 | - bottom: 0px; |
1820 | + opacity:0; |
1821 | + filter:alpha(opacity=0); |
1822 | + position:absolute; |
1823 | + border:none; |
1824 | + top:0px; |
1825 | + left:0px; |
1826 | + padding:0; |
1827 | + margin:0; |
1828 | + width:100%; |
1829 | + height:100%; |
1830 | } |
1831 | |
1832 | /* overlay appears above blocking-div. */ |
1833 | |
1834 | === modified file 'src-js/lazrjs/overlay/overlay.js' |
1835 | --- src-js/lazrjs/overlay/overlay.js 2009-11-13 15:20:06 +0000 |
1836 | +++ src-js/lazrjs/overlay/overlay.js 2009-11-19 17:33:11 +0000 |
1837 | @@ -210,7 +210,7 @@ |
1838 | if (visible) { |
1839 | Y.get('body').appendChild(this._blocking_div); |
1840 | // Handle Escape (code 27) on keydown. |
1841 | - this._doc_kp_handler = Y.on('key', function() { |
1842 | + this._doc_kp_handler = Y.on('key', function() { |
1843 | self.fire(CANCEL); |
1844 | }, document, 'down:27'); |
1845 | } else { |
1846 | @@ -364,4 +364,4 @@ |
1847 | |
1848 | Y.lazr.PrettyOverlay = PrettyOverlay; |
1849 | |
1850 | -}, "0.1", {"requires": ["oop", "overlay", "event", "widget-position"]}); |
1851 | +}, "0.1", {"skinnable": true, "requires": ["oop", "overlay", "event", "widget", "widget-stack", "widget-position", "widget-position-ext"]}); |
1852 | |
1853 | === modified file 'src-js/lazrjs/picker/picker.js' |
1854 | --- src-js/lazrjs/picker/picker.js 2009-11-13 20:50:08 +0000 |
1855 | +++ src-js/lazrjs/picker/picker.js 2009-11-19 17:33:11 +0000 |
1856 | @@ -825,7 +825,8 @@ |
1857 | |
1858 | Y.Picker = Picker; |
1859 | |
1860 | -}, "0.1", {"requires": ["oop", "event", "event-focus", "node", |
1861 | +}, "0.1", {"skinnable": true, |
1862 | + "requires": ["oop", "event", "event-focus", "node", |
1863 | "substitute", "widget", "widget-stdmod", |
1864 | "lazr.overlay", "lazr.anim", "lazr.base"] |
1865 | }); |
1866 | |
1867 | === renamed directory 'src-js/lazrjs/yui/current/build/anim' => 'src-js/lazrjs/yui/anim' |
1868 | === renamed directory 'src-js/lazrjs/yui/current/build/assets' => 'src-js/lazrjs/yui/assets' |
1869 | === renamed directory 'src-js/lazrjs/yui/current/build/async-queue' => 'src-js/lazrjs/yui/async-queue' |
1870 | === renamed directory 'src-js/lazrjs/yui/current/build/attribute' => 'src-js/lazrjs/yui/attribute' |
1871 | === renamed directory 'src-js/lazrjs/yui/current/build/base' => 'src-js/lazrjs/yui/base' |
1872 | === renamed directory 'src-js/lazrjs/yui/current/build/cache' => 'src-js/lazrjs/yui/cache' |
1873 | === renamed directory 'src-js/lazrjs/yui/current/build/classnamemanager' => 'src-js/lazrjs/yui/classnamemanager' |
1874 | === renamed directory 'src-js/lazrjs/yui/current/build/collection' => 'src-js/lazrjs/yui/collection' |
1875 | === renamed directory 'src-js/lazrjs/yui/current/build/compat' => 'src-js/lazrjs/yui/compat' |
1876 | === renamed directory 'src-js/lazrjs/yui/current/build/console' => 'src-js/lazrjs/yui/console' |
1877 | === renamed directory 'src-js/lazrjs/yui/current/build/cookie' => 'src-js/lazrjs/yui/cookie' |
1878 | === renamed directory 'src-js/lazrjs/yui/current/build/cssbase' => 'src-js/lazrjs/yui/cssbase' |
1879 | === renamed directory 'src-js/lazrjs/yui/current/build/cssfonts' => 'src-js/lazrjs/yui/cssfonts' |
1880 | === renamed directory 'src-js/lazrjs/yui/current/build/cssgrids' => 'src-js/lazrjs/yui/cssgrids' |
1881 | === renamed directory 'src-js/lazrjs/yui/current/build/cssreset' => 'src-js/lazrjs/yui/cssreset' |
1882 | === removed directory 'src-js/lazrjs/yui/current' |
1883 | === removed directory 'src-js/lazrjs/yui/current/build' |
1884 | === renamed directory 'src-js/lazrjs/yui/current/build/dataschema' => 'src-js/lazrjs/yui/dataschema' |
1885 | === renamed directory 'src-js/lazrjs/yui/current/build/datasource' => 'src-js/lazrjs/yui/datasource' |
1886 | === renamed directory 'src-js/lazrjs/yui/current/build/datatype' => 'src-js/lazrjs/yui/datatype' |
1887 | === renamed directory 'src-js/lazrjs/yui/current/build/dd' => 'src-js/lazrjs/yui/dd' |
1888 | === renamed directory 'src-js/lazrjs/yui/current/build/dom' => 'src-js/lazrjs/yui/dom' |
1889 | === renamed directory 'src-js/lazrjs/yui/current/build/dump' => 'src-js/lazrjs/yui/dump' |
1890 | === renamed directory 'src-js/lazrjs/yui/current/build/event' => 'src-js/lazrjs/yui/event' |
1891 | === renamed directory 'src-js/lazrjs/yui/current/build/event-custom' => 'src-js/lazrjs/yui/event-custom' |
1892 | === renamed directory 'src-js/lazrjs/yui/current/build/event-simulate' => 'src-js/lazrjs/yui/event-simulate' |
1893 | === renamed directory 'src-js/lazrjs/yui/current/build/get' => 'src-js/lazrjs/yui/get' |
1894 | === renamed directory 'src-js/lazrjs/yui/current/build/history' => 'src-js/lazrjs/yui/history' |
1895 | === renamed directory 'src-js/lazrjs/yui/current/build/imageloader' => 'src-js/lazrjs/yui/imageloader' |
1896 | === renamed directory 'src-js/lazrjs/yui/current/build/io' => 'src-js/lazrjs/yui/io' |
1897 | === renamed directory 'src-js/lazrjs/yui/current/build/json' => 'src-js/lazrjs/yui/json' |
1898 | === renamed directory 'src-js/lazrjs/yui/current/build/loader' => 'src-js/lazrjs/yui/loader' |
1899 | === renamed directory 'src-js/lazrjs/yui/current/build/node' => 'src-js/lazrjs/yui/node' |
1900 | === renamed directory 'src-js/lazrjs/yui/current/build/node-focusmanager' => 'src-js/lazrjs/yui/node-focusmanager' |
1901 | === renamed directory 'src-js/lazrjs/yui/current/build/node-menunav' => 'src-js/lazrjs/yui/node-menunav' |
1902 | === renamed directory 'src-js/lazrjs/yui/current/build/oop' => 'src-js/lazrjs/yui/oop' |
1903 | === renamed directory 'src-js/lazrjs/yui/current/build/overlay' => 'src-js/lazrjs/yui/overlay' |
1904 | === renamed directory 'src-js/lazrjs/yui/current/build/plugin' => 'src-js/lazrjs/yui/plugin' |
1905 | === renamed directory 'src-js/lazrjs/yui/current/build/pluginhost' => 'src-js/lazrjs/yui/pluginhost' |
1906 | === renamed directory 'src-js/lazrjs/yui/current/build/profiler' => 'src-js/lazrjs/yui/profiler' |
1907 | === renamed directory 'src-js/lazrjs/yui/current/build/queue-promote' => 'src-js/lazrjs/yui/queue-promote' |
1908 | === renamed directory 'src-js/lazrjs/yui/current/build/slider' => 'src-js/lazrjs/yui/slider' |
1909 | === renamed directory 'src-js/lazrjs/yui/current/build/stylesheet' => 'src-js/lazrjs/yui/stylesheet' |
1910 | === renamed directory 'src-js/lazrjs/yui/current/build/substitute' => 'src-js/lazrjs/yui/substitute' |
1911 | === renamed directory 'src-js/lazrjs/yui/current/build/test' => 'src-js/lazrjs/yui/test' |
1912 | === renamed directory 'src-js/lazrjs/yui/current/build/widget' => 'src-js/lazrjs/yui/widget' |
1913 | === renamed directory 'src-js/lazrjs/yui/current/build/yui' => 'src-js/lazrjs/yui/yui' |
1914 | === renamed directory 'src-js/lazrjs/yui/current/build/yui-base' => 'src-js/lazrjs/yui/yui-base' |
1915 | === modified file 'src-py/lazr/js/build.py' |
1916 | --- src-py/lazr/js/build.py 2009-11-13 16:47:45 +0000 |
1917 | +++ src-py/lazr/js/build.py 2009-11-19 17:33:11 +0000 |
1918 | @@ -211,9 +211,6 @@ |
1919 | self.extra_files = [] |
1920 | else: |
1921 | self.extra_files = extra_files |
1922 | - # If we build the lazr-js widgets, make sure that YUI source is |
1923 | - # included as well, since we depend on it being available. |
1924 | - self.include_yui = (src_dir == SRC_DIR) |
1925 | |
1926 | self.exclusion_regex = exclude_regex |
1927 | self.file_type = file_type |
1928 | @@ -420,14 +417,6 @@ |
1929 | |
1930 | self.update_combined_js_file() |
1931 | self.update_combined_css_skins() |
1932 | - if self.include_yui: |
1933 | - self.link_yui_directory() |
1934 | - |
1935 | - def link_yui_directory(self): |
1936 | - """Link to the built yui source directory.""" |
1937 | - yui_directory = os.path.join(os.path.dirname(lazrjs.__file__), 'yui') |
1938 | - link_location = os.path.join(self.build_dir, 'yui') |
1939 | - self.ensure_link(yui_directory, link_location) |
1940 | |
1941 | |
1942 | def get_options(): |
1943 | |
1944 | === modified file 'src-py/lazr/js/meta.py' |
1945 | --- src-py/lazr/js/meta.py 2009-11-13 15:37:35 +0000 |
1946 | +++ src-py/lazr/js/meta.py 2009-11-19 17:33:11 +0000 |
1947 | @@ -77,12 +77,16 @@ |
1948 | meta = extract_metadata(data) |
1949 | prefix = "" |
1950 | if self.prefix and not prefix.endswith("/"): |
1951 | - prefix = prefix + "/" |
1952 | + prefix = self.prefix + "/" |
1953 | for entry in meta: |
1954 | entry["path"] = ( |
1955 | - prefix + fname.replace(root + os.path.sep, "")) |
1956 | + prefix + fname.replace(root + os.path.sep, "") |
1957 | + ).replace(os.path.sep, "/") |
1958 | + |
1959 | entry["type"] = "js" |
1960 | entry["ext"] = self.ext |
1961 | + if entry.get("skinnable"): |
1962 | + self.generate_skin_modules(entry, metadata, root) |
1963 | metadata.extend(meta) |
1964 | |
1965 | modules = {} |
1966 | @@ -93,6 +97,94 @@ |
1967 | open(out, "w").write("var %s = %s;" % |
1968 | (var_name, simplejson.dumps(modules))) |
1969 | |
1970 | + def generate_skin_modules(self, entry, metadata, root): |
1971 | + # Generate a skin module definition, since YUI assumes that |
1972 | + # the path starts with the module name, and that breaks with |
1973 | + # our structure. |
1974 | + # |
1975 | + # Follow lazr-js conventions and look for any file in the skin |
1976 | + # assets directory. |
1977 | + module_names = [] |
1978 | + by_name = {} |
1979 | + |
1980 | + prefix = "" |
1981 | + if self.prefix and not prefix.endswith("/"): |
1982 | + prefix = self.prefix + "/" |
1983 | + |
1984 | + # Default 'after' modules from YUI Loader. Might have to |
1985 | + # be changed in the future, if YUI itself changes. |
1986 | + after = ["cssreset", "cssfonts", |
1987 | + "cssgrids", "cssreset-context", |
1988 | + "cssfonts-context", |
1989 | + "cssgrids-context"] |
1990 | + |
1991 | + if entry.get("requires"): |
1992 | + # If the base module requires other modules, extend |
1993 | + # the after entry with the (expected) skins for those |
1994 | + # modules to force our skin to be loaded after those. |
1995 | + after.extend(["skin-sam-%s" % s |
1996 | + for s in entry["requires"]]) |
1997 | + |
1998 | + assets = os.path.join( |
1999 | + os.path.dirname(entry["path"][len(prefix):]), "assets") |
2000 | + sam = os.path.join(assets, "skins", "sam") |
2001 | + css_assets = glob.glob(os.path.join(root, sam, "*-skin.css")) |
2002 | + |
2003 | + for fname in css_assets: |
2004 | + if not os.path.exists(fname): |
2005 | + # If the file doesn't exist, don't create a module to |
2006 | + # load it. |
2007 | + continue |
2008 | + |
2009 | + # Compute a module name for this asset. |
2010 | + module_name = os.path.basename(fname)[:-len("-skin.css")] |
2011 | + skin_module_name = "skin-sam-%s" % entry["name"] |
2012 | + # If the computed module_name does not match the |
2013 | + # Javascript module name without the namespace, then use |
2014 | + # it as a postfix to disambiguate possibly multiple |
2015 | + # modules. |
2016 | + package = entry["name"].split(".")[-1] |
2017 | + if module_name != package and len(css_assets) > 1: |
2018 | + skin_module_name = "%s+%s" % (skin_module_name, module_name) |
2019 | + |
2020 | + css = (fname.replace(root + os.path.sep, "") |
2021 | + ).replace(os.path.sep, "/") |
2022 | + module = {"name": skin_module_name, |
2023 | + "after": after[:], |
2024 | + "type": "css", |
2025 | + "ext": self.ext, |
2026 | + "path": prefix + css} |
2027 | + by_name[skin_module_name] = module |
2028 | + module_names.append(skin_module_name) |
2029 | + metadata.append(module) |
2030 | + |
2031 | + # All assets under the skin have been looked at. Now look for |
2032 | + # a "-core.css" asset, following lazr-js conventions and add |
2033 | + # it as a requirement for the previously-found assets. |
2034 | + for module_name in module_names: |
2035 | + name = os.path.basename( |
2036 | + by_name[module_name]["path"])[:-len("-skin.css")] |
2037 | + fname = os.path.join(root, assets, "%s-core.css" % name) |
2038 | + if not os.path.exists(fname): |
2039 | + # No core CSS asset exists for this skin, skip |
2040 | + # generating a module for it. |
2041 | + continue |
2042 | + |
2043 | + skin_module_name = "%s+core" % module_name |
2044 | + css = (fname.replace(root + os.path.sep, "") |
2045 | + ).replace(os.path.sep, "/") |
2046 | + module = {"name": skin_module_name, |
2047 | + "after": after[:], |
2048 | + "type": "css", |
2049 | + "ext": self.ext, |
2050 | + "path": prefix + css} |
2051 | + |
2052 | + requires = by_name[module_name].setdefault("requires", []) |
2053 | + requires.append(skin_module_name) |
2054 | + after = by_name[module_name].setdefault("after", []) |
2055 | + after.append(skin_module_name) |
2056 | + metadata.append(module) |
2057 | + |
2058 | def do_build(self): |
2059 | included_files = [] |
2060 | |
2061 | |
2062 | === modified file 'src-py/lazr/js/tests/test_meta.py' |
2063 | --- src-py/lazr/js/tests/test_meta.py 2009-11-13 20:24:46 +0000 |
2064 | +++ src-py/lazr/js/tests/test_meta.py 2009-11-19 17:33:11 +0000 |
2065 | @@ -185,7 +185,7 @@ |
2066 | Y.log('goodbye world'); |
2067 | }, Y); |
2068 | }, '0.1', {"use": ["dom"], "omit": ["nono"], |
2069 | - "skinnable": true, "optional": ["meh"], |
2070 | + "optional": ["meh"], |
2071 | "supersedes": ["old-anim"], |
2072 | "after": ["lazr.base"]}); |
2073 | """) |
2074 | @@ -194,12 +194,10 @@ |
2075 | self.assertEquals(metadata[0]["name"], "lazr.anim") |
2076 | self.assertEquals(metadata[0]["use"], ["dom"]) |
2077 | self.assertEquals(metadata[0]["omit"], ["nono"]) |
2078 | - self.assertEquals(metadata[0]["skinnable"], True) |
2079 | self.assertEquals(metadata[0]["optional"], ["meh"]) |
2080 | self.assertEquals(metadata[0]["supersedes"], ["old-anim"]) |
2081 | self.assertEquals(metadata[0]["after"], ["lazr.base"]) |
2082 | |
2083 | - |
2084 | class GenerateMetadataTest(mocker.MockerTestCase): |
2085 | |
2086 | def test_generate_metadata_simple(self): |
2087 | @@ -231,6 +229,123 @@ |
2088 | open(output, "r").read(), |
2089 | "var LAZR_CONFIG = %s;" % simplejson.dumps(config)) |
2090 | |
2091 | + def test_extract_skinnable(self): |
2092 | + """ |
2093 | + If a module is skinnable, we'll generate the module |
2094 | + registration for it's skin ourselves, to prevent YUI from |
2095 | + auto-generating one, since it assumes the skin path starts |
2096 | + with the module name. |
2097 | + """ |
2098 | + root = self.makeDir() |
2099 | + anim = self.makeDir(path=os.path.join(root, "anim")) |
2100 | + sample = self.makeFile("""\ |
2101 | + YUI.add('lazr.anim', function(Y){ |
2102 | + Y.log('Hello World'); |
2103 | + }, "0.1", {"use": ["dom"], "requires": ["widget"], "skinnable": true}); |
2104 | + """, basename="anim.js", dirname=anim) |
2105 | + |
2106 | + skin = self.makeDir(path=os.path.join(anim, "assets", "skins", "sam")) |
2107 | + css = self.makeFile("""\ |
2108 | + /* anim-skin.css */ |
2109 | + """, basename="anim-skin.css", dirname=skin) |
2110 | + |
2111 | + output = self.makeFile("") |
2112 | + builder = TestBuilder(name="LAZR_CONFIG", src_dir=root, |
2113 | + output=output, exclude_regex="", |
2114 | + prefix="lazr") |
2115 | + builder.do_build() |
2116 | + |
2117 | + config = { |
2118 | + "skin-sam-lazr.anim": |
2119 | + {"path": "lazr/anim/assets/skins/sam/anim-skin.css", |
2120 | + "type": "css", |
2121 | + "ext": True, |
2122 | + "after": ["cssreset", "cssfonts", "cssgrids", |
2123 | + "cssreset-context", "cssfonts-context", |
2124 | + "cssgrids-context", "skin-sam-widget"], |
2125 | + }, |
2126 | + "lazr.anim": |
2127 | + {"path": "lazr/anim/anim.js", |
2128 | + "use": ["dom"], |
2129 | + "requires": ["widget"], |
2130 | + "type": "js", |
2131 | + "ext": True, |
2132 | + "skinnable": True, |
2133 | + } |
2134 | + } |
2135 | + |
2136 | + got = open(output, "r").read() |
2137 | + prefix = got[:18] |
2138 | + self.assertEquals(prefix, "var LAZR_CONFIG = ") |
2139 | + self.assertEquals(simplejson.loads(got[18:-1]), config) |
2140 | + |
2141 | + def test_extract_skinnable_with_lazr_conventions(self): |
2142 | + """ |
2143 | + LazrJS conventionally uses a "-core.css" file to load core CSS rules, |
2144 | + and a "-skin.css" file to store skinnable rules. |
2145 | + |
2146 | + If we find this filesystem structure, let's generate different |
2147 | + CSS modules and hook them up accordingly. The filename doesn't |
2148 | + need to match the module name. |
2149 | + """ |
2150 | + root = self.makeDir() |
2151 | + anim = self.makeDir(path=os.path.join(root, "anim")) |
2152 | + sample = self.makeFile("""\ |
2153 | + YUI.add('lazr.anim', function(Y){ |
2154 | + Y.log('Hello World'); |
2155 | + }, "0.1", {"use": ["dom"], "requires": ["widget"], "skinnable": true}); |
2156 | + """, basename="anim.js", dirname=anim) |
2157 | + |
2158 | + assets = self.makeDir(path=os.path.join(anim, "assets")) |
2159 | + css_core = self.makeFile("""\ |
2160 | + /* purty-anim-core.css */ |
2161 | + """, basename="purty-anim-core.css", dirname=assets) |
2162 | + |
2163 | + skin = self.makeDir(path=os.path.join(assets, "skins", "sam")) |
2164 | + css_skin = self.makeFile("""\ |
2165 | + /* purty-anim-skin.css */ |
2166 | + """, basename="purty-anim-skin.css", dirname=skin) |
2167 | + |
2168 | + output = self.makeFile("") |
2169 | + builder = TestBuilder(name="LAZR_CONFIG", src_dir=root, |
2170 | + output=output, exclude_regex="", |
2171 | + prefix="lazr") |
2172 | + builder.do_build() |
2173 | + |
2174 | + config = { |
2175 | + "skin-sam-lazr.anim+core": |
2176 | + {"path": "lazr/anim/assets/purty-anim-core.css", |
2177 | + "type": "css", |
2178 | + "ext": True, |
2179 | + "after": ["cssreset", "cssfonts", "cssgrids", |
2180 | + "cssreset-context", "cssfonts-context", |
2181 | + "cssgrids-context", "skin-sam-widget"], |
2182 | + }, |
2183 | + "skin-sam-lazr.anim": |
2184 | + {"path": "lazr/anim/assets/skins/sam/purty-anim-skin.css", |
2185 | + "type": "css", |
2186 | + "ext": True, |
2187 | + "after": ["cssreset", "cssfonts", "cssgrids", |
2188 | + "cssreset-context", "cssfonts-context", |
2189 | + "cssgrids-context", "skin-sam-widget", |
2190 | + "skin-sam-lazr.anim+core"], |
2191 | + "requires": ["skin-sam-lazr.anim+core"], |
2192 | + }, |
2193 | + "lazr.anim": |
2194 | + {"path": "lazr/anim/anim.js", |
2195 | + "use": ["dom"], |
2196 | + "requires": ["widget"], |
2197 | + "type": "js", |
2198 | + "ext": True, |
2199 | + "skinnable": True, |
2200 | + } |
2201 | + } |
2202 | + |
2203 | + got = open(output, "r").read() |
2204 | + prefix = got[:18] |
2205 | + self.assertEquals(prefix, "var LAZR_CONFIG = ") |
2206 | + self.assertEquals(simplejson.loads(got[18:-1]), config) |
2207 | + |
2208 | |
2209 | def test_suite(): |
2210 | return defaultTestLoader.loadTestsFromName(__name__) |
- Implements a demo combo-service which is able to serve the contents of the 'build' directory (see examples/ combo.html)
- Fix all examples to use pure loader goodness.