diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-06 12:55:12 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-06 12:55:12 -0600 |
commit | 4067339e8cf9dbd624a8fa0183d7a29c73b2e762 (patch) | |
tree | 4f995e706c10bf5b9a58c078cfb843c76e31c8a0 /lib/aggiedit_web/live/post_live/index.html.heex | |
parent | 66d871e5461814dad58872eb832a58f2c3c5111b (diff) | |
download | aggiedit-4067339e8cf9dbd624a8fa0183d7a29c73b2e762.tar.gz aggiedit-4067339e8cf9dbd624a8fa0183d7a29c73b2e762.zip |
Models for upload and post; generated liveview controller for posts
Diffstat (limited to 'lib/aggiedit_web/live/post_live/index.html.heex')
-rw-r--r-- | lib/aggiedit_web/live/post_live/index.html.heex | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/aggiedit_web/live/post_live/index.html.heex b/lib/aggiedit_web/live/post_live/index.html.heex new file mode 100644 index 0000000..4297d5a --- /dev/null +++ b/lib/aggiedit_web/live/post_live/index.html.heex @@ -0,0 +1,41 @@ +<h1>Listing Posts</h1> + +<%= if @live_action in [:new, :edit] do %> + <.modal return_to={Routes.post_index_path(@socket, :index)}> + <.live_component + module={AggieditWeb.PostLive.FormComponent} + id={@post.id || :new} + title={@page_title} + action={@live_action} + post={@post} + return_to={Routes.post_index_path(@socket, :index)} + /> + </.modal> +<% end %> + +<table> + <thead> + <tr> + <th>Title</th> + <th>Body</th> + + <th></th> + </tr> + </thead> + <tbody id="posts"> + <%= for post <- @posts do %> + <tr id={"post-#{post.id}"}> + <td><%= post.title %></td> + <td><%= post.body %></td> + + <td> + <span><%= live_redirect "Show", to: Routes.post_show_path(@socket, :show, post) %></span> + <span><%= live_patch "Edit", to: Routes.post_index_path(@socket, :edit, post) %></span> + <span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: post.id, data: [confirm: "Are you sure?"] %></span> + </td> + </tr> + <% end %> + </tbody> +</table> + +<span><%= live_patch "New Post", to: Routes.post_index_path(@socket, :new) %></span> |