Skip to content

Commit

Permalink
Fixing #207 in the context of the branch review
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-julien committed Sep 2, 2019
1 parent 46fc068 commit 2659d12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,17 @@ class TopMenuReports extends Component {
render={({ props }) => {
if (props && props.attributes) {
const reportClassesEdges = props.attributes.edges;
return reportClassesEdges.map(reportClassEdge => (
<Button
key={reportClassEdge.node.value}
component={Link}
to={`/dashboard/reports/${reportClassEdge.node.value.replace(
' ',
'_',
)}`}
variant={
location.pathname
=== `/dashboard/reports/${reportClassEdge.node.value.replace(
' ',
'_',
)}`
? 'contained'
: 'text'
}
size="small"
color={
location.pathname
=== `/dashboard/reports/${reportClassEdge.node.value.replace(
' ',
'_',
)}`
? 'primary'
: 'inherit'
}
classes={{ root: classes.button }}
>
{reportClassEdge.node.value}
</Button>
));
return reportClassesEdges.map((reportClassEdge) => {
const uri = reportClassEdge.node.value.replace(/\s/g, '_');
return <Button key={uri} component={Link}
to={`/dashboard/reports/${uri}`}
variant={ location.pathname === `/dashboard/reports/${uri}` ? 'contained' : 'text' }
size="small"
color={ location.pathname === `/dashboard/reports/${uri}` ? 'primary' : 'inherit' }
classes={{ root: classes.button }}>
{reportClassEdge.node.value}
</Button>;
});
}
return <span>&nbsp;</span>;
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ class Reports extends Component {
authorId,
reportClass:
reportClass !== 'all' && reportClass !== undefined
? reportClass.replace('_', ' ')
: '',
? reportClass.replace(/_/g, ' ') : '',
search: searchTerm,
orderBy: sortBy,
orderMode: orderAsc ? 'asc' : 'desc',
Expand Down

0 comments on commit 2659d12

Please sign in to comment.