Don't allow dialogs' inputs to be empty, show an error in that case
This commit is contained in:
parent
a88ff826e7
commit
ccf24e513b
@ -31593,6 +31593,7 @@ var _store = require('store');
|
|||||||
var _store2 = _interopRequireDefault(_store);
|
var _store2 = _interopRequireDefault(_store);
|
||||||
|
|
||||||
var INVALID_NAME = 'Please enter a valid name.';
|
var INVALID_NAME = 'Please enter a valid name.';
|
||||||
|
var INVALID_SEARCH = 'You can\'t leave the input empty';
|
||||||
|
|
||||||
exports['default'] = {
|
exports['default'] = {
|
||||||
createDialog: {
|
createDialog: {
|
||||||
@ -31604,7 +31605,12 @@ exports['default'] = {
|
|||||||
action: function action() {
|
action: function action() {
|
||||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
if (!input.value) {
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var cwd = _store2['default'].getState().get('cwd');
|
var cwd = _store2['default'].getState().get('cwd');
|
||||||
var path = cwd + '/' + input.value;
|
var path = cwd + '/' + input.value;
|
||||||
@ -31619,7 +31625,12 @@ exports['default'] = {
|
|||||||
action: function action() {
|
action: function action() {
|
||||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
if (!input.value) {
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var cwd = _store2['default'].getState().get('cwd');
|
var cwd = _store2['default'].getState().get('cwd');
|
||||||
var path = cwd + '/' + input.value;
|
var path = cwd + '/' + input.value;
|
||||||
@ -31654,7 +31665,12 @@ exports['default'] = {
|
|||||||
action: function action() {
|
action: function action() {
|
||||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
if (!input.value) {
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var activeFile = _store2['default'].getState().get('activeFile');
|
var activeFile = _store2['default'].getState().get('activeFile');
|
||||||
this.props.dispatch((0, _actionsFile.rename)(activeFile, input.value));
|
this.props.dispatch((0, _actionsFile.rename)(activeFile, input.value));
|
||||||
@ -31705,7 +31721,12 @@ exports['default'] = {
|
|||||||
action: function action() {
|
action: function action() {
|
||||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
if (!input.value) {
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_SEARCH }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var action = (0, _actionsFilesView.search)(input.value);
|
var action = (0, _actionsFilesView.search)(input.value);
|
||||||
this.props.dispatch(action);
|
this.props.dispatch(action);
|
||||||
|
@ -5,6 +5,7 @@ import { search } from 'actions/files-view';
|
|||||||
import store, { bind } from 'store';
|
import store, { bind } from 'store';
|
||||||
|
|
||||||
const INVALID_NAME = 'Please enter a valid name.';
|
const INVALID_NAME = 'Please enter a valid name.';
|
||||||
|
const INVALID_SEARCH = 'You can\'t leave the input empty';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
createDialog: {
|
createDialog: {
|
||||||
@ -17,7 +18,12 @@ export default {
|
|||||||
action() {
|
action() {
|
||||||
let input = React.findDOMNode(this.refs.input);
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
if (!input.value) {
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let cwd = store.getState().get('cwd');
|
let cwd = store.getState().get('cwd');
|
||||||
let path = cwd + '/' + input.value;
|
let path = cwd + '/' + input.value;
|
||||||
@ -33,7 +39,12 @@ export default {
|
|||||||
action() {
|
action() {
|
||||||
let input = React.findDOMNode(this.refs.input);
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
if (!input.value) {
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let cwd = store.getState().get('cwd');
|
let cwd = store.getState().get('cwd');
|
||||||
let path = cwd + '/' + input.value;
|
let path = cwd + '/' + input.value;
|
||||||
@ -72,7 +83,12 @@ export default {
|
|||||||
action() {
|
action() {
|
||||||
let input = React.findDOMNode(this.refs.input);
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
if (!input.value) {
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let activeFile = store.getState().get('activeFile');
|
let activeFile = store.getState().get('activeFile');
|
||||||
this.props.dispatch(rename(activeFile, input.value))
|
this.props.dispatch(rename(activeFile, input.value))
|
||||||
@ -129,7 +145,12 @@ export default {
|
|||||||
action() {
|
action() {
|
||||||
let input = React.findDOMNode(this.refs.input);
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
|
||||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
if (!input.value) {
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
this.props.dispatch(show('errorDialog', {description: INVALID_SEARCH}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let action = search(input.value);
|
let action = search(input.value);
|
||||||
this.props.dispatch(action);
|
this.props.dispatch(action);
|
||||||
|
Loading…
Reference in New Issue
Block a user