Created
April 19, 2011 18:56
-
-
Save dpritchett/929267 to your computer and use it in GitHub Desktop.
coffeescript jobsite renderer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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