feature(cloudfunc) rm rmLastSlash

This commit is contained in:
coderaiser 2015-07-21 11:06:57 -04:00
parent afeb59b1ca
commit a4a18fe920
6 changed files with 15 additions and 66 deletions

View file

@ -69,30 +69,10 @@ var Util;
else
name = '';
msg = msg + ': ' + status + name;
return msg;
};
/**
* Функция убирает последний слеш,
* если он - последний символ строки
*/
this.rmLastSlash = function(path) {
var length, lastSlash, isEqual;
if (typeof path !== 'string')
throw(Error('path should be a string!'));
length = path.length - 1;
lastSlash = path.lastIndexOf('/');
isEqual = lastSlash === length;
if (length && isEqual)
path = path.substr(path, length);
return path;
};
/** Функция возвращает заголовок веб страницы
* @pPath
@ -173,14 +153,8 @@ var Util;
*/
htmlPath = getPathLink(path, template.pathLink),
/* Убираем последний слэш
* с пути для кнопки обновить страницу
* если он есть
*/
refreshPath = CloudFunc.rmLastSlash(path),
fileTable = rendy(template.path, {
link : FS + refreshPath,
link : FS + path,
fullPath : path,
path : htmlPath
}),