-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attempt to center header image for fields guide
- Loading branch information
Showing
2 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Create `attendee` schema | ||
|
||
The goal is to allow `people` attending **_Awesome_ Conf** | ||
to submit the following data: | ||
|
||
+ `first_name` - how we greet you. Will appear on your conference pass. | ||
+ `last_name` - your family name. Will appear on you conference pass. | ||
+ `email` - to confirm attendance | ||
+ `phone_number` - to verify your access when attending the secret event. | ||
+ `address_line_1` - so we can send the welcome pack and prizes | ||
+ `address_line_2` - if your address has multiple lines. | ||
+ `postcode` - for the address. | ||
+ `gender` - for venue capacity planning. | ||
+ `diet_pref` - dietary preferences for meals and snacks provided at the conference. | ||
+ `website` - share your awesomeness and have it as a QR code on your conference pass. | ||
+ `desc` - brief description of your awesome project. | ||
+ `feedback` - Feedback or suggestions | ||
|
||
|
||
## 4.1 `gen.live` | ||
|
||
Using the | ||
[`mix phx.gen.live`](https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Schema.html) | ||
command, | ||
run: | ||
```sh | ||
mix phx.gen.live Accounts Attendee attendees first_name:string last_name:string email:string phone_number:string address_line_1:string address_line_2 postcode:string gender:string diet_pref:string website:string desc:string feedback:string | ||
``` | ||
|
||
You should expect to see output similar to the following: | ||
|
||
```sh | ||
* creating lib/fields_demo_web/live/attendee_live/show.ex | ||
* creating lib/fields_demo_web/live/attendee_live/index.ex | ||
* creating lib/fields_demo_web/live/attendee_live/form_component.ex | ||
* creating lib/fields_demo_web/live/attendee_live/index.html.heex | ||
* creating lib/fields_demo_web/live/attendee_live/show.html.heex | ||
* creating test/fields_demo_web/live/attendee_live_test.exs | ||
* creating lib/fields_demo/accounts/attendee.ex | ||
* creating priv/repo/migrations/20230928032757_create_attendees.exs | ||
* creating lib/fields_demo/accounts.ex | ||
* injecting lib/fields_demo/accounts.ex | ||
* creating test/fields_demo/accounts_test.exs | ||
* injecting test/fields_demo/accounts_test.exs | ||
* creating test/support/fixtures/accounts_fixtures.ex | ||
* injecting test/support/fixtures/accounts_fixtures.ex | ||
|
||
Add the live routes to your browser scope in lib/fields_demo_web/router.ex: | ||
|
||
live "/attendees", AttendeeLive.Index, :index | ||
live "/attendees/new", AttendeeLive.Index, :new | ||
live "/attendees/:id/edit", AttendeeLive.Index, :edit | ||
|
||
live "/attendees/:id", AttendeeLive.Show, :show | ||
live "/attendees/:id/show/edit", AttendeeLive.Show, :edit | ||
|
||
|
||
Remember to update your repository by running migrations: | ||
|
||
$ mix ecto.migrate | ||
``` | ||
|
||
Those are a _lot_ of new files. 😬 | ||
Let's take a moment to go through them | ||
and understand what each file is doing. | ||
|
||
### `lib/fields_demo_web/live/attendee_live/show.ex` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters