Permalink
Browse files

MDL-31901: show shorttile instead of title where applicable

  • Loading branch information...
1 parent ce3eeb9 commit 830acea6c183da29d5cc7556093fd3e9d1c9eeb0 @marinaglancy marinaglancy committed Apr 24, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 repository/filepicker.js
View
9 repository/filepicker.js
@@ -379,11 +379,11 @@ M.core_filepicker.init = function(Y, options) {
this.msg_dlg.show();
},
build_tree: function(node, level) {
- var client_id = this.options.client_id;
var dynload = this.active_repo.dynload;
// prepare file name with icon
var el = Y.Node.create('<div/>').setContent(M.core_filepicker.templates.listfilename);
- el.one('.fp-filename').setContent(node.title);
+ el.one('.fp-filename').setContent(node.shorttitle ? node.shorttitle : node.title);
+ // TODO add tooltip with node.title or node.thumbnail_title
if (node.icon && !node.children) {
el.one('.fp-icon').appendChild(Y.Node.create('<img/>').set('src', node.icon));
if (node.realicon) {
@@ -711,17 +711,20 @@ M.core_filepicker.init = function(Y, options) {
};
var formatTitle = function(o) {
var el = Y.Node.create('<div/>').setContent(M.core_filepicker.templates.listfilename);
- el.one('.fp-filename').setContent(o.value);
+ el.one('.fp-filename').setContent(o.data['shorttitle'] ? o.data['shorttitle'] : o.value);
el.one('.fp-icon').appendChild(Y.Node.create('<img/>').set('src', o.data['icon']));
if (o.data['realicon']) {
scope.lazyloading[el.one('.fp-icon img').generateID()] = o.data['realicon'];
}
+ // TODO add tooltip with o.data['title'] (o.value) or o.data['thumbnail_title']
return el.getContent();
}
var sortFoldersFirst = function(a, b, desc) {
if (a.get('children') && !b.get('children')) {return -1;}
if (!a.get('children') && b.get('children')) {return 1;}
var aa = a.get(this.key), bb = b.get(this.key), dir = desc?-1:1;
+ if (this.key == 'title' && a.get('shorttitle')) {aa=a.get('shorttitle');}
+ if (this.key == 'title' && b.get('shorttitle')) {bb=b.get('shorttitle');}
return (aa > bb) ? dir : ((aa < bb) ? -dir : 0);
}

0 comments on commit 830acea

Please sign in to comment.