From 400f5c15bcbdae2aef1a4aa0ca5e518ebffc2ad7 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 29 May 2018 19:32:27 +0200 Subject: better the file the list --- public/bundle.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'public/bundle.js') diff --git a/public/bundle.js b/public/bundle.js index 2394646..b788ccc 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -599,7 +599,8 @@ var FileList = function (_Component) { var _props = this.props, files = _props.files, - linkFiles = _props.linkFiles; + linkFiles = _props.linkFiles, + _onClick = _props.onClick; var fileList = files.map(function (file) { return (0, _preact.h)( @@ -612,17 +613,23 @@ var FileList = function (_Component) { 'a', { target: '_blank', href: file.url }, file.name || file.url - ) : file.name || file.url + ) : (0, _preact.h)( + 'span', + { 'class': 'link', onClick: function onClick() { + return _onClick(file); + } }, + '(file.name || file.url)' + ) ), (0, _preact.h)( 'div', - { className: 'size' }, - file.size ? (file.size / 1024 / 1024).toFixed(1) + ' mb.' : '' + { className: 'date' }, + (0, _moment2.default)(file.created_at).format("YYYY-MM-DD h:mm a") ), (0, _preact.h)( 'div', - { className: 'date' }, - (0, _moment2.default)(file.created_at).format("YYYY-MM-DD h:mm a") + { className: 'size' }, + file.size ? (file.size / 1024 / 1024).toFixed(1) + ' mb.' : '' ), (0, _preact.h)( 'div', @@ -3551,6 +3558,7 @@ var SampleRNNDatasets = function (_Component) { _this.handleURL = _this.handleURL.bind(_this); _this.fetchURL = _this.fetchURL.bind(_this); _this.fileOptions = _this.fileOptions.bind(_this); + _this.pickFile = _this.pickFile.bind(_this); props.actions.folder.index({ module: 'samplernn' }); props.actions.file.index({ module: 'samplernn' }); return _this; @@ -3624,6 +3632,11 @@ var SampleRNNDatasets = function (_Component) { opt: { url: url } }, { preempt: true, watch: true }); } + }, { + key: 'pickFile', + value: function pickFile(file) { + console.log('pick', file); + } }, { key: 'fileOptions', value: function fileOptions(file) { @@ -3724,6 +3737,7 @@ var SampleRNNDatasets = function (_Component) { (0, _preact.h)(_fileList2.default, { files: samplernn.files, options: this.fileOptions, + onClick: this.pickFile, linkFiles: true }) ) -- cgit v1.2.3-70-g09d2