mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(pathLink) prefix when js disabled
This commit is contained in:
parent
caf20ca7b1
commit
52090ddcc3
6 changed files with 18 additions and 10 deletions
|
|
@ -448,6 +448,7 @@ var Util, DOM, CloudFunc, join;
|
|||
panel.innerHTML = CloudFunc.buildFromJSON({
|
||||
data : json,
|
||||
id : panel.id,
|
||||
prefix : CloudCmd.PREFIX,
|
||||
template : {
|
||||
file : templFile,
|
||||
path : templPath,
|
||||
|
|
|
|||
|
|
@ -1061,9 +1061,11 @@ var CloudCmd, Util, DOM, CloudFunc;
|
|||
this.getCurrentPath = function(currentFile) {
|
||||
var current = currentFile || DOM.getCurrentFile(),
|
||||
element = DOM.getByTag('a', current)[0],
|
||||
path = element.getAttribute('href');
|
||||
path = element.getAttribute('href'),
|
||||
prefix = CloudCmd.PREFIX,
|
||||
fs = CloudFunc.FS;
|
||||
|
||||
path = path.replace(CloudFunc.FS, '');
|
||||
path = path.replace(RegExp('^' + prefix + fs), '');
|
||||
|
||||
return path;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
function onPathElementClick(panel, event) {
|
||||
var link, href, url,
|
||||
noCurrent,
|
||||
fs = CloudFunc.FS,
|
||||
prefix = CloudCmd.PREFIX,
|
||||
element = event.target,
|
||||
attr = element.getAttribute('data-name');
|
||||
|
||||
|
|
@ -128,7 +130,7 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
*/
|
||||
link = link.replace('%%', '%25%');
|
||||
link = decodeURI(link);
|
||||
link = link.replace(CloudFunc.FS, '') || '/';
|
||||
link = link.replace(RegExp('^' + prefix + fs), '') || '/';
|
||||
|
||||
noCurrent = isNoCurrent(panel);
|
||||
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@
|
|||
if (!error) {
|
||||
panel = CloudFunc.buildFromJSON({
|
||||
data : json,
|
||||
prefix : config('prefix'),
|
||||
template : Template
|
||||
}),
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<a data-name="js-path-link" href="/fs{{ path }}" title="{{ path }}">{{ name }}</a>{{ slash }}
|
||||
<a data-name="js-path-link" href="{{ prefix }}/fs{{ path }}" title="{{ path }}">{{ name }}</a>{{ slash }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue