mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
refactor(cloudfunc) Util: check, render
This commit is contained in:
parent
acb3e45414
commit
21ababdb09
1 changed files with 11 additions and 9 deletions
|
|
@ -13,6 +13,8 @@ var Util;
|
|||
|
||||
function CloudFuncProto(Util) {
|
||||
var CloudFunc = this,
|
||||
check = Util.check,
|
||||
render = Util.render,
|
||||
FS;
|
||||
|
||||
/* КОНСТАНТЫ (общие для клиента и сервера)*/
|
||||
|
|
@ -53,7 +55,7 @@ var Util;
|
|||
this.rmLastSlash = function(path) {
|
||||
var length, lastSlash, isEqual;
|
||||
|
||||
Util.check(arguments, ['path'])
|
||||
check(arguments, ['path'])
|
||||
.type('path', path, 'string');
|
||||
|
||||
length = path.length - 1;
|
||||
|
|
@ -86,7 +88,7 @@ var Util;
|
|||
pathHTML = '',
|
||||
path = '/';
|
||||
|
||||
Util.check(arguments, ['url', 'template']);
|
||||
check(arguments, ['url', 'template']);
|
||||
|
||||
namesRaw = url.split('/')
|
||||
.slice(1, -1),
|
||||
|
|
@ -108,7 +110,7 @@ var Util;
|
|||
if (index)
|
||||
slash = '/';
|
||||
|
||||
pathHTML += Util.render(template, {
|
||||
pathHTML += render(template, {
|
||||
path: path,
|
||||
name: name,
|
||||
slash: slash
|
||||
|
|
@ -147,13 +149,13 @@ var Util;
|
|||
*/
|
||||
refreshPath = CloudFunc.rmLastSlash(path),
|
||||
|
||||
fileTable = Util.render(template.path, {
|
||||
fileTable = render(template.path, {
|
||||
link : FS + refreshPath,
|
||||
fullPath : path,
|
||||
path : htmlPath
|
||||
}),
|
||||
|
||||
header = Util.render(templateFile, {
|
||||
header = render(templateFile, {
|
||||
tag : 'div',
|
||||
attribute : '',
|
||||
className : 'fm-header',
|
||||
|
|
@ -181,7 +183,7 @@ var Util;
|
|||
|
||||
link = FS + dotDot;
|
||||
|
||||
linkResult = Util.render(template.link, {
|
||||
linkResult = render(template.link, {
|
||||
link : link,
|
||||
name : '..'
|
||||
});
|
||||
|
|
@ -189,7 +191,7 @@ var Util;
|
|||
dataName = 'data-name="js-file-.." ',
|
||||
attribute = 'draggable="true" ' + dataName,
|
||||
/* Сохраняем путь к каталогу верхнего уровня*/
|
||||
fileTable += Util.render(template.file, {
|
||||
fileTable += render(template.file, {
|
||||
tag : 'li',
|
||||
attribute : attribute,
|
||||
className : '',
|
||||
|
|
@ -219,7 +221,7 @@ var Util;
|
|||
owner = file.owner || 'root';
|
||||
mode = file.mode;
|
||||
|
||||
linkResult = Util.render(templateLink, {
|
||||
linkResult = render(templateLink, {
|
||||
link : link,
|
||||
name : file.name,
|
||||
attribute : attribute
|
||||
|
|
@ -228,7 +230,7 @@ var Util;
|
|||
dataName = 'data-name="js-file-' + file.name + '" ';
|
||||
attribute = 'draggable="true" ' + dataName;
|
||||
|
||||
fileTable += Util.render(templateFile, {
|
||||
fileTable += render(templateFile, {
|
||||
tag : 'li',
|
||||
attribute : attribute,
|
||||
className : '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue