ui: fix blobitem title issues

http://camlistore.org/issue/141

Change-Id: I391bfba6a2083132e8998fcc8c2ae712cfc69836
This commit is contained in:
mpl 2013-06-11 14:38:37 +02:00
parent cf80262ef1
commit 777abd6e31
2 changed files with 51 additions and 25 deletions

View File

@ -208,18 +208,31 @@ camlistore.BlobItem.prototype.getDirBlobref_ = function() {
* @return {string}
*/
camlistore.BlobItem.prototype.getTitle_ = function() {
if (this.resolvedMetaData_) {
if (this.resolvedMetaData_.camliType == 'file' &&
!!this.resolvedMetaData_.file) {
return this.resolvedMetaData_.file.fileName;
} else if (this.resolvedMetaData_.camliType == 'permanode' &&
!!this.resolvedMetaData_.permanode &&
!!this.resolvedMetaData_.permanode.attr &&
!!this.resolvedMetaData_.permanode.attr.title) {
return this.resolvedMetaData_.permanode.attr.title;
}
}
return 'Unknown title';
if (this.metaData_) {
if (this.metaData_.camliType == 'permanode' &&
!!this.metaData_.permanode &&
!!this.metaData_.permanode.attr &&
!!this.metaData_.permanode.attr.title) {
return this.metaData_.permanode.attr.title;
}
}
if (this.resolvedMetaData_) {
if (this.resolvedMetaData_.camliType == 'file' &&
!!this.resolvedMetaData_.file) {
return this.resolvedMetaData_.file.fileName;
}
if (this.resolvedMetaData_.camliType == 'directory' &&
!!this.resolvedMetaData_.dir) {
return this.resolvedMetaData_.dir.fileName;
}
if (this.resolvedMetaData_.camliType == 'permanode' &&
!!this.resolvedMetaData_.permanode &&
!!this.resolvedMetaData_.permanode.attr &&
!!this.resolvedMetaData_.permanode.attr.title) {
return this.resolvedMetaData_.permanode.attr.title;
}
}
return 'Unknown title';
};

View File

@ -8,7 +8,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("blob_item.js", 7288, time.Unix(0, 1370942742232957700), fileembed.String("/**\n"+
Files.Add("blob_item.js", 7628, time.Unix(0, 1370954334543804326), fileembed.String("/**\n"+
" * @fileoverview An item showing in a blob item container; represents a blob\n"+
" * that has already been uploaded in the system, or acts as a placeholder\n"+
" * for a new blob.\n"+
@ -220,18 +220,31 @@ func init() {
" * @return {string}\n"+
" */\n"+
"camlistore.BlobItem.prototype.getTitle_ = function() {\n"+
" if (this.resolvedMetaData_) {\n"+
" if (this.resolvedMetaData_.camliType == 'file' &&\n"+
" !!this.resolvedMetaData_.file) {\n"+
" return this.resolvedMetaData_.file.fileName;\n"+
" } else if (this.resolvedMetaData_.camliType == 'permanode' &&\n"+
" !!this.resolvedMetaData_.permanode &&\n"+
" !!this.resolvedMetaData_.permanode.attr &&\n"+
" !!this.resolvedMetaData_.permanode.attr.title) {\n"+
" return this.resolvedMetaData_.permanode.attr.title;\n"+
" }\n"+
" }\n"+
" return 'Unknown title';\n"+
" if (this.metaData_) {\n"+
" if (this.metaData_.camliType == 'permanode' &&\n"+
" !!this.metaData_.permanode &&\n"+
" !!this.metaData_.permanode.attr &&\n"+
" !!this.metaData_.permanode.attr.title) { \n"+
" return this.metaData_.permanode.attr.title;\n"+
" }\n"+
" }\n"+
" if (this.resolvedMetaData_) {\n"+
" if (this.resolvedMetaData_.camliType == 'file' &&\n"+
" !!this.resolvedMetaData_.file) {\n"+
" return this.resolvedMetaData_.file.fileName;\n"+
" }\n"+
" if (this.resolvedMetaData_.camliType == 'directory' &&\n"+
" !!this.resolvedMetaData_.dir) {\n"+
" return this.resolvedMetaData_.dir.fileName;\n"+
" }\n"+
" if (this.resolvedMetaData_.camliType == 'permanode' &&\n"+
" !!this.resolvedMetaData_.permanode &&\n"+
" !!this.resolvedMetaData_.permanode.attr &&\n"+
" !!this.resolvedMetaData_.permanode.attr.title) {\n"+
" return this.resolvedMetaData_.permanode.attr.title;\n"+
" }\n"+
" }\n"+
" return 'Unknown title';\n"+
"};\n"+
"\n"+
"\n"+