From 0783a15d71a0b59efaf4d56844a246a56335a528 Mon Sep 17 00:00:00 2001 From: Tomasz Knapik <tomasz.knapik@torchbox.com> Date: Tue, 12 Feb 2019 14:03:29 +0000 Subject: [PATCH] GH-983: Add changing a status --- opentech/apply/funds/api_views.py | 1 + .../src/app/src/components/Modal/index.js | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 opentech/static_src/src/app/src/components/Modal/index.js diff --git a/opentech/apply/funds/api_views.py b/opentech/apply/funds/api_views.py index f4017549d..05ebfec9d 100644 --- a/opentech/apply/funds/api_views.py +++ b/opentech/apply/funds/api_views.py @@ -1,4 +1,5 @@ from django.core.exceptions import PermissionDenied as DjangoPermissionDenied +from django.db import transaction from django.db.models import Q from rest_framework import generics, permissions from rest_framework.response import Response diff --git a/opentech/static_src/src/app/src/components/Modal/index.js b/opentech/static_src/src/app/src/components/Modal/index.js new file mode 100644 index 000000000..6551b5ba6 --- /dev/null +++ b/opentech/static_src/src/app/src/components/Modal/index.js @@ -0,0 +1,37 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +export default class Modal extends React.Component { + static propTypes = { + heading: PropTypes.string, + content: PropTypes.node.isRequired, + visible: PropTypes.bool, + onClose: PropTypes.func, + } + + get styles() { + const { visible } = this.props; + const modalStyle = {}; + + if (!visible) { + modalStyle['display'] = 'none'; + } + + return { + modal: { + ...modalStyle + } + } + } + + render() { + const { content, heading, onClose } = this.props; + return ( + <div style={this.styles.modal}> + {onClose && <button onClick={onClose}>[X]</button>} + {heading && <h1>{heading}</h1>} + {content} + </div> + ); + } +} -- GitLab