summaryrefslogtreecommitdiffstats
path: root/web/react/components/setting_upload.jsx
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-08-21 00:54:35 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-08-21 18:15:02 +0500
commitafb09a1b9dd83e480a8c4f5744bd79cafb88a682 (patch)
treef4565c10d1c6cc3fb8af4e3e13db09334d4eb43f /web/react/components/setting_upload.jsx
parent08941cf554bc88ca95f933cd2831fd6c6f2d49e9 (diff)
downloadchat-afb09a1b9dd83e480a8c4f5744bd79cafb88a682.tar.gz
chat-afb09a1b9dd83e480a8c4f5744bd79cafb88a682.tar.bz2
chat-afb09a1b9dd83e480a8c4f5744bd79cafb88a682.zip
MM-1696 - Improvements for Slack Import
Diffstat (limited to 'web/react/components/setting_upload.jsx')
-rw-r--r--web/react/components/setting_upload.jsx28
1 files changed, 23 insertions, 5 deletions
diff --git a/web/react/components/setting_upload.jsx b/web/react/components/setting_upload.jsx
index 870710850..02789f5dd 100644
--- a/web/react/components/setting_upload.jsx
+++ b/web/react/components/setting_upload.jsx
@@ -46,17 +46,25 @@ module.exports = React.createClass({
serverError: ''
});
},
+ onFileSelect: function(e) {
+ var filename = $(e.target).val();
+ if (filename.substring(3, 11) === 'fakepath') {
+ filename = filename.substring(12);
+ }
+ $(e.target).closest('li').find('.file-status').addClass('hide');
+ $(e.target).closest('li').find('.file-name').removeClass('hide').html(filename);
+ },
render: function() {
var clientError = null;
if (this.state.clientError) {
clientError = (
- <div className='form-group has-error'><label className='control-label'>{this.state.clientError}</label></div>
+ <div className='file-status'>{this.state.clientError}</div>
);
}
var serverError = null;
if (this.state.serverError) {
serverError = (
- <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>
+ <div className='file-status'>{this.state.serverError}</div>
);
}
return (
@@ -65,11 +73,21 @@ module.exports = React.createClass({
<li className='col-xs-offset-3 col-xs-8'>
<ul className='setting-list'>
<li className='setting-list-item'>
+ <span className='btn btn-sm btn-primary btn-file sel-btn'>Select file<input ref='uploadinput' accept={this.props.fileTypesAccepted} type='file' onChange={this.onFileSelect}/></span>
+ <a
+ className={'btn btn-sm btn-primary'}
+ onClick={this.doSubmit}>
+ Import
+ </a>
+ <a
+ className='btn btn-sm btn-link theme'
+ href='#'
+ onClick={this.doCancel}>
+ Cancel
+ </a>
+ <div className='file-status file-name hide'></div>
{serverError}
{clientError}
- <span className='btn btn-sm btn-primary btn-file sel-btn'>SelectFile<input ref='uploadinput' accept={this.props.fileTypesAccepted} type='file' onChange={this.onFileSelect}/></span>
- <a className={'btn btn-sm btn-primary'} onClick={this.doSubmit}>Import</a>
- <a className='btn btn-sm theme' href='#' onClick={this.doCancel}>Cancel</a>
</li>
</ul>
</li>