Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at cf.Objective() 2014 (Bloomington, MN) with: Jeff McDowell

Skin Spider : Another Bell And Whistle

By Ben Nadel on

To learn all about Skin Spider, click here.

To view the most updated application, click here.

To view the current code base, click here.

Just a minor update here. I have updated the videorating.cfm ColdFusion custom tag to have a toggle for whether or not the video clip is a favorite of the user. It works pretty much the same way as the rating (1 to 10) in that it uses a Javascript Image SRC attribute to call the application's API. I have included this as part of the videorating.cfm ColdFusion custom tag because it's sort of a rating and because the tag already existed; however, I could just have easily made a separate custom tag to do just the "favorite" functionality.

If you look at the search.cfm and the favorites.cfm ColdFusion templates, you will see that the only modifications that I have made are that I now get "is_favorite" from the database and use the "isfavorite" attribute of the ColdFusion custom tag. Everything else on those pages remains the same. This is the beauty of the custom tag - it helps protect or minimize the damage that variation can have on the system.

The two major changes of this update were made to the api.cfm ColdFusion template (our system API) and to the videorating.cfm ColdFusion custom tag. If you look at api.cfm, you will see that I have added another CFCase statement for the action "set_favorite". Like the "rate_video" action, "set_favorite" also takes the ID of the video in question. It also takes a boolean indicating whether or not the video is a favorite. It then takes this information and updates the database.

If you look at the videorating.cfm ColdFusion custom tag, you will see that I just added another link that says "Favorite." This link calls the Javascript method SetVideoFavorite(). This Javascript method is defined in the custom.js file. Like I said before, this method just uses the SRC attribute of a Javascript image to ping the system's API (api.cfm). In addition to pinging the API, this method also changes the CSS class of the Favorite link. If you try out the page, you will see that this CSS class defines the format and the gold star (background-image) of the link. Not very complicated stuff here. I have decided to make the gold start part of the CSS class, rather than an inline image because this way does not require the ColdFusion custom tag to know anything about the paths to the images folder. Right now, all the ColdFusion custom tag has to know about is what attributes it gets and what Javascript methods are available. I am trying to keep the coupling as low as possible.

So now, there is an inline way to rate the video clips and flag them as favorites. I have been trying to take care of these "low hanging" fruits - the easy changes - before I move on to the final, more complicated changes of Iteration 2. Hopefully over the holidays, I will have time to start thinking about the referential navigation, the biggest of the remaining Iteration 2 changes.

Tweet This Great article by @BenNadel - Skin Spider : Another Bell And Whistle Thanks my man — you rock the party that rocks the body!


Reader Comments

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.