Skip to content

Instantly share code, notes, and snippets.

@dpritchett
Created April 19, 2011 18:56
Show Gist options
  • Save dpritchett/929267 to your computer and use it in GitHub Desktop.
Save dpritchett/929267 to your computer and use it in GitHub Desktop.
coffeescript jobsite renderer
$(document).ready ->
jobloader.initialize()
window.jobloader =
pulljobs: (callback) ->
$.getJSON '/jobs.json',
(data) ->
callback data
printjobs: (data) ->
$.each data.joblist,
(key, value) ->
$("#job_list").append(
"<li><a href=\"#{value.url}\">#{value.title}</a></li>")
initialize: ->
this.pulljobs(this.printjobs)
(function() {
$(document).ready(function() {
return jobloader.initialize();
});
window.jobloader = {
pulljobs: function(callback) {
return $.getJSON('/jobs.json', function(data) {
return callback(data);
});
},
printjobs: function(data) {
return $.each(data.joblist, function(key, value) {
return $("#job_list").append("<li><a href=\"" + value.url + "\">" + value.title + "</a></li>");
});
},
initialize: function() {
return this.pulljobs(this.printjobs);
}
};
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment