Skip to content

Commit

Permalink
Merge pull request #215 from CodeForCharlotte/feature_approvaltweaks
Browse files Browse the repository at this point in the history
Make "review" button appear on household list if you are a nomination…
  • Loading branch information
AndrewNatoli authored Oct 11, 2018
2 parents d071bc7 + 11851a8 commit 139fa27
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class FeedbackModal extends React.Component {
reason,
message
});

this.handleClose({ approved, reason, message, reviewed: true });
} catch (error) {
alert('Could not review household. Please try again later.');
} finally {
this.handleClose({ approved, reason, message, reviewed: true });
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ import List from './list';
import { Row, Col } from 'react-bootstrap';
import Box from '../components/box';
import { FeedbackModal } from './components/FeedbackModal';
import { pathOr } from 'ramda';

export default class HouseholdIndex extends React.Component {
constructor(props) {
super(props);
this.state = { householdInReview: null, listPageNumber: null };
this.state = { householdInReview: null };
}

getCurrentPageNumber = () => {
const qs = querystring.parse();
return pathOr(1, ['page'], qs);
};

openHouseholdReview = (householdInReview, listPageNumber) => {
console.log('hm', householdInReview, 'd', listPageNumber);
this.setState({ householdInReview, listPageNumber });
this.setState({ householdInReview });
};

closeHouseholdReview = () => {
this.setState({ householdInReview: null, listPageNumber: null });
this.listComponent.handlePageChange(this.state.listPageNumber);
this.setState({ householdInReview: null });
this.listComponent.handlePageChange(this.getCurrentPageNumber());
};

render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import DataTable from '../components/dataTable';
import { TableHeaderColumn } from 'react-bootstrap-table';
import { path } from 'ramda';

import { Link } from 'react-router-dom';
import styled from 'styled-components';
Expand Down Expand Up @@ -175,8 +176,7 @@ export default class List extends React.Component {
dataFormat={this.actionCellFormatter.bind(this)}>
Actions
</TableHeaderColumn>
{user &&
user.role === 'admin' && (
{path(['claims', 'nominations', 'admin'], user) === true && (
<TableHeaderColumn
tdStyle={TD_STYLE_SMALL}
thStyle={TD_STYLE_SMALL}
Expand Down

0 comments on commit 139fa27

Please sign in to comment.