Changed post drafts to maintain a store a unique id for each file upload to fix issues with duplicate file names

Этот коммит содержится в:
hmhealey
2015-08-10 12:05:45 -04:00
родитель 4b74c873cc
Коммит c9a1bf2d33
7 изменённых файлов: 79 добавлений и 58 удалений

Просмотреть файл

@@ -10,7 +10,12 @@ var Constants = require('../utils/constants.jsx');
module.exports = React.createClass({
handleRemove: function(e) {
var previewDiv = e.target.parentNode.parentNode;
this.props.onRemove(previewDiv.getAttribute('data-filename'));
if (previewDiv.hasAttribute('data-filename')) {
this.props.onRemove(previewDiv.getAttribute('data-filename'));
} else if (previewDiv.hasAttribute('data-client-id')) {
this.props.onRemove(previewDiv.getAttribute('data-client-id'));
}
},
render: function() {
var previews = [];
@@ -43,9 +48,9 @@ module.exports = React.createClass({
}
}.bind(this));
this.props.uploadsInProgress.forEach(function(filename) {
this.props.uploadsInProgress.forEach(function(clientId) {
previews.push(
<div className="preview-div" data-filename={filename}>
<div className="preview-div" data-client-id={clientId}>
<img className="spinner" src="/static/images/load.gif"/>
<a className="remove-preview" onClick={this.handleRemove}><i className="glyphicon glyphicon-remove"/></a>
</div>