mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(html) add path-link
This commit is contained in:
parent
80a8312c06
commit
4a4ab12a5b
4 changed files with 27 additions and 21 deletions
31
cloudcmd.js
31
cloudcmd.js
|
|
@ -25,14 +25,15 @@
|
|||
KEY = DIR + 'ssl/ssl.key',
|
||||
CERT = DIR + 'ssl/ssl.crt',
|
||||
|
||||
HTML_FS_DIR = HTMLDIR + 'fs/',
|
||||
INDEX_PATH = HTML_FS_DIR + 'index.html',
|
||||
FILE_TMPL = HTML_FS_DIR + 'file.html',
|
||||
PANEL_TMPL = HTML_FS_DIR + 'panel.html',
|
||||
PATH_TMPL = HTML_FS_DIR + 'path.html',
|
||||
LINK_TMPL = HTML_FS_DIR + 'link.html',
|
||||
HTML_FS_DIR = HTMLDIR + 'fs/',
|
||||
INDEX_PATH = HTML_FS_DIR + 'index.html',
|
||||
FILE_TMPL = HTML_FS_DIR + 'file.html',
|
||||
PANEL_TMPL = HTML_FS_DIR + 'panel.html',
|
||||
PATH_TMPL = HTML_FS_DIR + 'path.html',
|
||||
PATH_LINK_TMPL = HTML_FS_DIR + 'path-link.html',
|
||||
LINK_TMPL = HTML_FS_DIR + 'link.html',
|
||||
|
||||
FileTemplate, PanelTemplate, PathTemplate, LinkTemplate,
|
||||
FileTemplate, PanelTemplate, PathTemplate, LinkTemplate, PathLinkTemplate,
|
||||
|
||||
FS = CloudFunc.FS;
|
||||
/* reinit main dir os if we on Win32 should be backslashes */
|
||||
|
|
@ -162,10 +163,11 @@
|
|||
} else {
|
||||
status = 'ok';
|
||||
|
||||
FileTemplate = files[FILE_TMPL];
|
||||
PanelTemplate = files[PANEL_TMPL];
|
||||
PathTemplate = files[PATH_TMPL];
|
||||
LinkTemplate = files[LINK_TMPL];
|
||||
FileTemplate = files[FILE_TMPL];
|
||||
PanelTemplate = files[PANEL_TMPL];
|
||||
PathTemplate = files[PATH_TMPL];
|
||||
PathLinkTemplate = files[PATH_LINK_TMPL];
|
||||
LinkTemplate = files[LINK_TMPL];
|
||||
|
||||
if (Config.ssl)
|
||||
params.ssl = {
|
||||
|
|
@ -278,9 +280,10 @@
|
|||
panel = CloudFunc.buildFromJSON({
|
||||
data: json,
|
||||
template: {
|
||||
file: FileTemplate,
|
||||
path: PathTemplate,
|
||||
link: LinkTemplate
|
||||
file : FileTemplate,
|
||||
path : PathTemplate,
|
||||
pathLinks : PathLinkTemplate,
|
||||
link : LinkTemplate
|
||||
}
|
||||
}),
|
||||
|
||||
|
|
|
|||
1
html/fs/path-link.html
Normal file
1
html/fs/path-link.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<a data-name="js-path-link" href="/fs{{ path }}" title="{{ path }}">{{ name }}</a>{{ slash }}
|
||||
|
|
@ -323,6 +323,7 @@ var Util, DOM, CloudFunc;
|
|||
this.getExt = getSystemFile(Extensions, DIR_JSON + 'ext.json');
|
||||
this.getFileTemplate = getSystemFile(FileTemplate, DIR_HTML_FS + 'file.html');
|
||||
this.getPathTemplate = getSystemFile(PathTemplate, DIR_HTML_FS + 'path.html');
|
||||
this.getPathLinkTemplate = getSystemFile(PathTemplate, DIR_HTML_FS + 'path-link.html');
|
||||
this.getLinkTemplate = getSystemFile(PathTemplate, DIR_HTML_FS + 'link.html');
|
||||
|
||||
this.execFromModule = function(moduleName, funcName, params) {
|
||||
|
|
@ -404,10 +405,11 @@ var Util, DOM, CloudFunc;
|
|||
funcs = [
|
||||
CloudCmd.getFileTemplate,
|
||||
CloudCmd.getPathTemplate,
|
||||
CloudCmd.getPathLinkTemplate,
|
||||
CloudCmd.getLinkTemplate
|
||||
];
|
||||
|
||||
Util.exec.parallel(funcs, function(templFile, templPath, templLink) {
|
||||
Util.exec.parallel(funcs, function(templFile, templPath, templPathLink, templLink) {
|
||||
var n, found, varCurrent, varName, current,
|
||||
dir = DOM.getCurrentDirName(),
|
||||
name = DOM.getCurrentName(),
|
||||
|
|
@ -420,9 +422,10 @@ var Util, DOM, CloudFunc;
|
|||
data : json,
|
||||
id : panel.id,
|
||||
template : {
|
||||
file : templFile,
|
||||
path : templPath,
|
||||
link : templLink
|
||||
file : templFile,
|
||||
path : templPath,
|
||||
pathLink : templPathLink,
|
||||
link : templLink
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -326,10 +326,9 @@ var Util;
|
|||
* возвращаеться массив каталогов
|
||||
* @param url - адрес каталога
|
||||
*/
|
||||
function getPathLinks(url) {
|
||||
function getPathLink(url, template) {
|
||||
var pathHTML = '',
|
||||
path = '/',
|
||||
template = '<a data-name="js-path-link" href="/fs{{ path }}" title="{{ path }}">{{ name }}</a>{{ slash }}',
|
||||
namesRaw = url.split('/')
|
||||
.slice(1, -1),
|
||||
names = [].concat('/', namesRaw),
|
||||
|
|
@ -382,7 +381,7 @@ var Util;
|
|||
* Строим путь каталога в котором мы находимся
|
||||
* со всеми подкаталогами
|
||||
*/
|
||||
htmlPath = getPathLinks(path),
|
||||
htmlPath = getPathLink(path, template.pathLink),
|
||||
|
||||
/* Убираем последний слэш
|
||||
* с пути для кнопки обновить страницу
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue