Move progress bars form partial to a component

This way we can move some of the view logic to the Ruby class. It'll
also make it easier to write tests for it.
This commit is contained in:
Javi Martín
2024-10-11 22:39:08 +02:00
parent 9c057d5695
commit 233ba3c72f
4 changed files with 19 additions and 5 deletions

View File

@@ -0,0 +1,15 @@
class Admin::ProgressBars::FormComponent < ApplicationComponent
include TranslatableFormHelper
include GlobalizeHelper
attr_reader :progress_bar
def initialize(progress_bar)
@progress_bar = progress_bar
end
private
def progress_options
{ min: ProgressBar::RANGE.min, max: ProgressBar::RANGE.max, step: 1 }
end
end