SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: What if...

  1. #1
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What if...

    ...you could produce accessible, unobtrusive javascript, using Rails built-in javascript/prototype helpers, with just one extra line of code in your layout, a plugin, and one small enhancement to the helpers. Something like this:

    PHP Code:
    <% form_remote_tag :controller => 'foo', :action => 'bar', :unobtrusive => true %>

    # which produces

    <form id="form_foo_bar" action="/foo/bar" method="post"
    But which still acts as an ajax form? You would simply handle the response for ajax and non ajax requests using Rails' responds_to function.

    In addition, what if you could attach javascript functionality to your page elements in a Behaviour-like fashion, but using pure Ruby, anywhere in your view, but loaded from an external Javascript file?

    Sorry to tease. Stay tuned, we have something very cool to show off in the next day or two.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    tease

  3. #3
    The Mind's I ® silver trophy Dark Tranquility's Avatar
    Join Date
    Sep 2003
    Location
    KSA - UAE
    Posts
    9,458
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    tease
    just be patient

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, one more tease

    PHP Code:
    # final api yet to be determined
    register_javascript_behaviour("a#some_remote_link:click""alert('Hello there!')")

    # or pure ruby using built in rails helpers
    register_javascript_behaviour("#content div.infobox_link:mouseover"visual_effect(:highlight"infobox", :duration => 1)

    # code generated in your html:



    # yes, nothing! 
    And in return you'll afford me the right to pimp my new blog which I've finally got around to getting up and running - I'll be posting more about this on there tomorrow hopefully.

    Just trying out a bit of DHH style marketing

  5. #5
    SitePoint Member Arto's Avatar
    Join Date
    Mar 2005
    Location
    Spain
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That looks interesting indeed, as I commented on your brand-new blog

  6. #6
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know what, I was being a bit dense last night - I've just moved hosts and my DNS hasn't been updated yet - I have my domain in my hosts file so I forgot. There is an actual post on my blog once the DNS has updated.

    EDIT - you can go here for now http://66.29.86.208/ if its not working for you - I've tried my site through two networks and its updated on one and not the other.

    Arto - I'm not seeing your comment on either blog (old or new host).

  7. #7
    SitePoint Member Arto's Avatar
    Join Date
    Mar 2005
    Location
    Spain
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Luke,

    It says "Your comment is awaiting moderation.", here -- I checked, and that's on the new host.

  8. #8
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah thanks for letting me know - I've turned moderation off for now.

  9. #9
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Redpath
    Ah thanks for letting me know - I've turned moderation off for now.
    Good luck with that. I get about 200-300 spam messages for every real comment that comes through on my blog
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  10. #10
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm gonna do a proper post about this later, with full instructions, but if you want to take a sneak peek in the meantime:

    Subversion:
    http://opensource.agileevolved.com/s...ive_javascript

    Pretty Source Code Browsing:
    http://opensource.agileevolved.com/t...ive_javascript

  11. #11
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That looks really cool! I hate to have to mix Javascript and HTML to use Rails' helpers.

  12. #12
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •