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">
|
<ol class="creation-timeline">
|
||||||
<li <%= "aria-current='step'" unless step_groups? %>>
|
<% steps.each do |step| %>
|
||||||
<%= t("admin.budgets_wizard.creation_timeline.budget") %>
|
<li <%= "aria-current='step'" if step == current_step %>>
|
||||||
</li>
|
<%= t("admin.budgets_wizard.creation_timeline.#{step}") %>
|
||||||
<li <%= "aria-current='step'" if step_groups? %>>
|
</li>
|
||||||
<%= t("admin.budgets_wizard.creation_timeline.groups") %>
|
<% end %>
|
||||||
</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
class Admin::BudgetsWizard::CreationTimelineComponent < ApplicationComponent
|
class Admin::BudgetsWizard::CreationTimelineComponent < ApplicationComponent
|
||||||
attr_reader :step
|
attr_reader :current_step
|
||||||
|
|
||||||
def initialize(step)
|
def initialize(current_step)
|
||||||
@step = step
|
@current_step = current_step
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def step_groups?
|
def steps
|
||||||
step == "groups"
|
%w[budget groups]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user