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
| `--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")

View file

@ -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);

View file

@ -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);

View file

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

View file

@ -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"
}

View file

@ -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);

View file

@ -58,8 +58,11 @@
* additional processing of index file
*/
function indexProcessing(options) {
var left, right, from, to,
var from, to,
left = '',
right = '',
keysPanel = '<div id="js-keyspanel" class="{{ className }}',
isOnePanel = config('onePanelMode'),
data = options.data,
panel = options.panel;
@ -75,15 +78,23 @@
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, {
side : 'left',
content : panel
side : 'left',
content : panel,
className : !isOnePanel ? '' : 'panel-single'
});
right = rendy(Template.panel, {
side : 'right',
content : panel
});
if (!isOnePanel)
right = rendy(Template.panel, {
side : 'right',
content : panel,
className : ''
});
data = rendy(data, {
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
--html-dialogs use html dialogs
--open open web browser when server started
--one-panel-mode set one panel mode
--no-auth disable authorization
--no-server do not start 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-progress do not show progress of file operations
--no-html-dialogs do not use html dialogs
--no-one-panel-mode unset one panel mode
.SH RESOURCES AND DOCUMENTATION

View file

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