feature(contact) add ability to hide contact button with --no-contact (#125)

This commit is contained in:
Jörn Zaefferer 2017-07-28 11:36:58 +02:00 committed by coderaiser
parent 7147e0a85c
commit a5656d15b4
8 changed files with 39 additions and 2 deletions

View file

@ -82,6 +82,7 @@ Cloud Commander supports command line parameters:
| `--open` | open web browser when server started
| `--name` | set tab name in web browser
| `--one-panel-mode` | set one panel mode
| `--contact` | enable contact
| `--config-dialog` | enable config dialog
| `--console` | enable console
| `--terminal` | enable terminal
@ -93,6 +94,7 @@ Cloud Commander supports command line parameters:
| `--no-progress` | do not show progress of file operations
| `--no-html-dialogs` | do not use html dialogs
| `--no-one-panel-mode` | unset one panel mode
| `--no-contact` | disable contact
| `--no-config-dialog` | disable config dialog
| `--no-console` | disable console
| `--no-terminal` | disable terminal
@ -322,6 +324,7 @@ Here is description of options:
"progress" : true, /* show progress of file operations */
"htmlDialogs" : true, /* use html dialogs */
"onePanelMode" : false, /* set one panel mode */
"contact" : true, /* enable contact */
"configDialog" : true, /* enable config dialog */
"console" : true, /* enable console */
"terminal" : false, /* disable terminal */
@ -335,9 +338,10 @@ Some config options can be overridden with `environment variables` such:
- `CLOUDCMD_NAME` - set tab name in web browser
- `CLOUDCMD_EDITOR` - set editor
- `CLOUDCMD_CONTACT` - enable contact
- `CLOUDCMD_CONFIG_DIALOG` - enable config dialog
- `CLOUDCMD_TERMINAL` - enable terminal
- `CLOUDCMD_TERMINAL_PATH` - set terminal path
- `CLOUDCMD_CONFIG_DIALOG` - enable config dialog
- `CLOUDCMD_AUTH` - enable authentication
- `CLOUDCMD_USERNAME` - set username
- `CLOUDCMD_PASSWORD` - set password

View file

@ -22,6 +22,11 @@
"value": "edward",
"required": false
},
"CLOUDCMD_CONTACT": {
"description": "enable contact",
"value": "true",
"required": false
},
"CLOUDCMD_TERMINAL": {
"description": "enable terminal",
"value": "true",

View file

@ -40,6 +40,7 @@ const args = require('minimist')(argv.slice(2), {
'progress',
'config-dialog',
'console',
'contact',
'terminal',
'one-panel-mode',
'html-dialogs',
@ -60,6 +61,7 @@ const args = require('minimist')(argv.slice(2), {
prefix : config('prefix'),
progress : config('progress'),
console : config('console'),
contact : choose(env.bool('contact'), config('contact')),
terminal : choose(env.bool('terminal'), config('terminal')),
'terminal-path': env('terminal_path') || config('terminalPath'),
@ -104,6 +106,7 @@ function main() {
config('username', args.username);
config('progress', args.progress);
config('console', args.console);
config('contact', args.contact);
config('terminal', args.terminal);
config('terminalPath', args['terminal-path']);
config('editor', args.editor);

View file

@ -21,9 +21,9 @@
"prefix": "",
"progress": true,
"htmlDialogs": true,
"contact": true,
"configDialog": true,
"onePanelMode": false,
"configDialog": true,
"console": true,
"terminal": false,
"terminalPath": "",

View file

@ -18,6 +18,7 @@
"--one-panel-mode ": "set one panel mode",
"--config-dialog ": "enable config dialog",
"--console ": "enable console",
"--contact ": "enable contact",
"--terminal ": "enable terminal",
"--terminal-path ": "set terminal path",
"--open ": "open web browser when server started",
@ -31,6 +32,7 @@
"--no-one-panel-mode ": "unset one panel mode",
"--no-config-dialog ": "disable config dialog",
"--no-console ": "disable console",
"--no-contact ": "disable contact",
"--no-terminal ": "disable terminal",
"--no-name ": "set default tab name in web browser"
}

View file

@ -39,6 +39,7 @@ programs in browser from any computer, mobile or tablet device.
--progress show progress of file operations
--html-dialogs use html dialogs
--one-panel-mode set one panel mode
--contact enable contact
--config-dialog enable config dialog
--console enable console
--terminal enable terminal
@ -52,6 +53,7 @@ programs in browser from any computer, mobile or tablet device.
--no-progress do not show progress of file operations
--no-html-dialogs do not use html dialogs
--no-one-panel-mode unset one panel mode
--no-contact disable contact
--no-config-dialog disable config dialog
--no-console disable console
--no-terminal disable terminal

View file

@ -56,6 +56,7 @@ function indexProcessing(options) {
const keysPanel = '<div id="js-keyspanel" class="{{ className }}"';
const keysPanelRegExp = '<div id="?js-keyspanel"? class="?{{ className }}"?';
const isOnePanel = config('onePanelMode');
const noContact = !config('contact');
const noConfig = !config('configDialog');
const noConsole = !config('console');
const noTerminal = !config('terminal');
@ -83,6 +84,10 @@ function indexProcessing(options) {
.replace('icon-move', 'icon-move none')
.replace('icon-copy', 'icon-copy none');
if (noContact)
data = data
.replace('icon-contact', 'icon-contact none');
if (noConfig)
data = data
.replace('icon-config', 'icon-config none');

View file

@ -85,3 +85,19 @@ test('cloudcmd: route: buttons: no config', (t) => {
});
});
});
test('cloudcmd: route: buttons: no contact', (t) => {
const config = {
contact: false
};
before({config}, (port, after) => {
getStr(`http://localhost:${port}/`)
.then((result) => {
t.ok(/icon-contact none/.test(result), 'should hide contact');
t.end();
after();
});
});
});