generated from OmarMWarraich/ROR-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dde9477
commit f2db63e
Showing
14 changed files
with
110 additions
and
35 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
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
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
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,19 @@ | ||
import { Controller } from "@hotwired/stimulus"; | ||
|
||
// Connects to data-controller="toast" | ||
export default class extends Controller { | ||
static targets = ["toast"]; | ||
|
||
connect() { | ||
this.show(); | ||
} | ||
|
||
show() { | ||
this.toastTarget.classList.add("active"); | ||
setTimeout(() => this.hide(), 6000); | ||
} | ||
|
||
hide() { | ||
this.toastTarget.classList.remove("active"); | ||
} | ||
} |
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
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
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 @@ | ||
<%= turbo_stream.append "flash", partial: "shared/flash", locals: { type: type, message: message } %> |
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
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
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 @@ | ||
<%= turbo_stream.append "flash", partial: "shared/flash", locals: { type: type, message: message } %> |
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 |
---|---|---|
@@ -1,20 +1,17 @@ | ||
<p class="notice"><%= notice %></p> | ||
|
||
<h1 class='text-center'>Recipes</h1> | ||
<div class='container' style='margin-top:2.5rem;'> | ||
<%= turbo_stream_from "recipes" %> | ||
|
||
<%= turbo_frame_tag "recipe-form" do %> | ||
<%= render "recipes/form", recipe: @recipe %> | ||
<% end %> | ||
|
||
<div> | ||
<div class='container' style='margin-top:2.5rem;'> | ||
<div class='align-left' style='margin-bottom:5rem;'> | ||
<%= link_to "Add Recipe", new_recipe_path, class: "large-button" %> | ||
</div> | ||
<%= turbo_stream_from "recipes" %> | ||
|
||
<%= turbo_frame_tag "recipe-form" do %> | ||
<%= render "recipes/form", recipe: @recipe %> | ||
<%= turbo_frame_tag "recipes", class:"recipes-container-rows" do %> | ||
<% @recipes.each do |recipe| %> | ||
<%= link_to recipe_path(recipe) do %> | ||
<%= render partial: "recipes/recipe", locals: { recipe: recipe } %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= turbo_frame_tag "recipes", class:"recipes-container-rows" do %> | ||
<%= render partial: "recipes/recipe", collection: @recipes %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> |
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,3 @@ | ||
<% flash.each do |type, message| %> | ||
<%= render partial: "shared/toast", locals: { message: message } %> | ||
<% end %> |
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 @@ | ||
<%= render partial: "shared/toast", locals: { message: notice } if notice.present? %> |
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,3 @@ | ||
<div data-controller="toast" data-toast-target="toast" class="toast"> | ||
<%= message %> | ||
</div> |