use the child components

This commit is contained in:
Erik Jan de Wit 2020-04-16 12:17:05 +02:00 committed by Stan Silvert
parent 3987ce7d94
commit 4fa29948b6
2 changed files with 12 additions and 9 deletions

View file

@ -35,9 +35,8 @@ resourceName=Resource Name
nextPage=Next nextPage=Next
previousPage=Previous previousPage=Previous
firstPage=First Page firstPage=First Page
resourceSharedWith=Resource is shared with resourceSharedWith=Resource is shared with {0}
and=and and= and {0} other users
otherUsers=other users
add=Add add=Add
shareSuccess=Resource successfully shared. shareSuccess=Resource successfully shared.
resourceAlreadyShared=Resource is already shared with this user. resourceAlreadyShared=Resource is already shared with this user.

View file

@ -98,12 +98,16 @@ export class ResourcesTable extends React.Component<ResourcesTableProps, Resourc
public sharedWithUsersMessage(row: number): React.ReactNode { public sharedWithUsersMessage(row: number): React.ReactNode {
if (!this.hasPermissions(row)) return (<React.Fragment><Msg msgKey='resourceNotShared'/></React.Fragment>); if (!this.hasPermissions(row)) return (<React.Fragment><Msg msgKey='resourceNotShared'/></React.Fragment>);
// TODO: Not using a parameterized message because I want to use <strong> tag. Need to figure out a good solution to this. return (
if (this.numOthers(row) > 0) { <React.Fragment>
return (<React.Fragment><Msg msgKey='resourceSharedWith'/> <strong>{this.firstUser(row)}</strong> <Msg msgKey='and'/> <strong>{this.numOthers(row)}</strong> <Msg msgKey='otherUsers'/>.</React.Fragment>) <Msg msgKey='resourceSharedWith'>
} else { <strong>{this.firstUser(row)}</strong>
return (<React.Fragment><Msg msgKey='resourceSharedWith'/> <strong>{this.firstUser(row)}</strong>.</React.Fragment>) </Msg>
} {this.numOthers(row) > 0 && <Msg msgKey='and'>
<strong>{this.numOthers(row)}</strong>
</Msg>}.
</React.Fragment>
);
} }
public render(): React.ReactNode { public render(): React.ReactNode {