Commit dc811467 authored by Martin Wortschack's avatar Martin Wortschack Committed by Brandon Labuschagne

Use GitLab SVGs in audit_icon helper

parent e76788ac
...@@ -76,17 +76,17 @@ module IconsHelper ...@@ -76,17 +76,17 @@ module IconsHelper
content_tag(:span, "", class: "gl-snippet-icon gl-snippet-icon-#{name}") content_tag(:span, "", class: "gl-snippet-icon gl-snippet-icon-#{name}")
end end
def audit_icon(names, options = {}) def audit_icon(name, css_class: nil)
case names case name
when "standard" when "standard"
names = "key" name = "key"
when "two-factor" when "two-factor"
names = "key" name = "key"
when "google_oauth2" when "google_oauth2"
names = "google" name = "google"
end end
options.include?(:base) ? fa_stacked_icon(names, options) : fa_icon(names, options) sprite_icon(name, css_class: css_class)
end end
def spinner(text = nil, visible = false) def spinner(text = nil, visible = false)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- events.each do |event| - events.each do |event|
%li %li
%span.description %span.description
= audit_icon(event.details[:with], class: "gl-mr-2") = audit_icon(event.details[:with], css_class: 'gl-mr-2')
= _('Signed in with %{authentication} authentication') % { authentication: event.details[:with]} = _('Signed in with %{authentication} authentication') % { authentication: event.details[:with]}
%span.float-right= time_ago_with_tooltip(event.created_at) %span.float-right= time_ago_with_tooltip(event.created_at)
......
---
title: Use GitLab SVGs in audit_icon helper
merge_request: 45562
author:
type: changed
...@@ -97,19 +97,19 @@ RSpec.describe IconsHelper do ...@@ -97,19 +97,19 @@ RSpec.describe IconsHelper do
it 'returns right icon name for standard auth' do it 'returns right icon name for standard auth' do
icon_name = 'standard' icon_name = 'standard'
expect(audit_icon(icon_name).to_s) expect(audit_icon(icon_name).to_s)
.to eq '<i class="fa fa-key"></i>' .to eq sprite_icon('key')
end end
it 'returns right icon name for two-factor auth' do it 'returns right icon name for two-factor auth' do
icon_name = 'two-factor' icon_name = 'two-factor'
expect(audit_icon(icon_name).to_s) expect(audit_icon(icon_name).to_s)
.to eq '<i class="fa fa-key"></i>' .to eq sprite_icon('key')
end end
it 'returns right icon name for google_oauth2 auth' do it 'returns right icon name for google_oauth2 auth' do
icon_name = 'google_oauth2' icon_name = 'google_oauth2'
expect(audit_icon(icon_name).to_s) expect(audit_icon(icon_name).to_s)
.to eq '<i class="fa fa-google"></i>' .to eq sprite_icon('google')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment