switch to jquery.couch2 for deffereds
This commit is contained in:
@@ -3,13 +3,6 @@ var app = {
|
||||
container: 'main_content'
|
||||
};
|
||||
|
||||
app.reqOpts = {
|
||||
uri: app.baseURL + "api",
|
||||
method: "GET",
|
||||
headers: {"Content-type": "application/json"},
|
||||
cache: true
|
||||
}
|
||||
|
||||
app.handler = function(route) {
|
||||
route = route.path.slice(1, route.path.length);
|
||||
if (route.length < 1) route = "home";
|
||||
@@ -17,11 +10,43 @@ app.handler = function(route) {
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
// var query = {
|
||||
// "descending" : true,
|
||||
// "limit" : 20,
|
||||
// success: function( data ) {
|
||||
// if( data.rows.length === 0 ) {
|
||||
// monocles.oldestDoc = false;
|
||||
// monocles.hideLoader();
|
||||
// posts = [];
|
||||
// } else {
|
||||
// monocles.oldestDoc = data.rows[ data.rows.length - 1 ];
|
||||
// posts = data.rows;
|
||||
// }
|
||||
// renderStream();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ( opts.offsetDoc ) {
|
||||
// $.extend( query, {
|
||||
// "startkey": opts.offsetDoc.key,
|
||||
// "startkey_docid": opts.offsetDoc.id,
|
||||
// "skip": 1
|
||||
// })
|
||||
// }
|
||||
|
||||
app.after = {
|
||||
home: function() {
|
||||
|
||||
$.request(app.reqOpts, removalist.gotDb);
|
||||
|
||||
couch.request({url: app.baseURL + "api"}).then(function(db) {
|
||||
removalist.gotDb(db);
|
||||
couch.request({url: app.baseURL + 'api/headers'}).then(function(headers) {
|
||||
removalist.gotHeaders(headers);
|
||||
couch.request({url: app.baseURL + 'api/rows?limit=10'}).then(function(response) {
|
||||
removalist.renderRows(response.rows);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$( '.csv' ).live('click', ( function( e ) {
|
||||
window.location.href = app.csvUrl;
|
||||
e.preventDefault();
|
||||
@@ -29,12 +54,12 @@ app.after = {
|
||||
}
|
||||
}
|
||||
|
||||
app.s = $.sammy(function () {
|
||||
app.sammy = $.sammy(function () {
|
||||
this.get('', app.handler);
|
||||
this.get("#/", app.handler);
|
||||
this.get("#:route", app.handler);
|
||||
});
|
||||
|
||||
$(function() {
|
||||
app.s.run();
|
||||
app.sammy.run();
|
||||
})
|
||||
Reference in New Issue
Block a user