-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(elm): Add form for creating a category #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aion/web/elm/src/Panel/Api.elm
Outdated
import Room.Models exposing (RoomsData) | ||
|
||
|
||
-- create question section | ||
|
||
|
||
createQuestionUrl : String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can move the Urls to Constants.elm
import Toasty.Defaults | ||
|
||
|
||
categoryFormValidationErrorToast : ( Model, Cmd Msg ) -> ( Model, Cmd Msg ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I have a similar comment as to the previous PR. If we've put three functions mirroring three types of notifications in src/Notifications.elm, then this file could only consist of three strings + import Notifications. I think that would make it simpler, but, as I said, we can delay it until we'll be dealing with global elm refactor.
categoryNameValidations = | ||
let | ||
categoryNameRegex = | ||
"\\b([A-Z][a-z]+)\\b" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^\s*(.+?)\s+$
You could do this for multi word categories. Did you check how your regex behaves when dealing with Unicode characters?
aion/web/elm/src/Update.elm
Outdated
@@ -50,6 +52,24 @@ update msg model = | |||
_ -> | |||
model ! [] | |||
|
|||
OnCategoryCreated response -> | |||
case response of | |||
RemoteData.Success responseData -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just cries for a proper setter method, cannot wait for #56
Updated branch and adjusted code to your suggestions. Lets leave regex discussion for another day.. |
Summary
Related issues
Closes #41
Test plan
Just test the form