Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to create, view, edit & delete forms #39

Merged
merged 11 commits into from
Aug 1, 2020

Conversation

bismitaguha
Copy link
Contributor

@bismitaguha bismitaguha commented Jul 3, 2020

Description

  • Added viewing for forms
  • Added moment.js for display of dates
  • Add delete feature for forms
  • Add delete confirmation before finally deleting the form
  • Option for adding new fields to a form and editing the fields

Fixes #19

Type of Change:

  • Code
  • User Interface

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

UI

Screenshot from 2020-07-04 04-45-35

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • Any dependent changes have been merged

Code/Quality Assurance Only

  • My changes generate no new warnings
  • Any dependent changes have been published in downstream modules

@bismitaguha
Copy link
Contributor Author

@abha224 @sidvenu As I had mentioned, work on this PR is left, but you can review this part. Also, there is a slight change in the UI than mentioned in the design, but I don't know why this looks more balanced and prettier. If you want me to shift to the mentioned design, I will but please give this view a thought. 😃

Comment on lines 11 to 55
class Form extends Component {
constructor(props) {
super(props)
}

componentDidMount() {
this.props.getInfo()
}

export default class Form extends Component {
render() {
const { userinfo } = this.props
const type = userinfo ? ( userinfo[0] ? userinfo[0].user_type : null ) : 'student'
return (
<div>
forms
<div className='form'>
<div className='inside'>
{
type === 'admin'?
<>
<Header>Published Forms</Header>
<PublishedForm />
<Divider />
<Header>Unpublished Forms</Header>
<UnpublishedForm />
</>
: <PublishedForm />
}
</div>
</div>
)
}
}

Form.propTypes = {
userinfo: PropTypes.array.isRequired
};

const mapStateToProps = state => ({
formerror: state.form.formerror,
userinfo: state.info.userinfo,
})

export default connect(
mapStateToProps,
{ postForm, getInfo }
)(Form)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this component? I'm not able to wrap my head around it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to render based on condition of which user is logged in.

@sidvenu
Copy link

sidvenu commented Jul 4, 2020

  1. Could you increase the verbosity of the names of the different files?
  2. The file name of Form.js and the component name does not match.

Do address the above :)

@bismitaguha
Copy link
Contributor Author

@sidvenu @abha224 The state of the new fields are not getting updated in the frontend. The object is not getting created properly. So please look into it!!

@sidvenu
Copy link

sidvenu commented Jul 17, 2020

@bismitaguha I tried looking into the bug you described in our 1:1, I'm not able to track it down just by code review. Will test it out and try to find out the bug soon.

@sidvenu
Copy link

sidvenu commented Jul 20, 2020

@bismitaguha did you get any leads on this bug (I didn't)? If not, we can use today's OSP weekly session to debug it if we have time in the end.

cc @abha224

@sidvenu sidvenu mentioned this pull request Jul 20, 2020
5 tasks
@abha224
Copy link
Contributor

abha224 commented Jul 20, 2020

@bismitaguha I was going through the working of this branch, and seems like theres a problem in user info update. Did you modify the code for that ?

@bismitaguha
Copy link
Contributor Author

@bismitaguha I was going through the working of this branch, and seems like theres a problem in user info update. Did you modify the code for that ?

There is a warning I guess, but this won't be the PR where I make that change, I haven't made any changes to that component in this PR.

@bismitaguha
Copy link
Contributor Author

Error displayed on state change
Screenshot from 2020-07-21 22-45-56

src/components/Questions.js Outdated Show resolved Hide resolved
Add feature to add options wherever required
@bismitaguha
Copy link
Contributor Author

Screenshot from 2020-07-23 02-59-58

@bismitaguha bismitaguha requested a review from sidvenu July 22, 2020 21:31
@bismitaguha bismitaguha changed the title [WIP]: Add feature to create, view, edit & delete forms Add feature to create, view, edit & delete forms Jul 22, 2020
src/actions/form.js Outdated Show resolved Hide resolved
@abha224
Copy link
Contributor

abha224 commented Jul 23, 2020

@bismitaguha There are 2 class components 'Form' and 'Forms' in forms.js and dashboard.js. And even the class name for Submissions.js is Form. Pls modify these class names appropriately to avoid duplicates.
Also, there are hardly any comments in the code , pls add them . Even if the method names are self explanatory, it is a good practice to write comments so that anyone who tries to checks this project can easily understand whats achieved through the code rather than going through it line by line.

Copy link

@sidvenu sidvenu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the changes @abha224 requested. Were the bugs you talked about previously fixed?

sidvenu
sidvenu previously approved these changes Jul 28, 2020
Copy link

@sidvenu sidvenu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One general suggestion is for you to add more comments wherever it makes sense - but it has been 4 weeks already, let's get this PR merged.

@abha224
Copy link
Contributor

abha224 commented Jul 28, 2020

@bismitaguha the buttons on the form are not functional? Also, the forms are not being retained after creation?

forms

(pls ignore spelling errors in gif )

@bismitaguha
Copy link
Contributor Author

bismitaguha commented Jul 28, 2020

@bismitaguha the buttons on the form are not functional? Also, the forms are not being retained after creation?

forms

(pls ignore spelling errors in gif )

Weirdly create function in mine is working fine....We can discuss this in Siddharth's office hours today. I guess maybe you are in some other branch or something, just like the problem was previous time!!! @abha224

@bismitaguha bismitaguha changed the title Add feature to create, view, edit & delete forms Add feature to create, view, edit & delete forms and fields Aug 1, 2020
@bismitaguha bismitaguha changed the title Add feature to create, view, edit & delete forms and fields Add feature to create, view, edit & delete forms Aug 1, 2020
@sidvenu sidvenu merged commit ddd4712 into anitab-org:develop Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create forms UI
3 participants