-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix with updating. Might revisit to see if can be improved but se…
…ems to solve for now
- Loading branch information
1 parent
6a8564c
commit adfe726
Showing
3 changed files
with
6 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
module ApplicationHelper | ||
def turbo_id_for(obj, id_or_hash: false) | ||
id = if id_or_hash | ||
obj.id | ||
elsif obj.persisted? | ||
dom_id(obj) | ||
end | ||
|
||
id || obj.hash | ||
def turbo_id_for(obj) | ||
obj.persisted? ? obj.id : obj.hash | ||
end | ||
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<%= fields_for "project[tasks_attributes][#{turbo_id_for(task)}]", task do |ff| %> | ||
<fieldset class="mb-4" id="<%= turbo_id_for(task)%>"> | ||
<fieldset class="mb-4" id="<%= turbo_id_for(task) %>"> | ||
<legend>Task Info</legend> | ||
<%= ff.label :name %><br> | ||
<%= ff.text_field :name, class: "px-2 py-1 border w-full rounded-md" %> | ||
<%= ff.hidden_field :id %> | ||
<%= button_tag "Delete Task", formaction: task_path(turbo_id_for(task, id_or_hash: true)), formmethod: :delete, class: "mt-4 float-right p-2 rounded-md bg-red-300 hover:bg-red-400" %> | ||
<%= button_tag "Delete Task", formaction: task_path(turbo_id_for(task)), formmethod: :delete, class: "mt-4 float-right p-2 rounded-md bg-red-300 hover:bg-red-400" %> | ||
</fieldset> | ||
<% end %> | ||
|
adfe726
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like this bit
task = Task.new(id: params[:id])
nor do I know if it's a good idea bc lol prob shouldn't be manually setting the id though maybe it's fine here bc it's just a fake task object in memory essentially.