Skip to content

Commit 720dc8c

Browse files
author
Martin Krulis
committed
Final polishing, font-awesome update, and updating locales.
1 parent e554274 commit 720dc8c

File tree

11 files changed

+95
-74
lines changed

11 files changed

+95
-74
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
},
2727
"dependencies": {
2828
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
29-
"@fortawesome/fontawesome-free": "^5.8.2",
30-
"@fortawesome/fontawesome-svg-core": "^1.2.18",
31-
"@fortawesome/free-brands-svg-icons": "^5.8.2",
32-
"@fortawesome/free-regular-svg-icons": "^5.8.2",
33-
"@fortawesome/free-solid-svg-icons": "^5.8.2",
29+
"@fortawesome/fontawesome-free": "^5.9.0",
30+
"@fortawesome/fontawesome-svg-core": "^1.2.19",
31+
"@fortawesome/free-brands-svg-icons": "^5.9.0",
32+
"@fortawesome/free-regular-svg-icons": "^5.9.0",
33+
"@fortawesome/free-solid-svg-icons": "^5.9.0",
3434
"@fortawesome/react-fontawesome": "^0.1.4",
3535
"@iktakahiro/markdown-it-katex": "^3.0.3",
3636
"admin-lte": "2.3.11",

src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import ImmutablePropTypes from 'react-immutable-proptypes';
44
import { Table } from 'react-bootstrap';
5-
import { FormattedMessage, injectIntl } from 'react-intl';
5+
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
66
import { EMPTY_LIST, EMPTY_OBJ, EMPTY_ARRAY } from '../../../../helpers/common';
77

88
import { isReady, isLoading, getJsData } from '../../../../redux/helpers/resourceManager';
@@ -117,7 +117,7 @@ AssignmentsTable.propTypes = {
117117
showNames: PropTypes.bool,
118118
showGroups: PropTypes.bool,
119119
groupsAccessor: PropTypes.func,
120-
intl: PropTypes.shape({ locale: PropTypes.string.isRequired }).isRequired,
120+
intl: intlShape.isRequired,
121121
};
122122

123123
export default injectIntl(AssignmentsTable);

src/components/Groups/MakeGroupAdminButton/MakeGroupAdminButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Icon from '../../icons';
77
const MakeGroupAdminButton = ({ onClick, ...props }) => (
88
<Button {...props} onClick={onClick} bsStyle="success" className="btn-flat">
99
<Icon icon="user-secret" gapRight />
10-
<FormattedMessage id="app.groups.makeGroupAdminButton" defaultMessage="Make group admin" />
10+
<FormattedMessage id="app.groups.makeGroupAdminButton" defaultMessage="Promote to group admin" />
1111
</Button>
1212
);
1313

src/components/Groups/RemoveGroupAdminButton/RemoveGroupAdminButton.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { FormattedMessage } from 'react-intl';
44
import Button from '../../widgets/FlatButton';
5-
import Icon from '../../icons';
5+
import { UserIcon } from '../../icons';
66

77
const RemoveGroupAdminButton = ({ onClick, ...props }) => (
88
<Button {...props} onClick={onClick} bsStyle="danger" className="btn-flat">
9-
<Icon icon="user-secret" gapRight />
10-
<FormattedMessage id="app.groups.removeGroupAdminButton" defaultMessage="Remove group admin" />
9+
<UserIcon gapRight />
10+
<FormattedMessage id="app.groups.removeGroupAdminButton" defaultMessage="Suspend to supervisor" />
1111
</Button>
1212
);
1313

src/components/Users/SupervisorsListItem/SupervisorsListItem.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
4+
45
import MakeRemoveSupervisorButtonContainer from '../../../containers/MakeRemoveSupervisorButtonContainer';
56
import MakeGroupAdminButton from '../../Groups/MakeGroupAdminButton';
67
import RemoveGroupAdminButton from '../../Groups/RemoveGroupAdminButton';
78
import { addAdmin, removeAdmin } from '../../../redux/modules/groups';
89
import { adminsOfGroup } from '../../../redux/selectors/groups';
910
import UsersNameContainer from '../../../containers/UsersNameContainer';
11+
import Icon, { UserIcon } from '../../icons';
1012

1113
const SupervisorsListItem = ({
1214
isAdmin,
@@ -17,26 +19,31 @@ const SupervisorsListItem = ({
1719
addAdmin,
1820
removeAdmin,
1921
primaryAdminsIds,
20-
}) => (
21-
<tr>
22-
<td>
23-
<UsersNameContainer userId={id} />
24-
</td>
25-
{isAdmin && (
26-
<td className="text-right text-nowrap">
27-
{primaryAdminsIds.indexOf(id) < 0 && (
28-
<div>
29-
<MakeRemoveSupervisorButtonContainer userId={id} groupId={groupId} />
30-
<MakeGroupAdminButton onClick={() => addAdmin(groupId, id)} bsSize="xs" />
31-
</div>
32-
)}
33-
{primaryAdminsIds.indexOf(id) >= 0 && (
34-
<RemoveGroupAdminButton onClick={() => removeAdmin(groupId, id)} bsSize="xs" />
35-
)}
22+
}) => {
23+
const isGroupAdmin = primaryAdminsIds.includes(id);
24+
return (
25+
<tr>
26+
<td className="shrink-col">
27+
{isGroupAdmin ? <Icon icon="user-secret" gapRight gapLeft /> : <UserIcon gapRight gapLeft />}
28+
</td>
29+
<td className="shrink-col text-nowrap">
30+
<UsersNameContainer userId={id} />
3631
</td>
37-
)}
38-
</tr>
39-
);
32+
{isAdmin && (
33+
<td className="text-right">
34+
{isGroupAdmin ? (
35+
<RemoveGroupAdminButton onClick={() => removeAdmin(groupId, id)} bsSize="xs" />
36+
) : (
37+
<React.Fragment>
38+
<MakeRemoveSupervisorButtonContainer userId={id} groupId={groupId} />
39+
<MakeGroupAdminButton onClick={() => addAdmin(groupId, id)} bsSize="xs" />
40+
</React.Fragment>
41+
)}
42+
</td>
43+
)}
44+
</tr>
45+
);
46+
};
4047

4148
SupervisorsListItem.propTypes = {
4249
id: PropTypes.string.isRequired,

src/containers/MakeRemoveSupervisorButtonContainer/MakeRemoveSupervisorButtonContainer.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
4+
import { injectIntl, intlShape } from 'react-intl';
5+
46
import { makeSupervisor, removeSupervisor } from '../../redux/modules/groups';
57
import { fetchUserIfNeeded } from '../../redux/modules/users';
68
import { isSupervisorOf } from '../../redux/selectors/users';
@@ -9,9 +11,9 @@ import MakeSupervisorButton from '../../components/Groups/MakeSupervisorButton';
911
import RemoveSupervisorButton from '../../components/Groups/RemoveSupervisorButton';
1012

1113
const MakeRemoveSupervisorButtonContainer = ({
12-
isSupervisor,
1314
userId,
1415
groupId,
16+
isSupervisor,
1517
makeSupervisor,
1618
removeSupervisor,
1719
fetchUserIfNeeded,
@@ -36,6 +38,7 @@ MakeRemoveSupervisorButtonContainer.propTypes = {
3638
makeSupervisor: PropTypes.func.isRequired,
3739
removeSupervisor: PropTypes.func.isRequired,
3840
fetchUserIfNeeded: PropTypes.func.isRequired,
41+
intl: intlShape.isRequired,
3942
};
4043

4144
const mapStateToProps = (state, { groupId, userId }) => ({
@@ -48,7 +51,9 @@ const mapDispatchToProps = {
4851
fetchUserIfNeeded,
4952
};
5053

51-
export default connect(
52-
mapStateToProps,
53-
mapDispatchToProps
54-
)(MakeRemoveSupervisorButtonContainer);
54+
export default injectIntl(
55+
connect(
56+
mapStateToProps,
57+
mapDispatchToProps
58+
)(MakeRemoveSupervisorButtonContainer)
59+
);

src/locales/cs.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@
428428
"app.editSystemMessageForm.validation.visibleFromBeforeTo": "Počáteční datum nemůže být déle než koncové datum.",
429429
"app.editSystemMessageForm.validation.visibleFromEmpty": "Počáteční datum nemůže být prázdné.",
430430
"app.editSystemMessageForm.validation.visibleToEmpty": "Koncové datum nemůže být prázdné.",
431-
"app.editSystemMessageForm.validation.visibleToInHistory": "Koncové datum nemůže být v minulosti.",
432431
"app.editSystemMessageForm.visibleFrom": "Počáteční datum od kterého jsou systémové zprávy viditelné.",
433432
"app.editSystemMessageForm.visibleTo": "Koncové datum do kterého jsou systémové zprávy viditelné.",
434433
"app.editTestsForm.isUniform": "Použít rovnoměrné rozdělení bodů mezi testy.",
@@ -794,10 +793,10 @@
794793
"app.groupTree.treeViewLeaf.publicTooltip": "Skupina je veřejná",
795794
"app.groups.joinGroupButton": "Stát se členem",
796795
"app.groups.leaveGroupButton": "Opustit skupinu",
797-
"app.groups.makeGroupAdminButton": "Změnit na správce skupiny",
796+
"app.groups.makeGroupAdminButton": "Povýšit na správce skupiny",
798797
"app.groups.makeSupervisorButton": "Přidat vedoucího",
799798
"app.groups.removeFromGroup": "Odebrat ze skupiny",
800-
"app.groups.removeGroupAdminButton": "Odebrat skupinového admina",
799+
"app.groups.removeGroupAdminButton": "Suspendovat na vedoucího",
801800
"app.groups.removeSupervisorButton": "Odebrat vedoucího",
802801
"app.hardwareGroupMetadata.cpuTimeOverlay": "Omezení přesného (CPU) časového limitu",
803802
"app.hardwareGroupMetadata.description": "Interní popis:",
@@ -1225,6 +1224,7 @@
12251224
"app.supplementaryFiles.deleteConfirm": "Opravdu si přejete tento soubor smazat? Tato operace nemůže být vrácena.",
12261225
"app.supplementaryFilesTable.description": "Soubory úlohy jsou soubory, které mohou být použity v nastavení úlohy (jako vstupní soubory, vzorové výstupní soubory, přídavné soubory pro kompilaci, vlastní sudí, ...).",
12271226
"app.supplementaryFilesTable.title": "Soubory úlohy",
1227+
"app.systemMessages.acceptActiveMessages": "Schovat zprávy (označit jako přečtené)",
12281228
"app.systemMessages.description": "Prohlížení a úprava systémových zpráv",
12291229
"app.systemMessages.failed": "Nepodařilo se načíst seznam systémových zpráv",
12301230
"app.systemMessages.failedDescription": "Omlouváme se za způsobené problémy, prosíme zkuste to později znovu.",
@@ -1233,6 +1233,8 @@
12331233
"app.systemMessages.loadingDescription": "Prosíme počkejte než bude seznam systémových zpráv připraven.",
12341234
"app.systemMessages.newSystemMessage": "Nová systémová zpráva",
12351235
"app.systemMessages.title": "Systémové zprávy",
1236+
"app.systemMessages.titleLong": "Máte {totalMessagesCount, number} {totalMessagesCount, plural, one {aktivní zprávu} =2 {aktivní zprávy} =3 {aktivní zprávy} =4 {aktivní zprávy} other {aktivních zpráv}} (z toho {unreadCount, number} {unreadCount, plural, one {nepřečtenou} =2 {nepřečtené} =3 {nepřečtené} =4 {nepřečtené} other {nepřečtených}})",
1237+
"app.systemMessages.unacceptActiveMessages": "Zobrazit všechny zprávy (označit jako nepřečtené)",
12361238
"app.systemMessagesList.noMessages": "Nyní zde nejsou žádné systémové zprávy.",
12371239
"app.systemMessagesList.role": "Role",
12381240
"app.systemMessagesList.showAll": "Zobrazit všechny zprávy (včetně expirovaných)",
@@ -1329,4 +1331,4 @@
13291331
"recodex-judge-shuffle-all": "Sudí neuspořádaných tokenů a řádků",
13301332
"recodex-judge-shuffle-newline": "Sudí neuspořádaných tokenů (ignorující konce řádků)",
13311333
"recodex-judge-shuffle-rows": "Sudí neuspořádaných řádků"
1332-
}
1334+
}

src/locales/en.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@
428428
"app.editSystemMessageForm.validation.visibleFromBeforeTo": "The visible from date cannot be after visible to date.",
429429
"app.editSystemMessageForm.validation.visibleFromEmpty": "The visible from date must be set.",
430430
"app.editSystemMessageForm.validation.visibleToEmpty": "The visible to date must be set.",
431-
"app.editSystemMessageForm.validation.visibleToInHistory": "The visible to date cannot be in the past.",
432431
"app.editSystemMessageForm.visibleFrom": "Date from which is notification visible.",
433432
"app.editSystemMessageForm.visibleTo": "Date to which is notification visible.",
434433
"app.editTestsForm.isUniform": "Using uniform point distribution for all tests",
@@ -794,10 +793,10 @@
794793
"app.groupTree.treeViewLeaf.publicTooltip": "The group is public",
795794
"app.groups.joinGroupButton": "Join group",
796795
"app.groups.leaveGroupButton": "Leave group",
797-
"app.groups.makeGroupAdminButton": "Make group admin",
796+
"app.groups.makeGroupAdminButton": "Promote to group admin",
798797
"app.groups.makeSupervisorButton": "Make supervisor",
799798
"app.groups.removeFromGroup": "Remove from group",
800-
"app.groups.removeGroupAdminButton": "Remove group admin",
799+
"app.groups.removeGroupAdminButton": "Suspend to supervisor",
801800
"app.groups.removeSupervisorButton": "Remove supervisor",
802801
"app.hardwareGroupMetadata.cpuTimeOverlay": "Precise (CPU) time limit constraints",
803802
"app.hardwareGroupMetadata.description": "Internal Description:",
@@ -1225,6 +1224,7 @@
12251224
"app.supplementaryFiles.deleteConfirm": "Are you sure you want to delete the file? This cannot be undone.",
12261225
"app.supplementaryFilesTable.description": "Supplementary files are files which can be used in exercise configuration (as input files, expected output files, extra compilation files, custom judges, ...).",
12271226
"app.supplementaryFilesTable.title": "Supplementary Files",
1227+
"app.systemMessages.acceptActiveMessages": "Hide messages (mark them as read)",
12281228
"app.systemMessages.description": "Browse and manage all system messages",
12291229
"app.systemMessages.failed": "Cannot load the list of system messages",
12301230
"app.systemMessages.failedDescription": "We are sorry for the inconvenience, please try again later.",
@@ -1233,6 +1233,8 @@
12331233
"app.systemMessages.loadingDescription": "Please wait while we are getting the list of all system messages ready.",
12341234
"app.systemMessages.newSystemMessage": "New System Message",
12351235
"app.systemMessages.title": "System Messages",
1236+
"app.systemMessages.titleLong": "You have {totalMessagesCount, number} active {totalMessagesCount, plural, one {message} two {messages} other {messages}} ({unreadCount, number} unread {unreadCount, plural, one {message} two {messages} other {messages}})",
1237+
"app.systemMessages.unacceptActiveMessages": "Show all messages (mark them as unread)",
12361238
"app.systemMessagesList.noMessages": "There are currently no system messages.",
12371239
"app.systemMessagesList.role": "Role",
12381240
"app.systemMessagesList.showAll": "Show all messages (including expired)",

src/locales/whitelist_en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@
428428
"app.editSystemMessageForm.validation.visibleFromBeforeTo",
429429
"app.editSystemMessageForm.validation.visibleFromEmpty",
430430
"app.editSystemMessageForm.validation.visibleToEmpty",
431-
"app.editSystemMessageForm.validation.visibleToInHistory",
432431
"app.editSystemMessageForm.visibleFrom",
433432
"app.editSystemMessageForm.visibleTo",
434433
"app.editTestsForm.isUniform",
@@ -1225,6 +1224,7 @@
12251224
"app.supplementaryFiles.deleteConfirm",
12261225
"app.supplementaryFilesTable.description",
12271226
"app.supplementaryFilesTable.title",
1227+
"app.systemMessages.acceptActiveMessages",
12281228
"app.systemMessages.description",
12291229
"app.systemMessages.failed",
12301230
"app.systemMessages.failedDescription",
@@ -1233,6 +1233,8 @@
12331233
"app.systemMessages.loadingDescription",
12341234
"app.systemMessages.newSystemMessage",
12351235
"app.systemMessages.title",
1236+
"app.systemMessages.titleLong",
1237+
"app.systemMessages.unacceptActiveMessages",
12361238
"app.systemMessagesList.noMessages",
12371239
"app.systemMessagesList.role",
12381240
"app.systemMessagesList.showAll",

src/pages/GroupInfo/GroupInfo.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import EditGroupForm, { EDIT_GROUP_FORM_EMPTY_INITIAL_VALUES } from '../../compo
3232
import AddSupervisor from '../../components/Groups/AddSupervisor';
3333
import GroupTopButtons from '../../components/Groups/GroupTopButtons/GroupTopButtons';
3434
import { BanIcon } from '../../components/icons';
35-
import { hasPermissions } from '../../helpers/common';
35+
import { hasPermissions, safeGet } from '../../helpers/common';
3636
import GroupArchivedWarning from '../../components/Groups/GroupArchivedWarning/GroupArchivedWarning';
3737

3838
class GroupInfo extends Component {
@@ -57,7 +57,7 @@ class GroupInfo extends Component {
5757
if (isReady(this.props.group) && isReady(prevProps.group)) {
5858
const newData = this.props.group.toJS().data.privateData;
5959
const prevData = prevProps.group.toJS().data.privateData;
60-
if (prevData.supervisors.length !== newData.supervisors.length) {
60+
if (safeGet(prevData, ['supervisors', 'length'], -1) !== safeGet(newData, ['supervisors', 'length'], -1)) {
6161
this.props.refetchSupervisors();
6262
}
6363
}
@@ -73,7 +73,10 @@ class GroupInfo extends Component {
7373
resource: group,
7474
iconName: 'university',
7575
breadcrumb: data => ({
76-
link: ({ INSTANCE_URI_FACTORY }) => INSTANCE_URI_FACTORY(data.privateData.instanceId),
76+
link:
77+
data && data.privateData
78+
? ({ INSTANCE_URI_FACTORY }) => INSTANCE_URI_FACTORY(data.privateData.instanceId)
79+
: undefined,
7780
text: 'Instance',
7881
}),
7982
},

0 commit comments

Comments
 (0)