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 courses component #17

Closed
paulbert opened this issue Aug 29, 2017 · 3 comments
Closed

Add courses component #17

paulbert opened this issue Aug 29, 2017 · 3 comments

Comments

@paulbert
Copy link
Member

paulbert commented Aug 29, 2017

The courses component will need to be implemented in a few steps. Let's start with the form so we can populate a courses database. It should:

  • Add a document to the database with the form fields found in the current BeLL-Apps on a form submit click with the exception of the attachment
  • Not add a document if a resource with the same title currently exists
  • Be linked to from the COURSES nav link

Notes:

  • No need to bother with the real text editor, you can just use a plain textbox description for now.
@paulbert
Copy link
Member Author

For reference, here's the current add courses form:
addcourse

@paulbert
Copy link
Member Author

courses.component.ts

  • I'd put the form options on lines 26-53 into a separate file at this point. This file is a little large, and I don't think those defaults will change as much as the form methods.
  • I'd rather we didn't add then delete a resource if the title is a duplicate. I like the use of CouchDB design docs, and I imagine there's a solution there which would solve this. Alternatively, you can query the database with /_find and don't add the document if there is a result. Either way, we wouldn't need to use the courses-checker.json as well.
  • You don't need an ngOnInit to initialize the form values. You can just do that in createForm.
  • For the toggleWeekly() method I think it would be simpler to loop once through the day formArray and remove each value that had been pushed.

courses.component.html

  • The cancel button should be of type="button" rather than type="submit" so it does not run the onSubmit code when clicked.

custom-validators.ts

  • First, I don't think is needed since the input type="number" limits it to a number and we can use the built in min validator (see here) to make sure it is a positive number.
  • This also throws an error since the value is actually stored as a number and the .match method is only a method of strings. This error seems to be breaking the cancel() method.

CouchDB design docs

  • I think these should go into a different folder, maybe called design

@midsorbet
Copy link
Contributor

I have fixed most of the issues you talked about. Now, I need to work on validators.

This was referenced Oct 13, 2017
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

No branches or pull requests

2 participants