Remove duplication in timeline component

This way adding new steps will be easier.
This commit is contained in:
Javi Martín
2021-06-02 01:46:50 +02:00
parent eff370b279
commit b99ce2af45
2 changed files with 10 additions and 11 deletions

View File

@@ -1,8 +1,7 @@
<ol class="creation-timeline">
<li <%= "aria-current='step'" unless step_groups? %>>
<%= t("admin.budgets_wizard.creation_timeline.budget") %>
</li>
<li <%= "aria-current='step'" if step_groups? %>>
<%= t("admin.budgets_wizard.creation_timeline.groups") %>
<% steps.each do |step| %>
<li <%= "aria-current='step'" if step == current_step %>>
<%= t("admin.budgets_wizard.creation_timeline.#{step}") %>
</li>
<% end %>
</ol>

View File

@@ -1,13 +1,13 @@
class Admin::BudgetsWizard::CreationTimelineComponent < ApplicationComponent
attr_reader :step
attr_reader :current_step
def initialize(step)
@step = step
def initialize(current_step)
@current_step = current_step
end
private
def step_groups?
step == "groups"
def steps
%w[budget groups]
end
end