Integrating Devise with Backbone.js

in backbone.js, devise, Javascript, jquery, ruby on rails

For the impatient: view the code, or see the demo.

Backbone.js UI implementation for Devise, Ruby on Rails authentication

Several weeks ago I set out to create a single page web app leveraging Backbone.js on the front end with Ruby on Rails powering the back end. In the architecture for this application, Rails is essentially just a JSON API. All of the front-end magic happens with Backbone.js and related friends. Granted, Rails is doing a lot more boilerplate than just acting as an API, but the separation of the UI code and back-end code is a lot clearer in this model.

jQuery with Rails 3

in datagraph, Javascript, jquery, rails3, ruby, ruby on rails

Update: Since this article was written, the jquery-ujs project has been turned into a gem which includes a generator that streamlines this process. Instructions can be found in the README for the Github project.

One of the most talked about features in Rails 3 is its plug & play architecture with various frameworks like Datamapper in place of ActiveRecord for the ORM or jQuery for javascript. However, I've yet to see much info on how to actually do this with the javascript framework.

Fortunately, it looks like a lot of the hard work has already been done. Rails now emits HTML that is compatible with the unobtrusive approach to javascript. Meaning, instead of seeing a delete link like this:

you'll now see it written as

This makes it very easy for a javascript driver to come along, pick out and identify the relevant pieces, and attach the appropriate handlers.

So, enough blabbing. How do you get jQuery working with Rails 3? I'll try to make this short and sweet.

Structure and Interpretation of Computer Programs (SICP) for Kindle

in books, downloads, free, kindle, programming, sicp

I just started reading the SICP book (Structure and Interpretation of Computer Programs, by Abelson, Sussman, and Sussman) which MIT Press has so graciously made available on their website. I'm not very fond of sitting in front of a computer screen to read books, so I mirrored their copy locally and converted it into a prc file (using Mobipocket Creator) so I could read it on my Kindle.

Here it is for anyone else who wants to save a bit of time.

It is provided under Creative Commons Attribution-Noncommercial 3.0 Unported License.

Ubiquity Commands Updated

in drupal, firefox, Javascript, ubiquity, UI, w3c

Ubiquity 0.5 was released a few weeks ago, and I finally got around to updating my commands. If you were using my W3C or Drupal API Ubiquity commands, they are now 0.5 compatible. Please update your command source.

March Phoenix Drupal Meetup

in community, drupal, drupalphx, meetup

The March Phoenix Drupal meetup will be held next Tuesday, March 10th at 7pm. The meetup is moving on to the ASU campus thanks to the help of Chris Yates. Event details can be found on the DrupalPHX group page.

Chris will be giving a presentation about the Mars Image Explorer project and how they are utilizing Drupal within that project. There's also been mention of DrupalCon attendees sharing a bit about what went on at the conference.

Hope you all can make it.

Phoenix Metro Drupal Meetup Next Tuesday

in community, drupal, meetup, phoenix, planet

There will be a Phoenix Drupal meetup next Tuesday evening at Macayo's in Tempe. See official event details and sign up HERE. This meeting is a chance for local Drupal developers to get together and discuss what's going on in their Drupal world and Drupal in general. While we are working on a more presentation friendly meeting spot for future meetups, this will give us a chance to at least meet and gauge community interest level. Hope to see you there!

Getting Started with Exhibit using Drupal and Views (part 3)

in drupal, exhibit, Javascript, php, views

In this last episode of getting started with Exhibit and Drupal, we'll embellish the Exhibit we created in part 2 by adding some additional views, exploring the use of lenses and expressions, and adding another facet. Our final Exhibit can be seen here.

Adding Views to your Exhibit

So the first thing we'll do is add several additional views to our Exhibit. The tabular view is nice and provides some great functionality, but Exhibit provides some additional views that are great at visually enhancing the way your data is displayed. We'll start by adding a calendar view. To do this you'll need the following code pasted within your viewPanel:

<div ex:role="view"
      ex:viewClass="Calendar"
      ex:label="Calendar"
      ex:start=".field_date_value"
      ex:end=".field_date_value2"
      ex:eventLabel=".title"
      ex:formats="date { mode: short; 
                         show: date-time; 
                         template: 'MM/dd/yyyy' } 
                  item { title: expression(.title) }"></div>

Getting Started with Exhibit using Drupal and Views (part 2)

in drupal, exhibit, Javascript, php, views

Ok, now that we know a bit about Exhibit and how Drupal can help us create Exhibits, let's start by getting our Drupal data in Exhibit JSON format.

Setup

The setup I'm using for this tutorial includes a Drupal 6 installation with the following modules enabled: Exhibit, Views 2, CCK, Date, Location, and GMap. I'm only using CCK, Date, Location and GMap to create a custom Event node type with date and location fields. I've also added taxonomies to the Event node type for event type and tags. You can create your own node type and add whatever fields you would like. I'm using this setup to demonstrate the broadest possible uses of Exhibit. With this Event node type, we'll be able to create an Exhibit complete with Calendar, Timeline, Map, and Interactive Table displays. You can visit my playground here: http://d6demo.joshhuckabee.com

Create Exhibit JSON from your Views

Getting Started with Exhibit using Drupal and Views (part 1)

in drupal, exhibit, Javascript, php

In this multi-part tutorial I will show you how to create interactive Exhibit displays of you Drupal data using the Views, CCK, and Exhibit modules. I'll start with a brief overview of Exhibit and how it works, then move on to explain how to get your Drupal data in a format that Exhibit can use, and finally, I'll show you how to setup the Exhibit. If you're already familiar with how Exhibit works, you'll probably want to wait for part two of this series.

What is Exhibit?

Ubiquity - A New Direction in Web UI

in cooltools, drupal, Javascript, mozilla, ubiquity, UI, validation

Mozilla labs has released a slick new Firefox extension called Ubiquity that aims to streamline the most common tasks you do in your browser as well as make things that seemed otherwise overly difficult or complicated, much more easier. I've seen it being called everything from "Quicksilver for Firefox" to "mashups for dummies". There's plenty of buzz around the net to fill you in on the details, so I won't go into that here.

I certainly like what I see in Ubiquity. It goes way beyond what Quiksilver does (or can do) and its more thant just a "mashup". Its capabilities are virtually limitless. But, what I've liked most so far about Ubiquity is how easy it is to extend. In a matter of about an hour I saw the headline on reddit about "the future of the web browser", watched Aza's cool video, wrote two simple, trivial commands, published my commands, and watched as over a dozen different people (whom I don't know nor didn't pay) downloaded and began using those commands. That says a lot about the tool and the creators over at Mozilla labs.

Its definitely something to check out if you haven't done so already.

Oh, and about those commands. The first allows you to submit any page you're on to the W3C's markup validator. Just ubiq "validate" and hit enter. You can catch that one here.

The last command I wrote is basically a shortcut to Drupal's API. Ubiq "drupal" followed by a core function, file name, constant, global or topic, hit enter and you'll land softly on the correct Drupal API page.

Drupal API Ubiquity Command

One last thing, if you haven't heard about the IE Death March, go show your support.