From a44661fc52ce1b745adf5d7bb11966cbf7ebc418 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 9 Sep 2015 14:45:37 +0000 Subject: [PATCH] Add different formatting for linked files when they're in sub-directories - Fix bug in formatting if first link is in a subdirectory --- etemplate/js/et2_widget_link.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/etemplate/js/et2_widget_link.js b/etemplate/js/et2_widget_link.js index 499e84ca4c..1f735d81db 100644 --- a/etemplate/js/et2_widget_link.js +++ b/etemplate/js/et2_widget_link.js @@ -1971,14 +1971,14 @@ var et2_link_list = et2_link_string.extend( $td.attr('data-title', _link_data['title']); // VFS link - check for same dir as above, and hide dir + var reformat = false; + var span_size = 0.3; var prev = $j('td.title',$td.parent().prev('tr')); if(prev.length === 1) { var prev_dirs = (prev.attr('data-title') || '').split('/'); - var reformat = false; if(prev_dirs.length > 1 && prev_dirs.length == dirs.length) { - var span_size = 0.3; for(var i = 0; i < dirs.length; i++) { // Current is same as prev, blank it @@ -1994,16 +1994,17 @@ var et2_link_list = et2_link_string.extend( } } } - if(reformat) - { - $td.html(' - '+dirs.join('')); - } - else - { - // Different format for directory - var filename = dirs.pop(); - $td.text(dirs.join('/') + ': - ' + filename); - } + } + if(reformat) + { + $td.html(' - '+dirs.join('')); + } + else + { + // Different format for directory + var filename = dirs.pop(); + span_size += dirs.join('/').length+1; + $td.html(''+dirs.join('/')+': - ' + filename); } } });