fix(pathLink) prefix when js disabled

This commit is contained in:
coderaiser 2016-01-20 14:16:32 -05:00
parent caf20ca7b1
commit 52090ddcc3
6 changed files with 18 additions and 10 deletions

View file

@ -87,7 +87,7 @@
* возвращаеться массив каталогов
* @param url - адрес каталога
*/
function getPathLink(url, template) {
function getPathLink(url, prefix, template) {
var namesRaw, names, length,
pathHTML = '',
path = '/';
@ -121,7 +121,8 @@
pathHTML += rendy(template, {
path: path,
name: name,
slash: slash
slash: slash,
prefix: prefix
});
}
});
@ -138,6 +139,7 @@
var file, i, n, type, attribute, size, owner, mode,
dotDot, link, dataName,
linkResult,
prefix = params.prefix,
template = params.template,
templateFile = template.file,
templateLink = template.link,
@ -149,10 +151,10 @@
* Строим путь каталога в котором мы находимся
* со всеми подкаталогами
*/
htmlPath = getPathLink(path, template.pathLink),
htmlPath = getPathLink(path, prefix, template.pathLink),
fileTable = rendy(template.path, {
link : FS + path,
link : prefix + FS + path,
fullPath : path,
path : htmlPath
}),
@ -183,7 +185,7 @@
if (dotDot === '')
dotDot = '/';
link = FS + dotDot;
link = prefix + FS + dotDot;
linkResult = rendy(template.link, {
link : link,
@ -209,7 +211,7 @@
n = files.length;
for (i = 0; i < n; i++) {
file = files[i];
link = FS + path + file.name;
link = prefix + FS + path + file.name;
if (file.size === 'dir') {
type = 'directory';