Merge lp:~rockstar/phazr/builder into lp:phazr

Proposed by Paul Hummer
Status: Merged
Merged at revision: 13
Proposed branch: lp:~rockstar/phazr/builder
Merge into: lp:phazr
Diff against target: 597 lines (+280/-249)
11 files modified
.bzrignore (+1/-0)
Makefile (+20/-0)
src/editableplugin/build.properties (+5/-0)
src/editableplugin/build.xml (+7/-0)
src/editableplugin/js/editable.js (+80/-88)
src/formplugin/build.properties (+5/-0)
src/formplugin/build.xml (+7/-0)
src/formplugin/js/form.js (+74/-81)
src/phazroverlay/build.properties (+5/-0)
src/phazroverlay/build.xml (+7/-0)
src/phazroverlay/js/overlay.js (+69/-80)
To merge this branch: bzr merge lp:~rockstar/phazr/builder
Reviewer Review Type Date Requested Status
Martin Albisetti (community) Approve
Phazr team Pending
Review via email: mp+72806@code.launchpad.net

Description of the change

This branch makes changes to the layout of the library so that the javascript files are built with the YUI Builder. The Makefile even goes out to get a copy of the Builder as well.

My intention is to get the assets (css and images) sorted out with the Builder as well, and then generate a tarball with all the dependencies in it. I'll then distribute the resulting tarball.

To post a comment you must log in.
Revision history for this message
Martin Albisetti (beuno) wrote :

I can't seem to get make to work:

beuno@beuno-laptop:~/canonical/builder$ make
cd src/phazroverlay; ant build
Buildfile: /home/beuno/canonical/builder/src/phazroverlay/build.xml

BUILD FAILED
/home/beuno/canonical/builder/src/phazroverlay/build.xml:6: Cannot find /home/beuno/canonical/builder/componentbuild/3.x/bootstrap.xml imported from /home/beuno/canonical/builder/src/phazroverlay/build.xml

Total time: 0 seconds
make: *** [phazr-overlay] Error 1

review: Needs Information
Revision history for this message
Paul Hummer (rockstar) wrote :

Ha! It's because your CWD is called "builder" and so the make target is satisfied with ../builder being present, so it doesn't go to get the YUI Builder already. Try re-naming your CWD to something other than "builder" and do `make` again.

Revision history for this message
Martin Albisetti (beuno) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2011-08-24 22:45:23 +0000
4@@ -0,0 +1,1 @@
5+build/*
6
7=== added file 'Makefile'
8--- Makefile 1970-01-01 00:00:00 +0000
9+++ Makefile 2011-08-24 22:45:23 +0000
10@@ -0,0 +1,20 @@
11+all: phazr-overlay phazr-editable phazr-formplugin
12+
13+../builder:
14+ cd ..; git clone git://github.com/yui/builder.git
15+builder: ../builder
16+
17+phazr-overlay: src/phazroverlay/build.properties src/phazroverlay/js/overlay.js builder
18+ cd src/phazroverlay; ant build
19+
20+phazr-editable: src/editableplugin/build.properties src/editableplugin/js/editable.js builder
21+ cd src/editableplugin; ant build
22+
23+phazr-formplugin: src/formplugin/build.properties src/formplugin/js/form.js builder
24+ cd src/formplugin; ant build
25+
26+clean:
27+ rm -rf build/*
28+
29+dist-clean: clean
30+ rm -rf ../builder
31
32=== added directory 'build'
33=== added directory 'src/editableplugin'
34=== added file 'src/editableplugin/build.properties'
35--- src/editableplugin/build.properties 1970-01-01 00:00:00 +0000
36+++ src/editableplugin/build.properties 2011-08-24 22:45:23 +0000
37@@ -0,0 +1,5 @@
38+builddir=../../../builder/componentbuild
39+component=phazr-editable
40+component.jsfiles=editable.js
41+component.requires=base-build, node, plugin
42+component.builddir=../../build
43
44=== added file 'src/editableplugin/build.xml'
45--- src/editableplugin/build.xml 1970-01-01 00:00:00 +0000
46+++ src/editableplugin/build.xml 2011-08-24 22:45:23 +0000
47@@ -0,0 +1,7 @@
48+<?xml version="1.0" encoding="UTF-8"?>
49+
50+<project name="Editable Plugin" default="local">
51+ <description>Phazr Editable Node Plugin</description>
52+ <property file="build.properties" />
53+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Target" />
54+</project>
55
56=== added directory 'src/editableplugin/js'
57=== renamed file 'src/js/editableplugin/editableplugin.js' => 'src/editableplugin/js/editable.js'
58--- src/js/editableplugin/editableplugin.js 2011-06-05 20:51:35 +0000
59+++ src/editableplugin/js/editable.js 2011-08-24 22:45:23 +0000
60@@ -1,88 +1,80 @@
61-YUI.add('phazr-editable', function(Y) {
62-
63- Y.Editable = Y.Base.create('editable', Y.Plugin.Base, [], {
64- initializer: function(config) {
65- var host = this.get('host');
66- host.addClass('editable');
67- host.on('click', Y.bind(this.edit, this));
68- },
69- cancel: function() {
70- var editor = this.get('editor'),
71- host = this.get('host');
72- editor.hide();
73- host.show();
74- },
75- edit: function(e) {
76- e.preventDefault();
77- var host = this.get('host');
78- multiline = this.get('multiline'),
79- text = Y.Lang.trim(host.get('text')),
80- editor = this.get('editor');
81-
82- if (editor === null) {
83- var parentNode = host.get('parentNode'),
84- editor = Y.Node.create('<div></div>'),
85- controlTemplate = multiline ? '<div></div>' : '<span></span>',
86- controls = Y.Node.create(controlTemplate),
87- save = Y.Node.create(this.get('saveTemplate')),
88- cancel = Y.Node.create(this.get('cancelTemplate')),
89- textbox = null;
90-
91- if (multiline) {
92- textbox = Y.Node.create('<textarea></textarea>');
93- } else {
94- textbox = Y.Node.create('<input type="text" />');
95- }
96-
97- save.on('click', this.save, this);
98- cancel.on('click', this.cancel, this);
99-
100- controls.appendChild(save);
101- controls.appendChild(cancel);
102- editor.appendChild(textbox);
103- editor.appendChild(controls);
104- editor.hide();
105-
106- textbox.on('keyup', this._handleKeyPress, this);
107- parentNode.insert(editor, host);
108- this.set('editor', editor);
109- }
110-
111- editor.get('firstChild').set('value', text);
112- editor.show();
113- host.hide();
114- },
115- save: function() {
116- var editor = this.get('editor'),
117- host = this.get('host'),
118- save = this.get('saveFn'),
119- value = editor.get('firstChild').get('value');
120- if (save !== null) { save(value); }
121- host.setContent(value);
122- editor.hide();
123- host.show();
124- },
125- _handleKeyPress: function(e) {
126- if (e.keyCode) {
127- if (e.keyCode === 27) { this.cancel(); }
128- if (e.keyCode === 13 && this.get('multiline') === false) {
129- this.save();
130- }
131- }
132- }
133- }, {
134- ATTRS: {
135- cancelTemplate: { value: '<button class="phazr-button phazr-cancel">Cancel</button>' },
136- editor: { value: null },
137- multiline: { value: false },
138- saveFn: { value: null },
139- saveTemplate: { value: '<button class="phazr-button phazr-save">Save</button>' }
140- },
141- NS: 'editable'
142- });
143-
144-}, '1.0', { requires: [
145- 'base',
146- 'node',
147- 'plugin',
148-]});
149+Y.Editable = Y.Base.create('editable', Y.Plugin.Base, [], {
150+ initializer: function(config) {
151+ var host = this.get('host');
152+ host.addClass('editable');
153+ host.on('click', Y.bind(this.edit, this));
154+ },
155+ cancel: function() {
156+ var editor = this.get('editor'),
157+ host = this.get('host');
158+ editor.hide();
159+ host.show();
160+ },
161+ edit: function(e) {
162+ e.preventDefault();
163+ var host = this.get('host');
164+ multiline = this.get('multiline'),
165+ text = Y.Lang.trim(host.get('text')),
166+ editor = this.get('editor');
167+
168+ if (editor === null) {
169+ var parentNode = host.get('parentNode'),
170+ editor = Y.Node.create('<div></div>'),
171+ controlTemplate = multiline ? '<div></div>' : '<span></span>',
172+ controls = Y.Node.create(controlTemplate),
173+ save = Y.Node.create(this.get('saveTemplate')),
174+ cancel = Y.Node.create(this.get('cancelTemplate')),
175+ textbox = null;
176+
177+ if (multiline) {
178+ textbox = Y.Node.create('<textarea></textarea>');
179+ } else {
180+ textbox = Y.Node.create('<input type="text" />');
181+ }
182+
183+ save.on('click', this.save, this);
184+ cancel.on('click', this.cancel, this);
185+
186+ controls.appendChild(save);
187+ controls.appendChild(cancel);
188+ editor.appendChild(textbox);
189+ editor.appendChild(controls);
190+ editor.hide();
191+
192+ textbox.on('keyup', this._handleKeyPress, this);
193+ parentNode.insert(editor, host);
194+ this.set('editor', editor);
195+ }
196+
197+ editor.get('firstChild').set('value', text);
198+ editor.show();
199+ host.hide();
200+ },
201+ save: function() {
202+ var editor = this.get('editor'),
203+ host = this.get('host'),
204+ save = this.get('saveFn'),
205+ value = editor.get('firstChild').get('value');
206+ if (save !== null) { save(value); }
207+ host.setContent(value);
208+ editor.hide();
209+ host.show();
210+ },
211+ _handleKeyPress: function(e) {
212+ if (e.keyCode) {
213+ if (e.keyCode === 27) { this.cancel(); }
214+ if (e.keyCode === 13 && this.get('multiline') === false) {
215+ this.save();
216+ }
217+ }
218+ }
219+}, {
220+ ATTRS: {
221+ cancelTemplate: { value: '<button class="phazr-button phazr-cancel">Cancel</button>' },
222+ editor: { value: null },
223+ multiline: { value: false },
224+ saveFn: { value: null },
225+ saveTemplate: { value: '<button class="phazr-button phazr-save">Save</button>' }
226+ },
227+ NS: 'editable'
228+});
229
230=== added directory 'src/formplugin'
231=== added file 'src/formplugin/build.properties'
232--- src/formplugin/build.properties 1970-01-01 00:00:00 +0000
233+++ src/formplugin/build.properties 2011-08-24 22:45:23 +0000
234@@ -0,0 +1,5 @@
235+builddir=../../../builder/componentbuild
236+component=phazr-formplugin
237+component.jsfiles=form.js
238+component.requires=base-build, node, plugin
239+component.builddir=../../build
240
241=== added file 'src/formplugin/build.xml'
242--- src/formplugin/build.xml 1970-01-01 00:00:00 +0000
243+++ src/formplugin/build.xml 2011-08-24 22:45:23 +0000
244@@ -0,0 +1,7 @@
245+<?xml version="1.0" encoding="UTF-8"?>
246+
247+<project name="Form Plugin" default="local">
248+ <description>Phazr Form Plugin</description>
249+ <property file="build.properties" />
250+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Target" />
251+</project>
252
253=== added directory 'src/formplugin/js'
254=== renamed file 'src/js/formplugin/formplugin.js' => 'src/formplugin/js/form.js'
255--- src/js/formplugin/formplugin.js 2011-06-05 20:54:11 +0000
256+++ src/formplugin/js/form.js 2011-08-24 22:45:23 +0000
257@@ -1,81 +1,74 @@
258-YUI.add('phazr-formplugin', function(Y) {
259-
260- var FormPlugin = Y.Base.create('formplugin', Y.Plugin.Base, [], {
261- initializer: function(config) {
262- var host = this.get('host');
263-
264- if (config.submitFn) {
265- this.set('submitFn', config.submitFn);
266- }
267-
268- this.afterHostMethod('renderUI', this.renderUI);
269- this.afterHostMethod('bindUI', this.bindUI);
270- },
271- renderUI: function() {
272- var host = this.get('host'),
273- saveButton = this.get('saveButton'),
274- cancelButton = this.get('cancelButton'),
275- controls = Y.Node.create('<div></div>');
276- controls.addClass(host.getClassName() + '-controls');
277- controls.appendChild(saveButton);
278- controls.appendChild(cancelButton);
279- host.get('contentBox').appendChild(controls);
280- },
281- bindUI: function() {
282- var host = this.get('host');
283- footer = host.get('boundingBox').one('.yui3-widget-ft');
284- this.get('saveButton').on('click', this.get('submitFn'), this.get('host'));
285- this.get('cancelButton').on('click', this.close, this);
286- },
287- close: function(e) {
288- e.preventDefault();
289- this.get('host').hide();
290- },
291- loadForm: function(form) {
292- var host = this.get('host'),
293- form_node = Y.Node.create(form);
294- host.set('bodyContent', form_node);
295- this.set('form', form_node);
296- },
297- loadFormFromURL: function(url) {
298- var host = this.get('host');
299- Y.io(url, {
300- on: {
301- success: function(id, response) {
302- host.loadForm(response.responseText);
303- }
304- }
305- });
306- }
307- }, {
308- ATTRS: {
309- cancelButton: {
310- valueFn: function() {
311- return Y.Node.create(this.get('cancelTemplate'));
312- }
313- },
314- cancelTemplate: {
315- value: '<button class="phazr-button phazr-cancel">Cancel</button>'
316- },
317- form: {},
318- saveButton: {
319- valueFn: function() {
320- return Y.Node.create(this.get('saveTemplate'));
321- }
322- },
323- saveTemplate: {
324- value: '<button class="phazr-button phazr-save">Save</button>'
325- },
326- submitFn: {
327- defaultFn: function() {
328- return function() {};
329- }
330- }
331- },
332- NS: 'form'
333- });
334- Y.FormPlugin = FormPlugin;
335-
336-}, '0.1', {requires: [
337- 'base', 'node', 'plugin'
338-]});
339+Y.FormPlugin = Y.Base.create('formplugin', Y.Plugin.Base, [], {
340+ initializer: function(config) {
341+ var host = this.get('host');
342+
343+ if (config.submitFn) {
344+ this.set('submitFn', config.submitFn);
345+ }
346+
347+ this.afterHostMethod('renderUI', this.renderUI);
348+ this.afterHostMethod('bindUI', this.bindUI);
349+ },
350+ renderUI: function() {
351+ var host = this.get('host'),
352+ saveButton = this.get('saveButton'),
353+ cancelButton = this.get('cancelButton'),
354+ controls = Y.Node.create('<div></div>');
355+ controls.addClass(host.getClassName() + '-controls');
356+ controls.appendChild(saveButton);
357+ controls.appendChild(cancelButton);
358+ host.get('contentBox').appendChild(controls);
359+ },
360+ bindUI: function() {
361+ var host = this.get('host');
362+ footer = host.get('boundingBox').one('.yui3-widget-ft');
363+ this.get('saveButton').on('click', this.get('submitFn'), this.get('host'));
364+ this.get('cancelButton').on('click', this.close, this);
365+ },
366+ close: function(e) {
367+ e.preventDefault();
368+ this.get('host').hide();
369+ },
370+ loadForm: function(form) {
371+ var host = this.get('host'),
372+ form_node = Y.Node.create(form);
373+ host.set('bodyContent', form_node);
374+ this.set('form', form_node);
375+ },
376+ loadFormFromURL: function(url) {
377+ var host = this.get('host');
378+ Y.io(url, {
379+ on: {
380+ success: function(id, response) {
381+ host.loadForm(response.responseText);
382+ }
383+ }
384+ });
385+ }
386+}, {
387+ ATTRS: {
388+ cancelButton: {
389+ valueFn: function() {
390+ return Y.Node.create(this.get('cancelTemplate'));
391+ }
392+ },
393+ cancelTemplate: {
394+ value: '<button class="phazr-button phazr-cancel">Cancel</button>'
395+ },
396+ form: {},
397+ saveButton: {
398+ valueFn: function() {
399+ return Y.Node.create(this.get('saveTemplate'));
400+ }
401+ },
402+ saveTemplate: {
403+ value: '<button class="phazr-button phazr-save">Save</button>'
404+ },
405+ submitFn: {
406+ defaultFn: function() {
407+ return function() {};
408+ }
409+ }
410+ },
411+ NS: 'form'
412+});
413
414=== removed directory 'src/js'
415=== removed directory 'src/js/editableplugin'
416=== removed directory 'src/js/formplugin'
417=== removed directory 'src/js/phazroverlay'
418=== added directory 'src/phazroverlay'
419=== added file 'src/phazroverlay/build.properties'
420--- src/phazroverlay/build.properties 1970-01-01 00:00:00 +0000
421+++ src/phazroverlay/build.properties 2011-08-24 22:45:23 +0000
422@@ -0,0 +1,5 @@
423+builddir=../../../builder/componentbuild
424+component=phazr-overlay
425+component.jsfiles=overlay.js
426+component.requires=base-build, dd-delegate, node, overlay, plugin, substitute
427+component.builddir=../../build
428
429=== added file 'src/phazroverlay/build.xml'
430--- src/phazroverlay/build.xml 1970-01-01 00:00:00 +0000
431+++ src/phazroverlay/build.xml 2011-08-24 22:45:23 +0000
432@@ -0,0 +1,7 @@
433+<?xml version="1.0" encoding="UTF-8"?>
434+
435+<project name="Phazr Overlay" default="local">
436+ <description>Phazr Overlay</description>
437+ <property file="build.properties" />
438+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Target" />
439+</project>
440
441=== added directory 'src/phazroverlay/js'
442=== renamed file 'src/js/phazroverlay/phazroverlay.js' => 'src/phazroverlay/js/overlay.js'
443--- src/js/phazroverlay/phazroverlay.js 2011-07-01 19:37:31 +0000
444+++ src/phazroverlay/js/overlay.js 2011-08-24 22:45:23 +0000
445@@ -1,83 +1,72 @@
446-YUI.add('phazr-overlay', function(Y) {
447+var ModalOverlay = function(config) {
448+ Y.Do.after(this.afterRenderUI, this, 'renderUI');
449+ Y.Do.after(this.afterBindUI, this, 'bindUI');
450+};
451+ModalOverlay.ATTRS = {
452+ closeButton: { value: null },
453+ dragDelegate: { value: null }
454+};
455+ModalOverlay.prototype = {
456+ afterRenderUI: function() {
457+ var template = '<div class="{containerClassName}"><a class="{linkClassName}"></a></div>',
458+ className = this.getClassName(),
459+ context = {
460+ containerClassName: className + '-close',
461+ linkClassName: className + '-close-button'
462+ },
463+ closeContainer = Y.Node.create(
464+ Y.substitute(template, context));
465+ this.get('contentBox').prepend(closeContainer);
466+ this.set('closeButton',
467+ closeContainer.one('.' + className + '-close-button'));
468+ },
469+ afterBindUI: function() {
470+ this.after('renderedChange', this.afterRenderedChange, this);
471+ this.after('visibleChange', this.afterVisibleChange, this);
472+ this.get('closeButton').on('click', this.hide, this);
473+ Y.on('keyup', function(e) {
474+ if (e.keyCode == 27) {
475+ this.hide();
476+ }
477+ }, window, this);
478
479- var ModalOverlay = function(config) {
480- Y.Do.after(this.afterRenderUI, this, 'renderUI');
481- Y.Do.after(this.afterBindUI, this, 'bindUI');
482- };
483- ModalOverlay.ATTRS = {
484- closeButton: { value: null },
485- dragDelegate: { value: null }
486- };
487- ModalOverlay.prototype = {
488- afterRenderUI: function() {
489- var template = '<div class="{containerClassName}"><a class="{linkClassName}"></a></div>',
490- className = this.getClassName(),
491- context = {
492- containerClassName: className + '-close',
493- linkClassName: className + '-close-button'
494- },
495- closeContainer = Y.Node.create(
496- Y.substitute(template, context));
497- this.get('contentBox').prepend(closeContainer);
498- this.set('closeButton',
499- closeContainer.one('.' + className + '-close-button'));
500- },
501- afterBindUI: function() {
502- this.after('renderedChange', this.afterRenderedChange, this);
503- this.after('visibleChange', this.afterVisibleChange, this);
504- this.get('closeButton').on('click', this.hide, this);
505- Y.on('keyup', function(e) {
506- if (e.keyCode == 27) {
507+ var box = this.get('boundingBox'),
508+ className = this.getClassName(),
509+ header = box.one('.' + className + '-hd'),
510+ dd = new Y.DD.Drag({
511+ node: box,
512+ handle: header
513+ });
514+ this.set('dragDelegate', dd);
515+ },
516+ afterRenderedChange: function(e) {
517+ if (e.newVal === false) { return; }
518+ if (this.get('visible') === true) {
519+ this.attachModalOutside();
520+ }
521+ },
522+ afterVisibleChange: function(e) {
523+ if (e.newVal === true) {
524+ this.attachModalOutside();
525+ } else {
526+ this.detachModalOutside();
527+ }
528+ },
529+ attachModalOutside: function() {
530+ var box = this.get('boundingBox');
531+ Y.one("html").on("modaloutside|click",
532+ function(e) {
533+ var targ = e.target;
534+ if (!box.contains(targ)) {
535 this.hide();
536+ Y.detach("modaloutside|click");
537 }
538- }, window, this);
539-
540- var box = this.get('boundingBox'),
541- className = this.getClassName(),
542- header = box.one('.' + className + '-hd'),
543- dd = new Y.DD.Drag({
544- node: box,
545- handle: header
546- });
547- this.set('dragDelegate', dd);
548- },
549- afterRenderedChange: function(e) {
550- if (e.newVal === false) { return; }
551- if (this.get('visible') === true) {
552- this.attachModalOutside();
553- }
554- },
555- afterVisibleChange: function(e) {
556- if (e.newVal === true) {
557- this.attachModalOutside();
558- } else {
559- this.detachModalOutside();
560- }
561- },
562- attachModalOutside: function() {
563- var box = this.get('boundingBox');
564- Y.one("html").on("modaloutside|click",
565- function(e) {
566- var targ = e.target;
567- if (!box.contains(targ)) {
568- this.hide();
569- Y.detach("modaloutside|click");
570- }
571- },
572- this);
573- },
574- detachModalOutside: function() {
575- Y.one("html").detach("modaloutside|click");
576- }
577- };
578-
579- Y.PhazrOverlay = Y.Base.create('overlay', Y.Overlay, [ModalOverlay]);
580-
581-}, '1.0', { requires: [
582- 'base',
583- 'dd-delegate',
584- 'node',
585- 'overlay',
586- 'plugin',
587- 'substitute'
588-]});
589+ },
590+ this);
591+ },
592+ detachModalOutside: function() {
593+ Y.one("html").detach("modaloutside|click");
594+ }
595+};
596+
597+Y.PhazrOverlay = Y.Base.create('overlay', Y.Overlay, [ModalOverlay]);

Subscribers

People subscribed via source and target branches

to all changes: