Skip to content

Commit

Permalink
attempt to center header image for fields guide
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Sep 23, 2023
1 parent ff4c6f5 commit f30f35c
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 2 deletions.
67 changes: 67 additions & 0 deletions src/fields/02-schema.md
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`
9 changes: 7 additions & 2 deletions src/fields/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<div align="center">

# `Fields` Guide

A **complete beginner's guide**
to building a **`Phoenix` Web App**
using **`fields`**
to **_appropriately_ store personal data**.

![awesome-header-image](https://github.com/dwyl/fields-demo/assets/194400/a87a35ab-409d-4204-8b9f-8d4725b505f0)

</div>

# TODO: insert screenshot of working `fields-demo` app.

## Why?
Expand All @@ -25,8 +31,7 @@ don't skip this chapter.

The `fields-demo` App
showcases a **registration form**
for a (ficticious) conference
"Awesome Conf".
for a (fictitious) conference called "**_Awesome_ Conf**".
It shows you all the steps necessary
to build the form
using the `fields` package
Expand Down

0 comments on commit f30f35c

Please sign in to comment.