Skip to content

Commit

Permalink
Refactor flash message rendering by consolidating partials into a sin…
Browse files Browse the repository at this point in the history
…gle `_flash.html.slim` file
  • Loading branch information
binos30 committed Jan 11, 2025
1 parent 554e5a4 commit 2f57c77
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 12 deletions.
4 changes: 0 additions & 4 deletions app/views/home/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
= render "partials/alert"
= render "partials/notice"
= render "partials/warning"

h1 Welcome
p Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta, distinctio.
1 change: 1 addition & 0 deletions app/views/layouts/application.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ html
body.d-flex.flex-column.min-vh-100
= render "partials/navbar"
main.container.mt-5.pt-3
== render "partials/flash"
= yield
= render "partials/footer"
3 changes: 3 additions & 0 deletions app/views/partials/_flash.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
== render "partials/alert"
== render "partials/notice"
== render "partials/warning"
4 changes: 0 additions & 4 deletions app/views/posts/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
- set_meta_tags og: { title: meta_title("Posts"), description: "Lists of post" }
- set_meta_tags twitter: { title: meta_title("Posts"), description: "Lists of post" }

== render "partials/alert"
== render "partials/notice"
== render "partials/warning"

.d-flex.justify-content-between
h2 Posts
div
Expand Down
4 changes: 0 additions & 4 deletions app/views/posts/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

/ = turbo_stream_from @post
== render "partials/alert"
== render "partials/notice"
== render "partials/warning"

div id="#{dom_id @post}"
h2 = @post.title
/ = time_tag @post.updated_at, "data-local": "time-ago"
Expand Down

0 comments on commit 2f57c77

Please # to comment.