Merge branch 'feature/upload' of github.com:strapi/strapi into feature/upload

This commit is contained in:
Aurelsicoko 2018-03-05 18:40:57 +01:00
commit 670f1d8434
7 changed files with 21 additions and 2 deletions

View File

@ -5,6 +5,9 @@
"name": "<%= id %>",
"description": "<%= description %>"
},
"options": {
"timestamps": true
},
"attributes": {
<%= attributes %>
}

View File

@ -158,6 +158,8 @@ module.exports = function (strapi) {
});
});
collection.schema.set('timestamps', _.get(definition, 'options.timestamps') === true);
collection.schema.options.toObject = collection.schema.options.toJSON = {
virtuals: true,
transform: function (doc, returned, opts) {

View File

@ -126,7 +126,8 @@ class Edit extends React.PureComponent {
fileRelationAllowMultipleUpload = (relationName) => has(this.props.schema, ['relations', relationName, 'collection']);
orderAttributes = (displayedFields) => Object.keys(displayedFields).sort(name => Object.keys(this.getUploadRelations(this.props)).includes(name));
// orderAttributes = (displayedFields) => Object.keys(displayedFields).sort(name => Object.keys(this.getUploadRelations(this.props)).includes(name));
orderAttributes = (displayedFields) => Object.keys(displayedFields);
render(){
return (

View File

@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import cn from 'classnames';
import moment from 'moment';
import FileIcon from 'components/FileIcon';
import IcoContainer from 'components/IcoContainer';
@ -100,6 +101,12 @@ class Li extends React.Component {
<FileIcon fileType={item.ext} />
</div>
{['hash', 'name', 'updatedAt', 'size', 'relatedTo', ''].map((value, key) => {
if (value === 'updatedAt') {
return (
<div key={key} className={styles.truncate}>{moment(item[value]).format('YYYY/MM/DD - HH:mm')}</div>
);
}
if (value === 'size') {
const unit = this.getUnit(item[value]);

View File

@ -4,6 +4,9 @@
"name": "file",
"description": ""
},
"options": {
"timestamps": true
},
"attributes": {
"name": {
"type": "string",

View File

@ -48,4 +48,4 @@
"npm": ">= 3.0.0"
},
"license": "MIT"
}
}

View File

@ -4,6 +4,9 @@
"name": "user",
"description": ""
},
"options": {
"timestamps": true
},
"attributes": {
"username": {
"type": "string",