-
Notifications
You must be signed in to change notification settings - Fork 2
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: add scaffolding for shuttle page #1019
Conversation
<.input field={f[:shuttle_name]} type="text" label="Shuttle name" /> | ||
<.input | ||
field={f[:status]} | ||
type="select" |
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 have a PR open to fix a bug with the bootstrap styling for select
inputs that was added to core_components: #1018
Right now this field has an error but it doesn't display properly to the user (it's hidden because it's not marked properly as is-invalid
)
a62a8f2
to
e11a1bd
Compare
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.
Good to go! Just 2 non-blocking questions.
This was a good demo of heex templates, which I haven't yet used.
@@ -231,4 +231,88 @@ defmodule Arrow.Shuttles do | |||
def change_shape(%Shape{} = shape, attrs \\ %{}) do | |||
Shape.changeset(shape, attrs) | |||
end | |||
|
|||
alias Arrow.Shuttles.Shuttle |
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.
Any reason for putting the alias here rather than at the top of the module? Is it sort of to separate the shape-related functions above from the shuttle-related functions below?
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.
Phoenix code generators automatically added this to the end of the file. I was thought of it as separation from the shape-related functions but I don't feel strongly about it (and I don't know how intentional it is from code gen).
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.
Oh interesting, I didn't even know this code was generated! Will take another look at Phoenix's codegen docs 👀
lib/arrow/shuttles.ex
Outdated
|
||
@spec create_shuttle( | ||
:invalid | ||
| %{optional(:__struct__) => none(), optional(atom() | binary()) => any()} |
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 haven't seen the none
type use like this before—does this essentially say that if you pass a map to create_shuttle/1
, it has to be a bare map and not a struct? i.e., it's not allowed to have a :__struct__
key?
(I thought none
/ no_return
was only useful for indicating that a function never returns, due to raising, throwing, terminating the process etc; so I'm not sure of its semantics in a typespec.)
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.
Woops, I'll remove, I didn't notice this.
This annotation was created by VsCode so I can't comment on why it generated the annotation like this. I must have accidentally added it at some point while viewing the file.
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.
Oh gotcha. I sometimes accidentally click those suggested typespecs and they're almost always totally crazy, especially when any kind of string argument / return is involved!
e11a1bd
to
36040b5
Compare
36040b5
to
7203404
Compare
Summary of changes
Asana Ticket: Generate scaffolding for Create/View/Edit Shuttle Route Definition pages
Reviewer Checklist