From 944ad5dce0b3affdb4e4994fc3609b4393ffa7d5 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Sun, 26 Nov 2023 19:08:53 +0100 Subject: [PATCH] Extract partials and add ids we'll need for the stream actions approach --- app/helpers/projects_helper.rb | 3 ++- app/views/projects/_complete_count.html.erb | 1 + app/views/projects/_tasks.html.erb | 6 ++---- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 app/views/projects/_complete_count.html.erb diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index d3d9e33..e4ea1de 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,5 +1,6 @@ module ProjectsHelper def project_progress_bar_for(project) - tag.progress "#{project.completion_ratio * 100}%", value: project.tasks.completed.count, max: project.tasks.count, class: "progress is-primary" + tag.progress "#{project.completion_ratio * 100}%", id: dom_id(project, :progress_bar), + value: project.tasks.completed.count, max: project.tasks.count, class: "progress is-primary" end end diff --git a/app/views/projects/_complete_count.html.erb b/app/views/projects/_complete_count.html.erb new file mode 100644 index 0000000..014d4a4 --- /dev/null +++ b/app/views/projects/_complete_count.html.erb @@ -0,0 +1 @@ +<%= project.tasks.completed.count %> / <%= project.tasks.count %> diff --git a/app/views/projects/_tasks.html.erb b/app/views/projects/_tasks.html.erb index 8a4fa29..9529543 100644 --- a/app/views/projects/_tasks.html.erb +++ b/app/views/projects/_tasks.html.erb @@ -1,5 +1,4 @@ - - +
@@ -13,8 +12,7 @@
- <%= tasks.completed.count %> - / <%= tasks.count %> + <%= render "projects/complete_count", project: project %>