mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) readify: add support of links
This commit is contained in:
parent
03685ee390
commit
52ffc2ac28
5 changed files with 31 additions and 23 deletions
|
|
@ -188,8 +188,8 @@ module.exports.buildFromJSON = (params) => {
|
|||
const name = encode(file.name);
|
||||
const link = prefix + FS + path + name;
|
||||
|
||||
const type = getType(file.size);
|
||||
const size = getSize(file.size);
|
||||
const {type} = file;
|
||||
const size = getSize(file);
|
||||
|
||||
const date = file.date || '--.--.----';
|
||||
const owner = file.owner || 'root';
|
||||
|
|
@ -199,7 +199,7 @@ module.exports.buildFromJSON = (params) => {
|
|||
link,
|
||||
title: name,
|
||||
name,
|
||||
attribute: getAttribute(file.size)
|
||||
attribute: getAttribute(file.type)
|
||||
});
|
||||
|
||||
const dataName = getDataName(file.name);
|
||||
|
|
@ -223,22 +223,20 @@ module.exports.buildFromJSON = (params) => {
|
|||
return fileTable;
|
||||
};
|
||||
|
||||
function getType(size) {
|
||||
if (size === 'dir')
|
||||
return 'directory';
|
||||
|
||||
return 'text-file';
|
||||
}
|
||||
|
||||
function getAttribute(size) {
|
||||
if (size === 'dir')
|
||||
function getAttribute(type) {
|
||||
if (type === 'directory')
|
||||
return '';
|
||||
|
||||
return 'target="_blank" ';
|
||||
}
|
||||
|
||||
function getSize(size) {
|
||||
if (size === 'dir')
|
||||
function getSize(file) {
|
||||
const {
|
||||
size,
|
||||
type,
|
||||
} = file;
|
||||
|
||||
if (type === 'directory')
|
||||
return '<dir>';
|
||||
|
||||
return size;
|
||||
|
|
|
|||
|
|
@ -107,12 +107,12 @@
|
|||
color: white;
|
||||
}
|
||||
|
||||
.text-file::before {
|
||||
.file::before, .file-link::before {
|
||||
color: rgba(26, 224, 124, 0.56);
|
||||
content: '\e80d';
|
||||
}
|
||||
|
||||
.current-file .text-file::before {
|
||||
.current-file .file::before, .file-link::before {
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
|
@ -133,11 +133,11 @@
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.directory::before {
|
||||
.directory::before, .directory-link::before {
|
||||
content: '\e807';
|
||||
}
|
||||
|
||||
.text-file {
|
||||
.file, .file-link {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
|
|
|
|||
10
css/urls.css
10
css/urls.css
|
|
@ -37,7 +37,15 @@
|
|||
background-image: url(../img/dir.png);
|
||||
}
|
||||
|
||||
.text-file {
|
||||
.directory-link {
|
||||
background-image: url(../img/dir.png);
|
||||
}
|
||||
|
||||
.file {
|
||||
background-image: url(../img/txt.png);
|
||||
}
|
||||
|
||||
.file-link {
|
||||
background-image: url(../img/txt.png);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<span data-name="js-owner" class="owner reduce-text">root</span>
|
||||
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
|
||||
</li><li draggable="true" data-name="js-file-JUQwJUIwJUQwJUI5" class="">
|
||||
<span data-name="js-type" class="mini-icon text-file"></span>
|
||||
<span data-name="js-type" class="mini-icon file"></span>
|
||||
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/ай" title="ай" target="_blank" draggable="true">ай</a></span>
|
||||
<span data-name="js-size" class="size reduce-text">1.30kb</span>
|
||||
<span data-name="js-date" class="date reduce-text">--.--.----</span>
|
||||
|
|
|
|||
|
|
@ -41,16 +41,18 @@ const JSON_FILES = {
|
|||
path : '/etc/X11/',
|
||||
files : [{
|
||||
name: 'applnk',
|
||||
size: 'dir',
|
||||
size: '4.0.0kb',
|
||||
date: '21.02.2016',
|
||||
uid : 0,
|
||||
mode: 'rwx r-x r-x'
|
||||
mode: 'rwx r-x r-x',
|
||||
type: 'directory',
|
||||
}, {
|
||||
name: 'ай',
|
||||
size: '1.30kb',
|
||||
date: 0,
|
||||
uid : 0,
|
||||
mode: 'rwx r-x r-x'
|
||||
mode: 'rwx r-x r-x',
|
||||
type: 'file',
|
||||
}]
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue