- adjust for new undefined return value of new cookies package - add some error handling in case we think we're logged in, but really aren't
This commit is contained in:
parent
ff0b81e0f0
commit
8b459d69e3
@ -35,7 +35,7 @@ var GdataExtension = {};
|
|||||||
|
|
||||||
GdataExtension.isAuthorized = function() {
|
GdataExtension.isAuthorized = function() {
|
||||||
// TODO: Unreliable - just means that we were authorized at one point
|
// TODO: Unreliable - just means that we were authorized at one point
|
||||||
return Cookies.get('oauth2_token') !== null;
|
return Cookies.get('oauth2_token') != null;
|
||||||
};
|
};
|
||||||
|
|
||||||
GdataExtension.showAuthorizationDialog = function(onAuthorized, onNotAuthorized) {
|
GdataExtension.showAuthorizationDialog = function(onAuthorized, onNotAuthorized) {
|
||||||
|
@ -128,10 +128,6 @@ Refine.GDataSourceUI.prototype._listDocuments = function() {
|
|||||||
Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
|
Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!o.documents) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._elmts.listingContainer.empty();
|
this._elmts.listingContainer.empty();
|
||||||
|
|
||||||
var table = $(
|
var table = $(
|
||||||
@ -186,17 +182,23 @@ Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
|
|||||||
.appendTo(td);
|
.appendTo(td);
|
||||||
};
|
};
|
||||||
|
|
||||||
var docs = o.documents;
|
if (o.status === 'error') {
|
||||||
$.each(docs, function() {
|
// We're probably not logged in, even though we thought we were. Show signin page
|
||||||
this.updatedDate = (this.updated) ? new Date(this.updated) : null;
|
this._body.find('.gdata-page').hide();
|
||||||
this.updatedDateTime = (this.updatedDate) ? this.updatedDate.getTime() : 0;
|
this._elmts.signinPage.show();
|
||||||
});
|
} else {
|
||||||
docs.sort(function(a, b) { return b.updatedDateTime - a.updatedDateTime; });
|
var docs = o.documents;
|
||||||
|
$.each(docs, function() {
|
||||||
for (var i = 0; i < docs.length; i++) {
|
this.updatedDate = (this.updated) ? new Date(this.updated) : null;
|
||||||
renderDocument(docs[i]);
|
this.updatedDateTime = (this.updatedDate) ? this.updatedDate.getTime() : 0;
|
||||||
|
});
|
||||||
|
docs.sort(function(a, b) { return b.updatedDateTime - a.updatedDateTime; });
|
||||||
|
|
||||||
|
for (var i = 0; i < docs.length; i++) {
|
||||||
|
renderDocument(docs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._body.find('.gdata-page').hide();
|
||||||
|
this._elmts.listingPage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._body.find('.gdata-page').hide();
|
|
||||||
this._elmts.listingPage.show();
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user