» tagged pages
» logout

sorted by: recent | see : popular
Content Tagged with Prototype + Rails

Heroku: Web based Rails Hosting

Heroku is a new YCombinator startup that joins the growing number of "use your browser to build your apps" type of applications.

You can create new Rails applications, and they are magically hosted up in the cloud. You can import your own Rails application, or you can use the inline editor and tools to built the application directly in the browser.

Heroku itself is a Rails application. I wonder if they now self hosting :)

Being able to quickly build an application and have it running live is great (using Amazon EC2), and this is just the beginning. They already tie into the usual tools like Rake, but there is room to go further and have nice DB utilities, cloning of functionality, and much more.

The editor itself could use a bunch of work too. I can never see where the cursor is, let alone have all of the Textmate / Aptana / IntelliJ goodness.

Heroku

Ajax: Ajaxian

Felix's Blog: Prototype, Ajax, Firefox, Caching

Rails, Prototype and Firefox seem to not work entirely smoothly when it comes to cache-control... setting the headers["Cache-Control"] = "no-store" fixes this issue. Felix has the full scoop though...

Firefox: del.icio.us/tag/firefox

mootools - home

mootools, a super lightweight web2.0 javascript framework

mootools: del.icio.us/tag/mootools

[Rails-spinoffs] Stumped with some JSON

<sep/>javascript engine ... just stops executing. Any alerts etc after the line where I try to eval the json never happen, and the debugger is not

json: del.icio.us/tag/json

spotstory " Using Ruby-generated JSON with Prototype.js

An older example that's based on Rails 1.1.6, but possibly helpful

json: del.icio.us/tag/json

Automating JSON evaluation in Rails

How to set the X-JSON content header to allow automatic eval of JSON content in prototype 1.5.0

json: del.icio.us/tag/json

Uncluttr: A cleaner Amazon

Derek Gaw gave an ignite talk tonight onAIR which showed off his Uncluttr project.

Derek works for Amazon, but this is outside of his company work. He is frustrated seeing 1.5MB of content being downloaded when you login, find a book, and then view the detail page. That is too much.

Uncluttr uses the Amazon Web Services and is written with Prototype and Rails.

Uncluttr

Ajax: Ajaxian

CalendarDateSelect - Ruby on Rails Date / Datetime calendar picker

CalendarDateSelect is a prototype.js based datepicker capable of picking a Date and a Date/Time. It’s fully integrated with Rails, and is pleasantly easy to start using (install the plugin, restart the server, add <%= calendar_date_select_includes%> , and you’re ready to go! It’s light weight so you’re applications will load faster.

Project Home Page

Also, integration with ActiveScaffold has been released.

Which Open Source AJAX Framework is Right for You?

An introductory article guides readers of how to pick an AJAX framework.

Dojo: del.icio.us tag dojo

Which Open Source AJAX Framework is Right for You?

An introductory article guides readers of how to pick an AJAX framework.

DWR: del.icio.us/tag/dwr

:: GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS :: Jester: JavaScriptian REST

:: GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS :: Jester: JavaScriptian REST

XML: del.icio.us/tag/xml

37 Signals Highrise Released

37 Signals has released Highrise, a "shared contact manager and task list". Basecamp is about projects. Highrise is about people.

There is a healthy amount of Ajax used, but not in a flashy way. You will find a lot of inline editing, and sections expanding and contracting allowing you to get a lot of work done in a small area (as apposed to bouncing between pages).

All in all it looks very much like other 37 Signals products, and there are some subtle differences. I noticed that they are getting CSS/JavaScript from different subdomains now.

In the past you would see "/javascript/application.js" whereas now you see "http://asset1.highrisehq.com/stylesheets/print/application.css?1174401102" so I wonder if the architecture is slightly changed, and what their reason was for making this explicit.

You will see an "Add Person" button all over. Clicking on that has the page getting taken over with a form to add your buddy (and doesn't take you to the /person/create page). It doesn't appear that the back button has been hacked here, so if you hit back expecting to go to the page before you clicked on add person, you will go back a page.

The only slightly disappointment was how the free account is really bare bones. You don't get any of the cool features such as cases, and 25 contacts is pretty meaningless. I also noticed that when you signup the order of accounts had flipped. Subtle. Of course, I do not blame them for trying to sell accounts and make money. All power to them.

They are creating a nice portfolio of products. I am interested to see if they will integrate more (they do a good job with integrating writeboard / basecamp / chats) both within their own product line, and even more so with email (they do a good job at letting you email the system).

Finally, I see a large whole out there. I want a contacts/address book service that lives up in the cloud, that I can use an API to talk too. I don't want to type in my contacts more than once. On the Mac my apps share the address book, and I want the same on the web.

Highrise

Ajax: Ajaxian

Web-O-Random: Random Website Viewer

.

It must be Friday. Web-O-Random is a new website I created to spend hours exploring random websites the Ajax way ;). A list of URLs is fetched from the server, placed into an animated carousel/slider component, and you can then navigate through the carousel to preview the websites.

Technologies:

  • Server is Rails-based, accessing URLs from the Open Directory Project (as Active Records). Uses the Prototype Carousel component by Sebastien Gruhier, in turn based on Yahoo!'s carousel Scriptaculous is used for some effects.
  • URLs are fetched via JSON calls.
  • As with WebWait, site is loaded into an IFrame with event handler to determine when it's been loaded (in Firefox).

More info in this blog post and the FAQ.


Ajax: Ajaxian

ResizingTextArea Prototype Component

Richard McMahon has wrapped the oft-seen resizable text areas in a simple Prototype component ResizingTextArea:

JavaScript

JAVASCRIPT:
  1.  
  2. var ResizingTextArea = Class.create();
  3.  
  4. ResizingTextArea.prototype = {
  5.     defaultRows: 1,
  6.  
  7.     initialize: function(field)
  8.     {
  9.         this.defaultRows = Math.max(field.rows, 1);
  10.         this.resizeNeeded = this.resizeNeeded.bindAsEventListener(this);
  11.         Event.observe(field, "click", this.resizeNeeded);
  12.         Event.observe(field, "keyup", this.resizeNeeded);
  13.     },
  14.  
  15.     resizeNeeded: function(event)
  16.     {
  17.         var t = Event.element(event);
  18.         var lines = t.value.split('\n');
  19.         var newRows = lines.length + 1;
  20.         var oldRows = t.rows;
  21.         for (var i = 0; i <lines.length; i++)
  22.         {
  23.             var line = lines[i];
  24.             if (line.length>= t.cols) newRows += Math.floor(line.length / t.cols);
  25.         }
  26.         if (newRows> t.rows) t.rows = newRows;
  27.         if (newRows <t.rows) t.rows = Math.max(this.defaultRows, newRows);
  28.     }
  29. }
  30.  

UJS Rule

HTML:
  1.  
  2. <% apply_behaviour "textarea", "new ResizingTextArea(this);" %>
  3.  

It responds to keystrokes by parsing the text value into lines, accounts for a bit of line wrapping, and ensures that the number of rows presented grows (and shrinks) to match what has been typed in. The solution is best suited where the text entry is likely to be in the 0-50 line range.

Ajax: Ajaxian

Prototype docs - Developer Notes Updated, O’Reilly Resources

Apparently Santa was listening to my request for more docs in this last post: Sergio Pereira has updated his outstanding developer notes for Prototype to cover 1.5rc2.

Scott Raymond and Sergio also worked together to create the Prototype Quick Reference, a PDF that expands on Sergio's web site. The PDF will also be updated to cover 1.5 final, whenever that happens. There is also Ajax on Rails, written by Scott with Prototype-specific info contributed by Sergio. It also covers Scriptactulous and of RJS and other Rails specific methods for developing ajax.

Does anyone have any reviews of either they could link up or contribute?

Ajax: Ajaxian

A Flurry of Prototype Updates

With so much discussion happening recently about the state of Prototype, it’s great to see some updates finally rolling in. Hopefully this is only the beginning of what’s to come.

Here is the changelog as of around 7:00 CST:

  • Make destructive Element, Form, and Form.Element methods return their first argument, so that multiple calls can be chained together. [sam]

    ex. $(“sidebar”).addClassName(“selected”).show();

    The following methods now return their first argument: Element.toggle, Element.hide, Element.show, Element.remove, Element.update, Element.replace, Element.addClassName, Element.removeClassName, Element.observe, Element.stopObserving, Element.cleanWhitespace, Element.scrollTo, Element.setStyle, Element.makePositioned, Element.undoPositioned, Element.makeClipping, Element.undoClipping, Form.reset, Form.disable, Form.enable, Form.focusFirstElement, Form.Element.focus, Form.Element.select, Form.Element.clear, Form.Element.activate, Form.Element.disable, Form.Element.enable.

  • For consistency, Element.toggle, Element.show, and Element.hide no longer take an arbitrary number of arguments. [sam]

    !! BACKWARDS COMPATIBILITY CHANGE !!

    If you have code that looks like this: Element.show(‘page’, ‘sidebar’, ‘content’); You need to replace it with code like this: [‘page’, ‘sidebar’, ‘content’].each(Element.show);

  • Mix in Form and Form.Element methods to forms and form field elements with $() and $$(). Closes #4448. [Dan Webb, sam]
  • Add Object.clone [sam]
  • Add Form.Element.disable and Form.Element.enable. Closes #4943. [jan@prima.de]
  • Field is now simply an alias for Form.Element. [sam]
  • Add Element.Methods.getElementsByClassName and Element.Methods.getElementsBySelector. Closes #4669. [Andrew Dupont, DHH, sam]
  • Avoid race condition when stopping an Ajax.PeriodicalUpdater. Closes #4809. [e98cuenc@gmail.com]
  • Improve support for synchronous requests. Closes #5916. [sam, jthrom@gmail.com]
  • Add serialization and observation support for input type=search. Closes #4096. [rpnielsen@gmail.com]
  • Properly decode query components in String.prototype.toQueryParams. Closes #3487. [sam]
  • Add Array.prototype.reduce [sam]:

    • [1, 2].reduce() // [1, 2]
    • [1].reduce() // 1
    • [].reduce() // undefined
  • Add Object.keys and Object.values [sam]

  • Simulate non-GET/POST requests by POSTing with a _method parameter set to the actual verb [DHH]
  • Make Element.update() handle TABLE-related elements with the DOM API because of IE’s missing .innerHTML property on them [Thomas Fuchs, thx to Rick Olson]
  • Sync to script.aculo.us unittest.js library as of 2006/08/29 [Thomas Fuchs]
  • Add additional unit tests to test/unit/dom.html for testing Element.update and $().update in various enviroments [Thomas Fuchs]
  • Prevent possible exceptions on unloading the page in IE [Thomas Fuchs]

Object.keys and Object.values

New to Prototype is Object.keys and Object.values. There are a couple things to be aware of however. These methods won’t work on Prototype classes the way you might expect. So for instance, this will not work:


   var Foo = Class.create();
  Foo.prototype = {
    intialize: function(str) {
      console.log(str);
    },

    bar: function(str) {
      console.log(str);
    }
  }

  console.log(Object.keys(Foo));
  // ["prototype","bind","bindAsEventListener"]

The reason for this is that Foo is a Function and you’ll get the keys for the Function object. A relatively easy work around for this is ask for the keys on Foos prototype object:

console.log(Object.keys(Foo.prototype)); //["intialize","bar"]

Of course, you don’t get the class methods with this so you can use something like this. Not a particularly useful class, but you get the idea:


  var Inspector = Class.create();
  Inspector.prototype = {
    initialize: function(obj) {
      var instanceMethods = Object.keys(obj.prototype);
      var classMethods = Object.keys(obj).reject(function(method) {
        return ['bind', 'bindAsEventListener', 'prototype'].include(method);
      });
      console.log(instanceMethods, classMethods);
    }
  }

Form and Form.Element methods mixed in to $ and $$

This is great and well help put an end to some of those very verbose Form operations. Now you can do stuff like:


  <form action="/search" id="searchform">
    <input type="text" value="this is text" name="q" id="search" />
    <input type="submit" value="submit">
  </form>

  //Javascript
  console.log($('searchform').getElements());
  //  [<input type="text" id="search" name="q" value="this is text">,<input type="submit" value="submit">]

Shorter syntax for Event Observing

Dan Webb’s very old patch for event observing went in. This means we can now do:

$('element').observe('click', function(e) {  alert(e); });

Full support for chainability

All the methods listed in the CHANGELOG overview above now return their first argument.


  $('sweet').observe('click', function(e) {
    console.log("%s was clicked", Event.element(e));
  }).setStyle({color: 'red'});

This is just a quick overview of what is going into Prototype as we speak. It seems Sam is on the move today and there is a flurry of activity so we’ll likely see more before the day is over with. I’ll try to update this post as soon as I learn more.

Typo: Encytemedia

Low Pro - Unobtrusive Scripting for Prototype

We've covered the very cool UJS (Unobtrusive Javascript) plugin for Rails previously. Now the creators have extracted the javascript pieces to allow easy unobtrusive scripting with prototype and released it as Low Pro (download here). Low Pro features code from folks like Dean Edwards and Justin Palmer, among others. Its compatible with Prototype 1.5 and adds or enhances functionality without breaking backwards compatibility.

The library adds the following:

  • handy DOM navigation functions to elements - ex:

    $('widget').nextElement();    $('converge').replace(element)
  • a prototype friendly version of DOM Builder
  • replaces Event.observe and Event.stopObserving with Dean Edwards addEvent and removeEvent routines.
  • Declarative behaviors via Event.addBehavior(), including an OO approach where you create Behavior "classes" which can then be attached to elements.
  • Optional usage of Sylvian Zimmer's $$ optimization

All in all it looks like a great add on to prototype - my only wish is that some of this stuff looks like it should be in the main code base, and not a third party add-on!

Ajax: Ajaxian

Prototype Windows and Ajax Scaffold Dreams

I started writing a blog article on how to integrate the cool prototype windows and ajax_scaffold, half way through I got bored of writing it and just decided to upload my mutated version of it.

You need to manually install the prototype window javascript. Any one with basic rails knowledge should be able to do this.

Its just a quick hack by the way..

ajax_scaffold_generator-3.1.5+prototype_windows.zip

Rails: Hyperion Reactor - RubyOnRails

Code Snippets: Store, sort and share source code, with tag goodness

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

opensource: del.icio.us tag/opensource