mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 01:49:24 +08:00
UX: Add login button icon to no_ember page (#7982)
This commit is contained in:
parent
32b4bdaccd
commit
7bd54eaceb
@ -17,7 +17,7 @@
|
||||
<%- if can_sign_up? %>
|
||||
<a href="<%= path "/signup"%>" class='btn btn-primary btn-small signup-button'><%= I18n.t('sign_up') %></a>
|
||||
<%- end %>
|
||||
<a href="<%= path "/login"%>" class='btn btn-primary btn-small login-button'><%= I18n.t('log_in') %></a>
|
||||
<a href="<%= path "/login"%>" class='btn btn-primary btn-small login-button btn-icon-text'><%= SvgSprite.raw_svg('fa-user') %><%= I18n.t('log_in') %></a>
|
||||
</div>
|
||||
<%- end %>
|
||||
</div>
|
||||
|
@ -303,6 +303,19 @@ License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL
|
||||
false
|
||||
end
|
||||
|
||||
# For use in no_ember .html.erb layouts
|
||||
def self.raw_svg(name)
|
||||
get_set_cache("raw_svg_#{name}") do
|
||||
symbol = search(name)
|
||||
break "" unless symbol
|
||||
symbol = Nokogiri::XML(symbol).children.first
|
||||
symbol.name = "svg"
|
||||
<<~HTML
|
||||
<svg class="fa d-icon svg-icon svg-node" aria-hidden="true">#{symbol}</svg>
|
||||
HTML
|
||||
end.html_safe
|
||||
end
|
||||
|
||||
def self.theme_sprite_variable_name
|
||||
THEME_SPRITE_VAR_NAME
|
||||
end
|
||||
|
@ -29,6 +29,11 @@ describe SvgSprite do
|
||||
expect(SvgSprite.search("this-is-not-an-icon")).to eq(false)
|
||||
end
|
||||
|
||||
it 'can get a raw SVG for an icon' do
|
||||
expect(SvgSprite.raw_svg("fa-heart")).to match(/svg.*svg/) # SVG inside SVG
|
||||
expect(SvgSprite.raw_svg("this-is-not-an-icon")).to eq("")
|
||||
end
|
||||
|
||||
it 'can get a consistent version string' do
|
||||
version1 = SvgSprite.version
|
||||
version2 = SvgSprite.version
|
||||
|
Loading…
x
Reference in New Issue
Block a user