Forum: Ruby on Rails [ANN] Unobtrusive Javascript for Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-06-07 00:24
I made a brief post on here the other day about this and now I can
proudly present the initial release of our unobtrusive_javascript
plugin for Rails. We'll be working with Dan Webb of Vivabit to roll in
much of the functionality in his own as-yet unreleased
unobtrusive_javascript plugin into a single plugin.

This is essentially a preview release and probably not suitable for
use on a production site just yet but we hope it will be production
ready ASAP.

So here's the important details!

The blog post:
http://www.lukeredpath.co.uk/index....ript-for-rails/

The documentation/information:
http://opensource.agileevolved.com/...usiveJavascript

The source:
http://opensource.agileevolved.com/...avascript/trunk

All comments and ideas are welcome. Enjoy!

** Apologies if this ends up here twice but gmail is acting up
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-06-07 11:27
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-06-07 15:35
(Received via mailing list)
Very very cool.
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-06-07 15:35
(Received via mailing list)
I get invalid links for those... 404 for the first, and nothing useful
for the other two.
Is it just me?
Cf17040cecb2618506f5ca4c14957957?d=identicon&s=25 Robert Dempsey (flatekmonkey)
on 2006-06-07 16:42
Hello,

I too am having a problem with this plugin. I found the
event-selectors.js file in the assets folder of the plugin and put it
into the "public/behaviours" folder which worked for it but I am getting
an error when it looks for dynamic.js in the same location. I am using
the latest version of Prototype. The exact errors I am getting (in
Firefox 1.5.0.4) is "EventSelectors is not defined." Thank you for your
help.

Sincerely,

Robert Dempsey
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-06-07 18:40
Robert Dempsey wrote:
> Hello,
>
> I too am having a problem with this plugin. I found the
> event-selectors.js file in the assets folder of the plugin and put it
> into the "public/behaviours" folder which worked for it but I am getting
> an error when it looks for dynamic.js in the same location. I am using
> the latest version of Prototype. The exact errors I am getting (in
> Firefox 1.5.0.4) is "EventSelectors is not defined." Thank you for your
> help.
>
> Sincerely,
>
> Robert Dempsey

Hi Robert - there is no need to copy anything into your public folders -
both the event-selectors.js and dynamic.js contents are rendered at
runtime by a built-in controller that comes with the plugin.

There was a bug where the controller action responsible for rendering
the contents of event-selectors.js was looking for it in the wrong
place. I fixed this earlier so please run an update and have another go.

Cheers
Luke
Cf17040cecb2618506f5ca4c14957957?d=identicon&s=25 Robert Dempsey (flatekmonkey)
on 2006-06-07 20:29
Luke,

That fixed the problem. Thank you very much for such a quick fix. Works
like a charm! I intend on using it asap. Much obliged.

- Robert Dempsey

Luke Redpath wrote:

> Hi Robert - there is no need to copy anything into your public folders -
> both the event-selectors.js and dynamic.js contents are rendered at
> runtime by a built-in controller that comes with the plugin.
>
> There was a bug where the controller action responsible for rendering
> the contents of event-selectors.js was looking for it in the wrong
> place. I fixed this earlier so please run an update and have another go.
>
> Cheers
> Luke
64df72aa2735f96f380d3efe2d54afd1?d=identicon&s=25 Gernot Kogler (gkogler)
on 2006-06-09 09:17
Hi Luke

I like the idea of this plugin very much. However, I have no luck
getting it to work. Here's what I'm trying to do:

I have a partial that renders several boxes containing some text. Each
box is in a div with a unique id like this:

<div class="entry-card" id="entry<%= entry.id.to_s %>" >
...
</div

I would like to apply some effect for a mouseover and I tried it like
this:

<% register_js_behaviour "#entry9:mouseover", visual_effect(:highlight,
"entry9", :duration => 0.5) %>

The selector is hardcoded for testing purposes and there is a div with
id "entry9" on the page. But nothing happens :-( What am I doing wrong
here ?

The prototype-scripts are installed and working, I am using effects in
my rjs-files.

Any help would be very appreciated

Best regards

Gernot
1e99128ebac5ca41c91940291d315332?d=identicon&s=25 Luke Redpath (Guest)
on 2006-06-09 12:44
Hi Gernot,

I'm not sure why it isn't working - can I advise you to try loading up
your page in Firefox using the Firebug extension? You'll be able to
select the dynamic.js file and view the javascript that has been
generated.

Once you've tried this, please submit a bug on our Trac at
http://opensource.agileevolved.com

Cheers
Luke

Gernot Kogler wrote:
> Hi Luke
>
> I like the idea of this plugin very much. However, I have no luck
> getting it to work. Here's what I'm trying to do:
>
> I have a partial that renders several boxes containing some text. Each
> box is in a div with a unique id like this:
>
> <div class="entry-card" id="entry<%= entry.id.to_s %>" >
> ...
> </div
>
> I would like to apply some effect for a mouseover and I tried it like
> this:
>
> <% register_js_behaviour "#entry9:mouseover", visual_effect(:highlight,
> "entry9", :duration => 0.5) %>
>
> The selector is hardcoded for testing purposes and there is a div with
> id "entry9" on the page. But nothing happens :-( What am I doing wrong
> here ?
>
> The prototype-scripts are installed and working, I am using effects in
> my rjs-files.
>
> Any help would be very appreciated
>
> Best regards
>
> Gernot
This topic is locked and can not be replied to.