feature(cloudcmd) add one-panel-mode

This commit is contained in:
coderaiser 2016-06-15 19:45:49 +03:00
parent 1ce8a78e04
commit 5b4f7368ad
10 changed files with 52 additions and 13 deletions

View file

@ -78,6 +78,7 @@ Cloud Commander supports command line parameters:
| `--progress` | show progress of file operations | `--progress` | show progress of file operations
| `--html-dialogs` | show html dialogs | `--html-dialogs` | show html dialogs
| `--open` | open web browser when server started | `--open` | open web browser when server started
| `--one-panel-mode` | set one panel mode
| `--no-server` | do not start server | `--no-server` | do not start server
| `--no-auth` | disable authorization | `--no-auth` | disable authorization
| `--no-online` | load scripts from local server | `--no-online` | load scripts from local server
@ -85,6 +86,7 @@ Cloud Commander supports command line parameters:
| `--no-minify` | disable minification | `--no-minify` | disable minification
| `--no-progress` | do not show progress of file operations | `--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
If no parameters given Cloud Commander reads information from `~/.cloudcmd.json` and use 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. 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 */ "prefix" : "", /* url prefix */
"progress" : true /* show progress of file operations */ "progress" : true /* show progress of file operations */
"htmlDialogs" : true /* show html dialogs */ "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 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. 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") ![One panel mode](/img/screen/one-panel-mode.png "One panel mode")

View file

@ -34,7 +34,8 @@
'minify', 'minify',
'progress', 'progress',
'progress-of-copying', 'progress-of-copying',
'html-dialogs' 'html-dialogs',
'one-panel-mode'
], ],
default: { default: {
server : true, server : true,
@ -49,7 +50,8 @@
prefix : config('prefix') || '', prefix : config('prefix') || '',
progress : config('progress') || config('progressOfCopying'), progress : config('progress') || config('progressOfCopying'),
'html-dialogs' : config('htmlDialogs') 'html-dialogs' : config('htmlDialogs'),
'one-panel-mode': config('onePanelMode'),
}, },
alias: { alias: {
v: 'version', v: 'version',
@ -87,6 +89,7 @@
config('prefix', args.prefix); config('prefix', args.prefix);
config('root', args.root); config('root', args.root);
config('htmlDialogs', args['html-dialogs']); config('htmlDialogs', args['html-dialogs']);
config('onePanelMode', args['one-panel-mode']);
readConfig(args.config); readConfig(args.config);

View file

@ -18,6 +18,10 @@ body, pre, code {
visibility: hidden; visibility: hidden;
} }
.none {
display: none;
}
.fm, .keyspanel { .fm, .keyspanel {
cursor : default; cursor : default;
-webkit-user-select : none; -webkit-user-select : none;
@ -167,6 +171,10 @@ body, pre, code {
padding: 1%; padding: 1%;
} }
.panel-single {
width: 98%;
}
.selected-panel { .selected-panel {
border-color: rgb(254, 159, 224); border-color: rgb(254, 159, 224);
border-color: rgba(254, 159, 224, .40); border-color: rgba(254, 159, 224, .40);

View file

@ -20,5 +20,6 @@
"root": "/", "root": "/",
"prefix": "", "prefix": "",
"progress": true, "progress": true,
"htmlDialogs": true "htmlDialogs": true,
"onePanelMode": false
} }

View file

@ -14,6 +14,7 @@
"--minify ": "enable minification", "--minify ": "enable minification",
"--progress ": "show progress of file operations", "--progress ": "show progress of file operations",
"--html-dialogs ": "use html dialogs", "--html-dialogs ": "use html dialogs",
"--one-panel-mode ": "set one panel mode",
"--open ": "open web browser when server started", "--open ": "open web browser when server started",
"--no-server ": "do not start server", "--no-server ": "do not start server",
"--no-auth ": "disable authorization", "--no-auth ": "disable authorization",
@ -21,5 +22,6 @@
"--no-open ": "do not open web browser when server started", "--no-open ": "do not open web browser when server started",
"--no-minify ": "disable minification", "--no-minify ": "disable minification",
"--no-progress ": "do not show progress of file operations", "--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"
} }

View file

@ -182,6 +182,9 @@ var Util, DOM, CloudFunc, join;
htmlDialogs: !error && config.htmlDialogs htmlDialogs: !error && config.htmlDialogs
}; };
if (config.onePanelMode)
CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;
if (error) if (error)
CloudCmd.log(error); CloudCmd.log(error);

View file

@ -58,8 +58,11 @@
* additional processing of index file * additional processing of index file
*/ */
function indexProcessing(options) { function indexProcessing(options) {
var left, right, from, to, var from, to,
left = '',
right = '',
keysPanel = '<div id="js-keyspanel" class="{{ className }}', keysPanel = '<div id="js-keyspanel" class="{{ className }}',
isOnePanel = config('onePanelMode'),
data = options.data, data = options.data,
panel = options.panel; panel = options.panel;
@ -75,15 +78,23 @@
data = data.replace(from, to); data = data.replace(from, to);
} }
if (isOnePanel)
data = data
.replace('icon-move', 'icon-move none')
.replace('icon-copy', 'icon-copy none');
left = rendy(Template.panel, { left = rendy(Template.panel, {
side : 'left', side : 'left',
content : panel content : panel,
className : !isOnePanel ? '' : 'panel-single'
}); });
right = rendy(Template.panel, { if (!isOnePanel)
side : 'right', right = rendy(Template.panel, {
content : panel side : 'right',
}); content : panel,
className : ''
});
data = rendy(data, { data = rendy(data, {
title : CloudFunc.getTitle(), title : CloudFunc.getTitle(),

View file

@ -38,6 +38,7 @@ programs in browser from any computer, mobile or tablet device.
--progress show progress of file operations --progress show progress of file operations
--html-dialogs use html dialogs --html-dialogs use html dialogs
--open open web browser when server started --open open web browser when server started
--one-panel-mode set one panel mode
--no-auth disable authorization --no-auth disable authorization
--no-server do not start server --no-server do not start server
--no-online load scripts from local server --no-online load scripts from local server
@ -45,6 +46,7 @@ programs in browser from any computer, mobile or tablet device.
--no-minify disable minification --no-minify disable minification
--no-progress do not show progress of file operations --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
.SH RESOURCES AND DOCUMENTATION .SH RESOURCES AND DOCUMENTATION

View file

@ -133,4 +133,10 @@
HTML Dialogs HTML Dialogs
</label> </label>
</li> </li>
<li>
<label>
<input data-name="js-onePanelMode" type="checkbox" {{ onePanelMode }}>
One Panel Mode
</label>
</li>
</ul> </ul>

View file

@ -1 +1 @@
<section data-name="js-{{ side }}" class="panel panel-{{ side }}">{{ content }}</section> <section data-name="js-{{ side }}" class="panel panel-{{ side }} {{ className }}">{{ content }}</section>