RailsCamp 2.0

0 views
Skip to first unread message

Pat Allan

unread,
Sep 3, 2007, 9:19:44 PM9/3/07
to melbour...@googlegroups.com, rails-...@googlegroups.com
Hi everyone

Just emailing to let you all know that registrations for RailsCamp
2.0 is now open. This time around, we'll be in Bacchus Marsh (just
outside of Melbourne) at Sunnystones Country Retreat, and will run
from Friday the 23rd to Monday 26th of November.

For those of you who aren't really sure what's involved at a
RailsCamp - well, the best place to start is Ben's description of the
first camp on the wiki:
http://wiki.railscamp07.org/railscamp07/
It's essentially a weekend of hacking, chatting, games (like Guitar
Hero and SET), and probably a bit of drinking too. An extended code
party, perhaps?

Anyway, the registration link is below - it's $120 per person, which
includes a bed to sleep on and food for the weekend - I highly
recommend you sign up as soon as possible (not that I'm biased at
all), as the first camp booked out, and I wouldn't be too surprised
if that happens again for this one.

http://railscamp07.eventwax.com/rails-camp-07-v20-melbourne/register

If you've got any questions, either post them to the list, or jump on
#ror_au on irc.freenode.net - unfortunately I won't be at the next
Melbourne Ruby meeting (up in Sydney for Web Directions South). Be
sure to wander around the wiki, as it might hold the answers you seek.

Cheers

--
Pat
e: p...@freelancing-gods.com || m: 0413 273 337
w: http://freelancing-gods.com || p: 03 9386 0928
discworld: http://www.ausdwcon.org || skype: patallan


Dylan Egan

unread,
Sep 3, 2007, 10:06:55 PM9/3/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
Heya Pat,

Great work. Place looks great and looks like it'll fit a lot more people.

Will be a great weekend.

Dylan.

Marcus Crafter

unread,
Sep 4, 2007, 3:46:09 AM9/4/07
to rails-...@googlegroups.com
Hi All,

Fantastic work Pat, looking forward to another awesome weekend with
everyone :)

Cheers,

Marcus

Ben Askins

unread,
Sep 4, 2007, 7:08:08 PM9/4/07
to rails-...@googlegroups.com
Hi Pat,

Thanks for organising everything. Really looking forward to seeing
everyone at camp!

cheers,
Ben
--
http://teamaskins.net

Tim Lucas

unread,
Sep 4, 2007, 9:18:43 PM9/4/07
to rails-...@googlegroups.com
ooh yeah, can't wait for v2.0...

Pat: you da man!

...and hopefully by November Rock Band will be out.

-- tim

Clifford Heath

unread,
Sep 4, 2007, 9:45:57 PM9/4/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
Unfortunately I (and Daniel, my son) will miss you all.
He's getting married that Saturday.

I'm sure you'll all have a great time - have one for me!

Clifford Heath.

Matt Allen

unread,
Sep 4, 2007, 10:39:25 PM9/4/07
to melbour...@googlegroups.com, rails-...@googlegroups.com
Props to Pat for organising RailsCamp 2.0.

I'll be in Fiji one our first family OS trip so will have to leave it up to the rest of you to geek it up in my absence. If it's anything like v1.0 you will all have a brilliant time.

Matta

Clifford Heath

unread,
Sep 4, 2007, 10:49:15 PM9/4/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
I have the following javascript helper:

def toggle_select_on_click(node_name)
javascript_tag %Q{
{
var e = $('#{node_name}');
e.selected = false;
e.onclick = function(evt) {
if (evt.detail != 1) return; /* single-click only */
if (e.selected)
Element.removeClassName(e, 'selected');
else
Element.addClassName(e, 'selected');
e.selected = !e.selected;
evt.cancelBubble = true;
}
}
}
end

... to which you pass the ID of a DOM node in a view, such as:

<li id="foo">Hello There</li>
<%= toggle_select_on_click("foo") %>

If it's applied to one item in a view, it works fine - click once and
the item shows its "selected" class style, again and it deselects.

When I apply it to multiple items in a list, a click on any item toggles
the select state of the *last* node. Here's the oddity: After the items
(and this event handler) have been refreshed in an AJAX call, they
all work independently (correctly).

Is there something different about the way the JS gets evaluated
on load versus on an AJAX replace_html? It looks like the "var e"
exists in only one instance instead of one per toggled node. What
do I need to do to get these handlers to work independently?

Clifford Heath.

Joseph Pearson

unread,
Sep 4, 2007, 10:58:23 PM9/4/07
to rails-...@googlegroups.com
The way you've got it set up, e is a global variable. So each time you call this ruby function, javascript is inserted into the document that changes the value of e as the document is being rendered.

Of itself, that's not a problem, but the fact that you are referencing e within the function means that you're accessing the global variable -- not a local one as you expect. By the time the onclick occurs, e has been set to the last node.

Since you're using an older method of event registration (onclick =), you can just replace references to 'e' in the function with references to 'this'.

There are better ways, but I think that's the simplest change that could possibly work!


- J


--
Joseph Pearson | software inventor | inventivelabs.com.au | 8415 0866

Nik Wakelin

unread,
Sep 4, 2007, 10:59:19 PM9/4/07
to rails-...@googlegroups.com
Hi Clifford,

You should have been at my presso for the Wellrailed group :) We
learnt all about this stuff.

Basically, you're setting the global variable "e" every time, so "e"
is the last element on the page (as it's all exec'd inline). Then,
when the onclick handler is executed, it uses the value of e. Does
that make sense?

What you want to do is get the element inside the helper using something like:

e = Event.target(evt);

Or! Even better, as your code is probably not cross browser compatible....

def toggle_select_on_click(node_name)
javascript_tag %Q{
{
Event.observe('#{node_name}', 'onclick', function(e) {
.... event code ....
}
}
end


--
Nik Wakelin
(027) 424 5433
munky...@gmail.com

Nik Wakelin

unread,
Sep 4, 2007, 11:06:34 PM9/4/07
to rails-...@googlegroups.com
Hmmm also, what version of Prototype are you using? As you can probably use:

e.addClassName() and e.removeClassName() rather than the clunkier
"Element." form.

Event.stop() is also more cross-browser than cancelBubble AFAIK.

You could be REALLY prototype-y and setup a class:

SelectableElement = Class.create();
SelectableElement.prototype = {

initialize : function(e) {
this.elm = $(e);
Event.observe(this.elm, 'click',
this.toggleSelectable.bindAsEventListener(this));
},

toggleSelectable() {
this.elm.toggleClassName("selected");
//and anything else you need to do here. the event is passed as the
//first param if you need it
}

}

//create an 'instance' for each selectable element
//just need to give them a classname of "selectable"
$$(".selectable").each(function(elm) {
new SelectableElement(elm);
});

But that may be waaaaaay to enterprise for you :) Especially if you're
not expecting to extend that definition later.

Cheers,

Nik

Clifford Heath

unread,
Sep 4, 2007, 11:19:43 PM9/4/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
Thanks guys. I figured that "e" was a global, but don't have enough
JS experience to spot why :-). Anyhow, I'm getting there... I got some
nice things happening before I got stuck on this :-). I'm trying to put
in-place-edit (on double-click), add/delete, click to select, and drag &
drop on the same list (hierarchy actually) of items. All but the drag/
drop
going now, thanks.

One further thing. When the inplace editor creates an <input> field,
I want it to activate on Enter (and pref tab, cursor up/down, etc).
Is it possible to do that without putting a keystroke observer on it?

On 05/09/2007, at 12:59 PM, Nik Wakelin wrote:
> You should have been at my presso for the Wellrailed group :)

That woulda been good... but it was in Sydney, right?

BTW, I Cc'd the melbourne crew on the original request, but the
responses only went to rails-oceania, in case those guys want to
see the answers.

Clifford Heath.

Clifford Heath

unread,
Sep 4, 2007, 11:21:19 PM9/4/07
to melbour...@googlegroups.com, rails-...@googlegroups.com
I think that RailsCamp 2.0 would benefit from having a better
mechanism for proposing talks - ahead of time. I waited and
waited for the blank schedule sheets to go up at 1.0, and was
elsewhere when they did. By the time I got back, the schedule
was full :-). We squeezed something in, of course. Nevertheless,
I reckon someone (Pat?) should put up a "talk proposals" page
somewhere and accept votes.

The schedule can be worked out later, and the final program
at the last minute, of course.

Clifford Heath.


Nik Wakelin

unread,
Sep 4, 2007, 11:28:29 PM9/4/07
to rails-...@googlegroups.com
Hi Clifford,

Wellrailed = Wellington Ruby on Rails User Group.

:) So a little way away from Sydney unfortunately. I'll post my slides
at some point.

I think you want to focus event from the input field, but I'm not sure
how do it without observing the event.

*subscribes to melbourne group*

Cheers,

Nik

On 9/5/07, Clifford Heath <cliffor...@gmail.com> wrote:
>

Tim Lucas

unread,
Sep 5, 2007, 12:04:17 AM9/5/07
to melbour...@googlegroups.com, rails-...@googlegroups.com

I know what you're saying Clifford, but I think it's important to
keep the proposal as an on-the-day thing. Also, there's no need to
just have one talk at a time. I know the physical space to run
sessions was limited at the first Railscamp, but you shouldn't really
run out of slots. Max ran a session alongside mine outside that IMO
worked really well!

The talks are more guided conversations than anything else, and the
need for certain talks will arise from discussions during Friday
night and during the day on Saturday and Sunday. It shouldn't be one
person wants to talk about one thing, its about a group of people
wanting to talk about something and you putting your hand up as
someone knowledgeable and intelligent to facilitate the conversation.

-- tim

Clifford Heath

unread,
Sep 5, 2007, 12:06:34 AM9/5/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
> Wellrailed = Wellington Ruby on Rails User Group.

Oh, ok. Hi! I have family in NZ, including W.

> What you want to do is get the element inside the helper using
something like:
> e = Event.target(evt);

This wouldn't work as there are several things inside the <li> that
might be
the target, but the handler must operate on the <li>.

My Event.addClassName(...) format was copied from controls.js, obviously
they haven't changed all the uses.

I have my own version of the in_place_editor helper that does this:

function = "$('#{field_id}').editor = new Ajax.InPlaceEditor("
...

This enables you to call methods on the editor from JS elsewhere on
the page,
such as doing:

javascript_tag("$('new_aspect').editor.enterEditMode();")

on rendering a node that should *start* in edit mode. I also hacked the
editor itself to make hoverColor an option (separate from
highlightColor)
and an option to activate on double-click instead of single click.
All good
fun!

BTW, the Event.observe code you offered needed a couple of things
changed:

* It should observe "click", not "onclick" :-)
* Event.stop() needs the event to be passed: Event.stop(e)

Also, the reason I didn't do $$('selectable').each(...) was because
it needs to
be redone on every AJAX replace_html, so I wanted the JS in the new
HTML.

I wound up with:

javascript_tag %Q{
Event.observe(
'#{node_name}',

'click',
function(evt) {
this.selected = !this.selected;
if (this.selected)
this.addClassName('selected');
else
this.removeClassName('selected');
Event.stop(evt);
}
);
}

Thanks for your help!

Clifford Heath.

Clifford Heath

unread,
Sep 5, 2007, 12:18:33 AM9/5/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
On 05/09/2007, at 2:04 PM, Tim Lucas wrote:
> I know what you're saying Clifford, but I think it's important to
> keep the proposal as an on-the-day thing

I'm not suggesting that there should be any limit to the number
of slots, any slots assigned ahead of the day, any limit on the
effective number of streams, or any restriction on spontaneous
talks on the day - all those freedoms are an essential part of the
format. But I think it's useful to have an idea what folk are thinking
of, would like to hear, and who else might want to talk about
similar things, etc... just to help plan your own contributions as
much as anything. Not a formal "program planning" thing at all.

Clifford Heath.

Tim Lucas

unread,
Sep 5, 2007, 12:25:37 AM9/5/07
to melbour...@googlegroups.com, rails-...@googlegroups.com
On 05/09/2007, at 2:18 PM, Clifford Heath wrote:

> ... I think it's useful to have an idea what folk are thinking


> of, would like to hear, and who else might want to talk about
> similar things, etc... just to help plan your own contributions as
> much as anything.

I reckon the Who's Coming page is perfect for this kinda stuff:
http://wiki.railscamp07.org/railscamp07/show/Who%27s+Coming

Maybe you could add a "Interested in hearing about"?

-- tim

Pat Allan

unread,
Sep 5, 2007, 12:26:32 AM9/5/07
to rails-...@googlegroups.com, melbour...@googlegroups.com
On 05/09/2007, at 2:18 PM, Clifford Heath wrote:

> But I think it's useful to have an idea what folk are thinking of

http://wiki.railscamp07.org/railscamp07/show/Who%27s+Coming - people
can put down what they're interested in discussing. (If you've signed
up but not put your name on the wiki, please do :)

> would like to hear

Yup, fair point, we'll be adding a page to the wiki for that.

> and who else might want to talk about similar things, etc

That'd be the first link again.

Cheers

--
Pat

Tim Lucas

unread,
Sep 5, 2007, 12:28:07 AM9/5/07
to Tim Lucas, melbour...@googlegroups.com, rails-...@googlegroups.com

I see Lachlan's already added a "Wants to learn" to his profile thingy.

there ya go.

-- tim

Reply all
Reply to author
Forward
0 new messages