Web: Files: Home: Added setting default name on create elements, added translations
This commit is contained in:
parent
4307852b3d
commit
d38fb15fe4
@ -16,7 +16,11 @@ class FilesRowContent extends React.PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const titleWithoutExt = getTitleWithoutExst(props.item);
|
||||
let titleWithoutExt = getTitleWithoutExst(props.item);
|
||||
|
||||
if (props.fileAction.id === -1) {
|
||||
titleWithoutExt = this.getDefaultName(props.fileAction.extension);
|
||||
}
|
||||
|
||||
this.state = {
|
||||
itemTitle: titleWithoutExt,
|
||||
@ -140,6 +144,21 @@ class FilesRowContent extends React.PureComponent {
|
||||
return `${title}: ${dateLabel}`;
|
||||
};
|
||||
|
||||
getDefaultName = (format) => {
|
||||
const { t } = this.props;
|
||||
|
||||
switch (format) {
|
||||
case 'docx':
|
||||
return t("NewDocument");
|
||||
case 'xlsx':
|
||||
return t("NewSpreadsheet");
|
||||
case 'pptx':
|
||||
return t("NewPresentation");
|
||||
default:
|
||||
return t("NewFolder");
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { t, item, fileAction } = this.props;
|
||||
const { itemTitle, editingId, loading } = this.state;
|
||||
|
Loading…
Reference in New Issue
Block a user