Skip to content

Commit

Permalink
Rename additional files to attchment files (#147)
Browse files Browse the repository at this point in the history
* Renaming additional files to attachment files (part 1).

* Renaming file.

* Final renaming.
  • Loading branch information
Martin Kruliš authored and SemaiCZE committed Dec 7, 2017
1 parent 66b6ffb commit 1fa274f
Show file tree
Hide file tree
Showing 23 changed files with 173 additions and 173 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';

const AdditionalFilesTableHeaderRow = () =>
const AttachmentFilesTableHeaderRow = () =>
<tr>
<th>
<FormattedMessage
id="app.additionalFilesTable.fileName"
id="app.attachmentFilesTable.fileName"
defaultMessage="Original filename"
/>
</th>
<th>
<FormattedMessage
id="app.additionalFilesTable.url"
id="app.attachmentFilesTable.url"
defaultMessage="URL"
/>
</th>
<th>
<FormattedMessage
id="app.additionalFilesTable.fileSize"
id="app.attachmentFilesTable.fileSize"
defaultMessage="Filesize"
/>
</th>
<th>
<FormattedMessage
id="app.additionalFilesTable.fileUploadedAt"
id="app.attachmentFilesTable.fileUploadedAt"
defaultMessage="Uploaded at"
/>
</th>
<th />
</tr>;

export default AdditionalFilesTableHeaderRow;
export default AttachmentFilesTableHeaderRow;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Button } from 'react-bootstrap';
import Confirm from '../../../components/forms/Confirm';
import { DeleteIcon } from '../../../components/icons';

const AdditionalFilesTableRow = ({
const AttachmentFilesTableRow = ({
id,
name,
size,
Expand Down Expand Up @@ -39,7 +39,7 @@ const AdditionalFilesTableRow = ({
onConfirmed={() => removeFile(id)}
question={
<FormattedMessage
id="app.additionalFiles.deleteConfirm"
id="app.attachmentFiles.deleteConfirm"
defaultMessage="Are you sure you want to delete the file? This cannot be undone."
/>
}
Expand All @@ -48,15 +48,15 @@ const AdditionalFilesTableRow = ({
<Button bsSize="xs" className="btn-flat" bsStyle="danger">
<DeleteIcon />{' '}
<FormattedMessage
id="app.additionalFiles.deleteButton"
id="app.attachmentFiles.deleteButton"
defaultMessage="Delete"
/>
</Button>
</Confirm>}
</td>
</tr>;

AdditionalFilesTableRow.propTypes = {
AttachmentFilesTableRow.propTypes = {
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
Expand All @@ -65,4 +65,4 @@ AdditionalFilesTableRow.propTypes = {
removeFile: PropTypes.func
};

export default withLinks(AdditionalFilesTableRow);
export default withLinks(AttachmentFilesTableRow);
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { SendIcon } from '../../icons';
import UploadContainer from '../../../containers/UploadContainer';
import ResourceRenderer from '../../helpers/ResourceRenderer';

const AttachedFilesTable = ({
const FilesTable = ({
title = (
<FormattedMessage
id="app.attachedFilesTable.title"
id="app.filesTable.title"
defaultMessage="Attached files"
/>
),
Expand Down Expand Up @@ -47,7 +47,7 @@ const AttachedFilesTable = ({
>
<SendIcon />{' '}
<FormattedMessage
id="app.attachedFilesTable.addFiles"
id="app.filesTable.addFiles"
defaultMessage="Save files"
/>
</Button>
Expand Down Expand Up @@ -78,7 +78,7 @@ const AttachedFilesTable = ({
<p className="text-center">
<Icon name="folder-open-o" />{' '}
<FormattedMessage
id="app.attachedFilesTable.empty"
id="app.filesTable.empty"
defaultMessage="There are no uploaded files yet."
/>
</p>}
Expand All @@ -87,7 +87,7 @@ const AttachedFilesTable = ({
</div>
</Box>;

AttachedFilesTable.propTypes = {
FilesTable.propTypes = {
title: PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({ type: PropTypes.oneOf([FormattedMessage]) }),
Expand All @@ -110,4 +110,4 @@ AttachedFilesTable.propTypes = {
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired
};

export default injectIntl(AttachedFilesTable);
export default injectIntl(FilesTable);
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export default from './AttachedFilesTable';
export default from './FilesTable';

export {
default as SupplementaryFilesTableRow
} from './SupplementaryFilesTableRow';
export {
default as SupplementaryFilesTableHeaderRow
} from './SupplementaryFilesTableHeaderRow';
export { default as AdditionalFilesTableRow } from './AdditionalFilesTableRow';
export { default as AttachmentFilesTableRow } from './AttachmentFilesTableRow';
export {
default as AdditionalFilesTableHeaderRow
} from './AdditionalFilesTableHeaderRow';
default as AttachmentFilesTableHeaderRow
} from './AttachmentFilesTableHeaderRow';

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/containers/AttachedFilesTableContainer/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';

import FilesTableContainer from '../FilesTableContainer';
import {
AttachmentFilesTableRow,
AttachmentFilesTableHeaderRow
} from '../../components/Exercises/FilesTable';

import {
fetchAttachmentFiles,
addAttachmentFiles,
removeAttachmentFile
} from '../../redux/modules/attachmentFiles';

import { createGetAttachmentFiles } from '../../redux/selectors/attachmentFiles';

const AttachmentFilesTableContainer = ({
exercise,
attachmentFiles,
loadFiles,
addFiles,
removeFile
}) =>
<FilesTableContainer
uploadId={`attachment-exercise-files-${exercise.id}`}
attachments={attachmentFiles}
loadFiles={loadFiles}
addFiles={addFiles}
removeFile={removeFile}
title={
<FormattedMessage
id="app.attachmentFilesTable.title"
defaultMessage="Attached files"
/>
}
description={
<FormattedMessage
id="app.attachmentFilesTable.description"
defaultMessage="Attached files are files which can be used within exercise description using links provided below. Attached files can be viewed or downloaded by students."
/>
}
HeaderComponent={AttachmentFilesTableHeaderRow}
RowComponent={AttachmentFilesTableRow}
/>;

AttachmentFilesTableContainer.propTypes = {
exercise: PropTypes.shape({
id: PropTypes.string.isRequired,
attachmentFilesIds: PropTypes.array.isRequired
}).isRequired,
attachmentFiles: ImmutablePropTypes.map,
loadFiles: PropTypes.func.isRequired,
addFiles: PropTypes.func.isRequired,
removeFile: PropTypes.func.isRequired
};

export default connect(
(state, { exercise }) => {
const getAttachmentFiles = createGetAttachmentFiles(
exercise.attachmentFilesIds
);
return {
attachmentFiles: getAttachmentFiles(state)
};
},
(dispatch, { exercise }) => ({
loadFiles: () => dispatch(fetchAttachmentFiles(exercise.id)),
addFiles: files => dispatch(addAttachmentFiles(exercise.id, files)),
removeFile: id => dispatch(removeAttachmentFile(exercise.id, id))
})
)(AttachmentFilesTableContainer);
1 change: 1 addition & 0 deletions src/containers/AttachmentFilesTableContainer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from './AttachmentFilesTableContainer';
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { List } from 'immutable';

import AttachedFilesTable from '../../components/Exercises/AttachedFilesTable';
import FilesTable from '../../components/Exercises/FilesTable';

import { reset } from '../../redux/modules/upload';
import {
createGetUploadedFiles,
createAllUploaded
} from '../../redux/selectors/upload';

class AttachedFilesTableContainer extends Component {
class FilesTableContainer extends Component {
componentWillMount() {
AttachedFilesTableContainer.loadData(this.props);
FilesTableContainer.loadData(this.props);
}

componentWillReceiveProps(newProps) {
if (this.props.uploadId !== newProps.uploadId) {
AttachedFilesTableContainer.loadData(newProps);
FilesTableContainer.loadData(newProps);
}
}

static loadData = ({ loadFiles }) => {
loadFiles();
};

render = () => <AttachedFilesTable {...this.props} />;
render = () => <FilesTable {...this.props} />;
}

AttachedFilesTableContainer.propTypes = {
FilesTableContainer.propTypes = {
uploadId: PropTypes.string.isRequired,
attachments: ImmutablePropTypes.map,
newFiles: ImmutablePropTypes.list,
Expand All @@ -47,4 +47,4 @@ export default connect(
(dispatch, { uploadId, addFiles }) => ({
addFiles: files => addFiles(files.toJS()).then(dispatch(reset(uploadId)))
})
)(AttachedFilesTableContainer);
)(FilesTableContainer);
1 change: 1 addition & 0 deletions src/containers/FilesTableContainer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default from './FilesTableContainer';
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';

import AttachedFilesTableContainer from '../AttachedFilesTableContainer';
import FilesTableContainer from '../FilesTableContainer';
import {
SupplementaryFilesTableHeaderRow,
SupplementaryFilesTableRow
} from '../../components/Exercises/AttachedFilesTable';
} from '../../components/Exercises/FilesTable';

import {
fetchSupplementaryFilesForPipeline,
Expand All @@ -23,7 +23,7 @@ const PipelineFilesTableContainer = ({
loadFiles,
addFiles
}) =>
<AttachedFilesTableContainer
<FilesTableContainer
uploadId={`supplementary-files-${pipeline.id}`}
attachments={supplementaryFiles}
loadFiles={loadFiles}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { connect } from 'react-redux';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';

import AttachedFilesTableContainer from '../AttachedFilesTableContainer';
import FilesTableContainer from '../FilesTableContainer';
import {
SupplementaryFilesTableHeaderRow,
SupplementaryFilesTableRow
} from '../../components/Exercises/AttachedFilesTable';
} from '../../components/Exercises/FilesTable';

import {
fetchSupplementaryFilesForExercise,
Expand All @@ -27,7 +27,7 @@ const SupplementaryFilesTableContainer = ({
removeFile,
downloadFile
}) =>
<AttachedFilesTableContainer
<FilesTableContainer
uploadId={`supplementary-files-${exercise.id}`}
attachments={supplementaryFiles}
loadFiles={loadFiles}
Expand Down
Loading

0 comments on commit 1fa274f

Please sign in to comment.