newui: fixed bug on permanode page, constrained a type, added a TODO

Change-Id: Ibb92f4fbc9a4a433b9f3ebd53c9f5b8ccc50edea
This commit is contained in:
mpl 2013-06-09 20:18:36 +02:00
parent d32cfcc9cb
commit ddc9a32426
2 changed files with 18 additions and 4 deletions

View File

@ -170,7 +170,11 @@ camlistore.BlobItem.prototype.getThumbWidth_ = function() {
*/
camlistore.BlobItem.prototype.getLink_ = function() {
if (this.useContentAsLink_ == "true") {
return './?b=' + this.getFileBlobref_();
var b = this.getFileBlobref_();
if (b == "") {
b = this.getDirBlobref_();
}
return './?b=' + b;
}
return './?p=' + this.blobRef_;
};
@ -188,6 +192,17 @@ camlistore.BlobItem.prototype.getFileBlobref_ = function() {
return "";
}
/**
* @private
* @return {string}
*/
camlistore.BlobItem.prototype.getDirBlobref_ = function() {
if (this.resolvedMetaData_ &&
this.resolvedMetaData_.camliType == 'directory') {
return this.resolvedMetaData_.blobRef;
}
return "";
}
/**
* @return {string}

View File

@ -58,10 +58,8 @@ camlistore.PermanodePage = function(config, opt_domHelper) {
// No big deal though.
this.blobItemContainer_.thumbnailSize_ = camlistore.BlobItemContainer.THUMBNAIL_SIZES_[1];
// TODO(mpl): use a DescribeResponse as type, once we've merged
// with the other CL that introduces it.
/**
* @type {Object}
* @type {camlistore.ServerType.DescribeResponse}
* @private
*/
this.describeResponse_ = null;
@ -239,6 +237,7 @@ function(permanode, describeResult) {
handleType(permObj);
// TODO(mpl): link to filetree browser when type is dir
// TODO(mpl): display command to cammount the dir
// members
this.reloadMembers_();