Skip to content

Commit 8ece488

Browse files
author
p01
committed
Clip the short distinguisher of the resources
1 parent 57303f9 commit 8ece488

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/resource-manager/resource_templates.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ templates.resource_tree =
1919

2020
URL_MATCH_CONTEXT_SIZE: 10,
2121
DEPTH_IDENTATION: 18,
22+
DISTINGUISHER_MAX_LENGTH: 64,
23+
24+
_get_short_distinguisher:function( url )
25+
{
26+
var name = url.filename || url.short_distinguisher || url;
27+
if (name.length>this.DISTINGUISHER_MAX_LENGTH)
28+
name = name.slice(0, this.DISTINGUISHER_MAX_LENGTH)+'…';
29+
return name;
30+
},
31+
2232

2333
_expander_extras:function(context, pivotID, depth)
2434
{
@@ -132,7 +142,7 @@ templates.resource_tree =
132142
['h2',
133143
extras.tpl.button,
134144
['span',
135-
(d.url.filename || d.url.short_distinguisher),
145+
this._get_short_distinguisher(d.url),
136146
'class','resource-tree-document-label'
137147
],
138148
' ',
@@ -232,7 +242,7 @@ templates.resource_tree =
232242
['li',
233243
['h2',
234244
['span',
235-
partial_URL_match||(r.filename || r.short_distinguisher || r.url || ''),
245+
partial_URL_match||this._get_short_distinguisher(r),
236246
'class','resource-tree-resource-label',
237247
'style', 'margin-left:'+ (1+depth)*this.DEPTH_IDENTATION +'px;',
238248
'data-tooltip','js-script-select',

0 commit comments

Comments
 (0)