add note with @Icon() reverse regex

useful when copy pasting Zammad html for a layout-reference to covert <svg>'s back to @Icons
This commit is contained in:
Felix Niklas 2015-10-23 16:28:59 +02:00
parent 1c6a32c8ce
commit bd364bcb93

View file

@ -594,6 +594,13 @@ class App.Utils
num
@icon: (name, className = '') ->
#
# reverse regex
# =============
#
# search: <svg class="icon icon-([^\s]+)\s([^"]*).*<\/svg>
# replace: <%- @Icon('$1', '$2') %>
#
path = if window.svgPolyfill then '' else 'assets/images/icons.svg'
"<svg class=\"icon icon-#{name} #{className}\"><use xlink:href=\"#{path}#icon-#{name}\" /></svg>"