Started implementing entry loading in client side.

- Bug fix in ts_entry:new/1. Msspelled ``atomic``.
- Bug fix in ts_json:record_to_ejson/1. For ``ts_entry`` records, the
  Username and TimelineId elements were not being converted from atoms to list.
- Added the entry template for loaded and created entry elements.
- Added ICanHaz.js (which wraps mustache.js) and underscore.js.
- Implemented a naive version of displayEntries() in ts.js.
- Added debug alerts for error cases in ts.js.
- Styling the new entry elements.
This commit is contained in:
Jonathan Bernard
2011-03-03 17:05:30 -06:00
parent dfab257a12
commit 122a3bd1e3
16 changed files with 1336 additions and 21 deletions

View File

@ -3,12 +3,12 @@ var timelines = [];
var activeTimeline = [];
var entries = [];
var lastEntryBar;
var newEntryBar;
/* Setup after the document is ready for manipulation. */
$(document).ready(function(){
lastEntryBar = $("#last-entry");
newEntryBar = $("#new-entry");
// wire the login dialog using jQuery UI
$("#login-dialog").dialog({
@ -125,7 +125,7 @@ function loadEntries(user, timeline) {
// call the API list_entries function via AJAX
$.ajax({
url: "/ts_api/entries/" + user.username + "/" + timeline.timeline_id,
url: "/ts_api/entries/" + user.username + "/" + timeline.timeline_id + "?order=desc",
type: "GET",
success: function(data, textStatus, jqXHR) {
@ -133,10 +133,22 @@ function loadEntries(user, timeline) {
// push the entries onto the page
displayEntries(entries)
},
error: function(jqXHR, textStatus, error) {
alert(jqXHR.responseText);
}
});
}
/* Push the entries onto the top of the entry display. */
function displayEntries(entries) {
_.each(entries, function(entry) {
newEntryBar.after(ich.entry(entry));
});
}
/* Show/hide the editable user-info panel. */
function toggleUserInfo(event) {
$("#user-info").slideToggle("slow");