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
Great work. Place looks great and looks like it'll fit a lot more people.
Will be a great weekend.
Dylan.
Fantastic work Pat, looking forward to another awesome weekend with
everyone :)
Cheers,
Marcus
Thanks for organising everything. Really looking forward to seeing
everyone at camp!
cheers,
Ben
--
http://teamaskins.net
Pat: you da man!
...and hopefully by November Rock Band will be out.
-- tim
I'm sure you'll all have a great time - have one for me!
Clifford Heath.
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.
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
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
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.
The schedule can be worked out later, and the final program
at the last minute, of course.
Clifford Heath.
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:
>
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
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.
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.
> ... 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
> 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
I see Lachlan's already added a "Wants to learn" to his profile thingy.
there ya go.
-- tim