From 5b4f7368ada7ed14eb077ed3de1aaaf4d161fa3e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 15 Jun 2016 19:45:49 +0300 Subject: [PATCH] feature(cloudcmd) add one-panel-mode --- HELP.md | 5 ++++- bin/cloudcmd.js | 7 +++++-- css/style.css | 8 ++++++++ json/config.json | 3 ++- json/help.json | 4 +++- lib/client.js | 3 +++ lib/server/route.js | 25 ++++++++++++++++++------- man/cloudcmd.1 | 2 ++ tmpl/config.hbs | 6 ++++++ tmpl/fs/panel.hbs | 2 +- 10 files changed, 52 insertions(+), 13 deletions(-) diff --git a/HELP.md b/HELP.md index d6d6663d..c5658874 100644 --- a/HELP.md +++ b/HELP.md @@ -78,6 +78,7 @@ Cloud Commander supports command line parameters: | `--progress` | show progress of file operations | `--html-dialogs` | show html dialogs | `--open` | open web browser when server started +| `--one-panel-mode` | set one panel mode | `--no-server` | do not start server | `--no-auth` | disable authorization | `--no-online` | load scripts from local server @@ -85,6 +86,7 @@ Cloud Commander supports command line parameters: | `--no-minify` | disable minification | `--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 If no parameters given Cloud Commander reads information from `~/.cloudcmd.json` and use port from it (`8000` default). if port variables `PORT` or `VCAP_APP_PORT` isn't exist. @@ -233,6 +235,7 @@ Here is description of options: "prefix" : "", /* url prefix */ "progress" : true /* show progress of file operations */ "htmlDialogs" : true /* show html dialogs */ + "onePanelMode" : false /* set one panel mode */ } ``` @@ -268,7 +271,7 @@ Right mouse click button shows context menu with items: One panel mode --------------- -Cloud Commander could work in one panel mode when screen size can not accommodate second panel. +Cloud Commander could work in one panel mode when screen size can not accommodate second panel or via `--one-panel-mode` options flag. It could happen when mobile device, tablet or small window size used to work with file manager. ![One panel mode](/img/screen/one-panel-mode.png "One panel mode") diff --git a/bin/cloudcmd.js b/bin/cloudcmd.js index c2b9e4cc..8b7b3205 100755 --- a/bin/cloudcmd.js +++ b/bin/cloudcmd.js @@ -34,7 +34,8 @@ 'minify', 'progress', 'progress-of-copying', - 'html-dialogs' + 'html-dialogs', + 'one-panel-mode' ], default: { server : true, @@ -49,7 +50,8 @@ prefix : config('prefix') || '', progress : config('progress') || config('progressOfCopying'), - 'html-dialogs' : config('htmlDialogs') + 'html-dialogs' : config('htmlDialogs'), + 'one-panel-mode': config('onePanelMode'), }, alias: { v: 'version', @@ -87,6 +89,7 @@ config('prefix', args.prefix); config('root', args.root); config('htmlDialogs', args['html-dialogs']); + config('onePanelMode', args['one-panel-mode']); readConfig(args.config); diff --git a/css/style.css b/css/style.css index e56f6bfe..40b6b5bb 100644 --- a/css/style.css +++ b/css/style.css @@ -18,6 +18,10 @@ body, pre, code { visibility: hidden; } +.none { + display: none; +} + .fm, .keyspanel { cursor : default; -webkit-user-select : none; @@ -167,6 +171,10 @@ body, pre, code { padding: 1%; } +.panel-single { + width: 98%; +} + .selected-panel { border-color: rgb(254, 159, 224); border-color: rgba(254, 159, 224, .40); diff --git a/json/config.json b/json/config.json index 80f1a267..678a1166 100644 --- a/json/config.json +++ b/json/config.json @@ -20,5 +20,6 @@ "root": "/", "prefix": "", "progress": true, - "htmlDialogs": true + "htmlDialogs": true, + "onePanelMode": false } diff --git a/json/help.json b/json/help.json index 2035dafd..c4b49fa1 100644 --- a/json/help.json +++ b/json/help.json @@ -14,6 +14,7 @@ "--minify ": "enable minification", "--progress ": "show progress of file operations", "--html-dialogs ": "use html dialogs", + "--one-panel-mode ": "set one panel mode", "--open ": "open web browser when server started", "--no-server ": "do not start server", "--no-auth ": "disable authorization", @@ -21,5 +22,6 @@ "--no-open ": "do not open web browser when server started", "--no-minify ": "disable minification", "--no-progress ": "do not show progress of file operations", - "--no-html-dialogs ": "do not use html dialogs" + "--no-html-dialogs ": "do not use html dialogs", + "--no-one-panel-mode ": "unset one panel mode" } diff --git a/lib/client.js b/lib/client.js index 027706d6..9b6b9538 100644 --- a/lib/client.js +++ b/lib/client.js @@ -182,6 +182,9 @@ var Util, DOM, CloudFunc, join; htmlDialogs: !error && config.htmlDialogs }; + if (config.onePanelMode) + CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity; + if (error) CloudCmd.log(error); diff --git a/lib/server/route.js b/lib/server/route.js index 99e181e4..315cca84 100644 --- a/lib/server/route.js +++ b/lib/server/route.js @@ -58,8 +58,11 @@ * additional processing of index file */ function indexProcessing(options) { - var left, right, from, to, + var from, to, + left = '', + right = '', keysPanel = '
+ One Panel Mode + + diff --git a/tmpl/fs/panel.hbs b/tmpl/fs/panel.hbs index d38b9c2f..ec703262 100644 --- a/tmpl/fs/panel.hbs +++ b/tmpl/fs/panel.hbs @@ -1 +1 @@ -
{{ content }}
\ No newline at end of file +
{{ content }}