Kevin’s Can

Filed under

mootools

 

MooTools driver for Rails 3 helpers

 

Rails 3 beta has just been released with its many goodies. Thanks to a lot of effort from a group of people, it's now possible to use Rails helper methods to create remote forms, links, and submit buttons without being forced to use Prototype. As a result, we have the Rails concept of unobtrusive JavaScript.

Instead of using inline Prototype code and evil evaluations, the helpers now add HTML5 data-* attributes that get picked up by a JavaScript driver. The driver can use MooTools, jQuery or any other framework of your choice. You can also write your own driver, just the way you like it.

Sample case of using a remote helper in Rails 3:

This is great news as I now can start using helpers together with MooTools. I've published a MooTools driver to the MooTools Forge, check it out. The sources can be found at my GitHub repo.

Also, feel free to fork!

Download driver here

Filed under  //   javascript   mootools   rails 3  
Loading mentions Retweet

Comments [0]

Apple-like scrollable showcase

I had a good JS session yesterday, building a widget for the marketing page of our freshly launched (Estonia only, right now) app Printfolder. Inspired by the the products browser at http://www.apple.com/mac/, we decided to try with something similar, but having panes with entirely different contents instead of displaying loads of coherent items. I named the class Scrollcase (of course it's powered by MooTools >= 1.2).

Live result (at the bottom of the page): http://www.printfolder.ee/

I wanted to keep the usage quite simple by not having strict rules about how the HTML should be structured in order to use Scrollcase, so the class generates as much elements as possible. Basically, something like this should be perfectly enough (with the complementary scrollcase.css file):

The container element does have to have a width defined, as the script relies on that all children have the same width, which is calculated from the container width.

If you like it, dig deeper into the sources at GitHub.

Filed under  //   apple   javascript   mootools   scrollable   slider  
Loading mentions Retweet

Comments [0]

Element.reload() w/ MooTools

Quick snippets like this makes my day so much more enjoyable. What I like about this one especially, is that I can move the url to the html template and have it set with a route (for other rails guys).

 

Filed under  //   ajax   javascript   mootools   tip  
Loading mentions Retweet

Comments [1]