lecutre 07
This commit is contained in:
122 files changed
+9723
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<Layouts.app flash={@flash}>
|
||||
<.header>
|
||||
Edit Student {@student.id}
|
||||
<:subtitle>Use this form to manage student records in your database.</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.student_form
|
||||
changeset={@changeset}
|
||||
action={~p"/students/#{@student}"}
|
||||
return_to={~p"/students"}
|
||||
/>
|
||||
</Layouts.app>
|
||||
@@ -0,0 +1,28 @@
|
||||
<Layouts.app flash={@flash}>
|
||||
<.header>
|
||||
Listing Students
|
||||
<:actions>
|
||||
<.button href={~p"/students/new"}>
|
||||
<.icon name="hero-plus" /> New Student
|
||||
</.button>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
<.table id="students" rows={@students} row_click={&JS.navigate(~p"/students/#{&1}")}>
|
||||
<:col :let={student} label="Student ID">{student.sid}</:col>
|
||||
<:col :let={student} label="First Name">{student.firstname}</:col>
|
||||
<:col :let={student} label="Last Name">{student.lastname}</:col>
|
||||
<:col :let={student} label="GPA">{student.gpa}</:col>
|
||||
<:action :let={student}>
|
||||
<div class="sr-only">
|
||||
<.link navigate={~p"/students/#{student}"}>Show</.link>
|
||||
</div>
|
||||
<.link navigate={~p"/students/#{student}/edit"}>Edit</.link>
|
||||
</:action>
|
||||
<:action :let={student}>
|
||||
<.link href={~p"/students/#{student}"} method="delete" data-confirm="Are you sure?">
|
||||
Delete
|
||||
</.link>
|
||||
</:action>
|
||||
</.table>
|
||||
</Layouts.app>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Layouts.app flash={@flash}>
|
||||
<.header>
|
||||
New Student
|
||||
<:subtitle>Use this form to manage student records in your database.</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.student_form changeset={@changeset} action={~p"/students"} return_to={~p"/students"} />
|
||||
</Layouts.app>
|
||||
@@ -0,0 +1,21 @@
|
||||
<Layouts.app flash={@flash}>
|
||||
<.header>
|
||||
Student {@student.id}
|
||||
<:subtitle>This is a student record from your database.</:subtitle>
|
||||
<:actions>
|
||||
<.button navigate={~p"/students"}>
|
||||
<.icon name="hero-arrow-left" />
|
||||
</.button>
|
||||
<.button variant="primary" navigate={~p"/students/#{@student}/edit?return_to=show"}>
|
||||
<.icon name="hero-pencil-square" /> Edit student
|
||||
</.button>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
<.list>
|
||||
<:item title="Student ID">{@student.sid}</:item>
|
||||
<:item title="First Name">{@student.firstname}</:item>
|
||||
<:item title="Last Name">{@student.lastname}</:item>
|
||||
<:item title="GPA">{@student.gpa}</:item>
|
||||
</.list>
|
||||
</Layouts.app>
|
||||
@@ -0,0 +1,10 @@
|
||||
<.form :let={f} for={@changeset} action={@action}>
|
||||
<.input field={f[:sid]} type="text" label="Sid" />
|
||||
<.input field={f[:firstname]} type="text" label="Firstname" />
|
||||
<.input field={f[:lastname]} type="text" label="Lastname" />
|
||||
<.input field={f[:gpa]} type="number" label="Gpa" step="any" />
|
||||
<footer>
|
||||
<.button variant="primary">Save Student</.button>
|
||||
<.button :if={@return_to} href={@return_to}>Cancel</.button>
|
||||
</footer>
|
||||
</.form>
|
||||
Reference in new issue
Block a user