diff --git a/HELP.md b/HELP.md index 22dd0dee..6fa0a008 100644 --- a/HELP.md +++ b/HELP.md @@ -74,6 +74,7 @@ Cloud Commander supports command line parameters: | `-p, --password` | set password | `-c, --config` | configuration file path | `--show-config` | show config values +| `--show-file-name` | show file name in view and edit | `--editor` | set editor: "dword", "edward" or "deepword" | `--packer` | set packer: "tar" or "zip" | `--root` | set root directory @@ -123,6 +124,7 @@ Cloud Commander supports command line parameters: | `--no-import` | disable import of config | `--no-import-listen` | disable listen on config updates from import server | `--no-log` | disable logging +| `--no-show-file-name` | do not show file name in view and edit 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. @@ -386,6 +388,7 @@ Here is description of options: "confirmCopy" : true, /* confirm copy */ "confirmMove" : true, /* confirm move */ "showConfig" : false, /* show config at startap */ + "showFileName" : false /* do not show file name in view and edit */ "contact" : true, /* enable contact */ "configDialog" : true, /* enable config dialog */ "console" : true, /* enable console */ @@ -426,6 +429,7 @@ Some config options can be overridden with `environment variables` such: - `CLOUDCMD_VIM` - enable vim hot keys - `CLOUDCMD_CONFIRM_COPY` - confirm copy - `CLOUDCMD_CONFIRM_MOVE` - confirm move +- `CLOUDCMD_SHOW_FILE_NAME` - show file name in view and edit - `CLOUDCMD_EXPORT` - enable export of config through a server - `CLOUDCMD_EXPORT_TOKEN` - authorization token used by export server - `CLOUDCMD_IMPORT` - enable import of config diff --git a/app.json b/app.json index 59a92d86..fa1a368f 100644 --- a/app.json +++ b/app.json @@ -112,6 +112,11 @@ "value": "true", "required": false }, + "CLOUDCMD_SHOW_FILE_NAME": { + "description": "show file name in view and edit", + "value": "false", + "required": false + }, "CLOUDCMD_EXPORT": { "description": "enable export of config through a server", "value": "false", diff --git a/bin/cloudcmd.js b/bin/cloudcmd.js index 4e9fb485..deb0f78a 100755 --- a/bin/cloudcmd.js +++ b/bin/cloudcmd.js @@ -56,6 +56,7 @@ const args = require('minimist')(argv.slice(2), { 'confirm-copy', 'confirm-move', 'show-config', + 'show-file-name', 'vim', 'keys-panel', 'color', @@ -90,6 +91,7 @@ const args = require('minimist')(argv.slice(2), { import : choose(env.bool('import'), config('import')), export : choose(env.bool('export'), config('export')), + 'show-file-name': choose(env.bool('show_file_name'), config('showFileName')), 'sync-console-path': choose(env.bool('sync_console_path'), config('syncConsolePath')), 'config-dialog': choose(env.bool('config_dialog'), config('configDialog')), 'terminal-path': env('terminal_path') || config('terminalPath'), @@ -137,6 +139,7 @@ function main() { config('progress', args.progress); config('console', args.console); config('syncConsolePath', args['sync-console-path']); + config('showFileName', args['show-file-name']); config('contact', args.contact); config('terminal', args.terminal); config('terminalPath', args['terminal-path']); diff --git a/client/modules/edit-file.js b/client/modules/edit-file.js index 01dc124e..7fe98965 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.js @@ -53,11 +53,14 @@ module.exports.show = (options) => { if (isLoading()) return; - const config = { + const optionsEdit = { ...ConfigView, ...options, }; + if (CloudCmd.config('showFileName')) + optionsEdit.title = Info.name; + Images.show.load(); CloudCmd.Edit @@ -79,7 +82,7 @@ module.exports.show = (options) => { .setModeForPath(name) .enableKey(); - CloudCmd.Edit.show(config); + CloudCmd.Edit.show(optionsEdit); }); return CloudCmd.Edit; diff --git a/client/modules/view.js b/client/modules/view.js index 3787be3a..d12b7d12 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -39,7 +39,7 @@ const basename = (a) => a.split('/').pop(); let El, TemplateAudio, Overlay; const Config = { - beforeShow: (callback) => { + beforeShow: function(callback) { Images.hide(); Key.unsetBind(); showOverlay(); @@ -72,7 +72,7 @@ const Config = { arrows : false, helpers : { overlay : null, - title : null + title : {}, } }; @@ -126,16 +126,7 @@ function show(data, options) { switch(type) { default: - return Info.getData((error, data) => { - if (error) - return Images.hide(); - - const element = document.createTextNode(data); - /* add margin only for view text documents */ - El.css('margin', '2%'); - - $.fancybox.open(El.append(element), Config); - }); + return showFile(); case 'image': return showImage(path, prefixUrl); @@ -169,6 +160,26 @@ function show(data, options) { } } +function showFile() { + Info.getData((error, data) => { + if (error) + return Images.hide(); + + const element = document.createTextNode(data); + /* add margin only for view text documents */ + El.css('margin', '2%'); + + const options = { + ...Config, + }; + + if (CloudCmd.config('showFileName')) + options.title = Info.name; + + $.fancybox.open(El.append(element), options); + }); +} + function initConfig(Config, options) { const config = Object.assign({}, Config); diff --git a/json/config.json b/json/config.json index 625f4a34..0bc70f29 100644 --- a/json/config.json +++ b/json/config.json @@ -28,6 +28,7 @@ "terminal": false, "terminalPath": "", "showConfig": false, + "showFileName": false, "vim": false, "columns": "name-size-date-owner-mode", "export": false, diff --git a/json/help.json b/json/help.json index 7bbb0121..3dcd7ada 100644 --- a/json/help.json +++ b/json/help.json @@ -8,6 +8,7 @@ "-p, --password ": "set password", "-c, --config ": "configuration file path", "--show-config ": "show config values", + "--show-file-name ": "show file name in view and edit", "--editor ": "set editor: \"dword\", \"edward\" or \"deepword\"", "--packer ": "set packer: \"tar\" or \"zip\"", "--root ": "set root directory", @@ -57,5 +58,6 @@ "--no-export ": "disable export config through a server", "--no-import ": "disable import of config", "--no-import-listen ": "disable listen on config updates from import server", - "--no-log ": "disable logging" + "--no-log ": "disable logging", + "--no-show-file-name ": "do not show file name in view and edit" } diff --git a/man/cloudcmd.1 b/man/cloudcmd.1 index 667953f2..0b8ef8b7 100644 --- a/man/cloudcmd.1 +++ b/man/cloudcmd.1 @@ -31,6 +31,7 @@ programs in browser from any computer, mobile or tablet device. -p, --password set password -c, --config configuration file path --show-config show config values + --show-file-name show file name in view and edit modes --editor set editor: "dword", "edward" or "deepword" --packer set packer: "tar" or "zip" --root set root directory @@ -81,6 +82,7 @@ programs in browser from any computer, mobile or tablet device. --no-import-url url of an import server --no-import-listen disable listen on config updates from import server --no-log disable logging + --no-show-file-name do not show file name in view and edit modes .SH RESOURCES AND DOCUMENTATION diff --git a/tmpl/config.hbs b/tmpl/config.hbs index c0997350..8acaa429 100644 --- a/tmpl/config.hbs +++ b/tmpl/config.hbs @@ -119,7 +119,7 @@ class="form-control">
  • -
  • +
  • + +