Skip to content

Commit

Permalink
Move logic away from the view, do it in a component method instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ncounter committed Jul 28, 2023
1 parent d142c45 commit d662f1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
= link_to(token_workflow_runs_path(@token, @filter_item),
class: "list-group-item list-group-item-action #{css_for_link} d-flex justify-content-between") do
%span
- if @icon != ''
%i.me-1{ class: "#{@icon} #{css_for_icon}" }
= icon_tag
= @text
- if @amount.positive?
%span= @amount
4 changes: 2 additions & 2 deletions src/api/app/components/workflow_run_filter_link_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def css_for_link
workflow_run_filter_matches? ? 'active' : ''
end

def css_for_icon
workflow_run_filter_matches? ? 'text-light' : ''
def icon_tag
tag.i(class: ['me-1', @icon, ('text-light' if workflow_run_filter_matches?)]) if @icon != ''

Check warning on line 18 in src/api/app/components/workflow_run_filter_link_component.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/components/workflow_run_filter_link_component.rb#L18

Added line #L18 was not covered by tests
end

private
Expand Down

0 comments on commit d662f1d

Please sign in to comment.