Remove duplication in timeline component
This way adding new steps will be easier.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user