Skip to content

Commit

Permalink
Merge branch 'main' into fixA11yLogoIssue
Browse files Browse the repository at this point in the history
  • Loading branch information
Molochem authored Jan 31, 2024
2 parents 7910ee7 + 4a0580a commit a4a654b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/volto/news/5549.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow editor to edit metadata during bulk upload. @iFlameing
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
Modal,
Table,
Segment,
Input,
} from 'semantic-ui-react';
import loadable from '@loadable/component';
import { concat, filter, map } from 'lodash';
Expand Down Expand Up @@ -149,7 +150,27 @@ class ContentsUploadModal extends Component {
}

/**
* Submit handler
* Name change handler
* @method onChangeFileName
* @returns {undefined}
*/

onChangeFileName(e, index) {
let copyOfFiles = [...this.state.files];
let originalFile = this.state.files[index];
let newFile = new File([originalFile], e.target.value, {
type: originalFile.type,
});
newFile.preview = originalFile.preview;
newFile.path = e.target.value;
copyOfFiles[index] = newFile;
this.setState({
files: copyOfFiles,
});
}

/**
* Submit handlers
* @method onSubmit
* @returns {undefined}
*/
Expand Down Expand Up @@ -186,7 +207,7 @@ class ContentsUploadModal extends Component {
render() {
return (
this.props.open && (
<Modal open={this.props.open}>
<Modal className="contents-upload-modal" open={this.props.open}>
<Header>
<FormattedMessage id="Upload files" defaultMessage="Upload files" />
</Header>
Expand Down Expand Up @@ -268,8 +289,14 @@ class ContentsUploadModal extends Component {
</Table.Header>
<Table.Body>
{map(this.state.files, (file, index) => (
<Table.Row className="upload-row" key={file.name}>
<Table.Cell>{file.name}</Table.Cell>
<Table.Row className="upload-row" key={index}>
<Table.Cell>
<Input
className="file-name"
value={file.name}
onChange={(e) => this.onChangeFileName(e, index)}
/>
</Table.Cell>
<Table.Cell>
{file.lastModifiedDate && (
<FormattedRelativeDate date={file.lastModifiedDate} />
Expand Down
11 changes: 11 additions & 0 deletions packages/volto/theme/themes/pastanaga/extras/contents.less
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,14 @@
align-items: center;
margin-top: 2rem;
}

/* Contents Upload Modal */
.contents-upload-modal {
.file-name {
width: 75%;

input {
padding: 0.67857143em 1em;
}
}
}

0 comments on commit a4a654b

Please sign in to comment.