app/helpers/trestle/icon_helper.rb in trestle-0.10.0 vs app/helpers/trestle/icon_helper.rb in trestle-0.10.1

- old
+ new

@@ -1,8 +1,21 @@ module Trestle module IconHelper - def icon(*classes) - options = classes.extract_options! - content_tag(:i, "", options.merge(class: classes)) + # Renders an icon (as an <i> tag). + # + # Trestle includes the FontAwesome icon library but other font + # libraries can be included via custom CSS. + # + # classes - List of font name classes to add to the <i> tag + # attributes - Additional HTML attributes to add to the <i> tag + # + # Examples + # + # <%= icon("fas fa-star") %> + # <%= icon("fas", "fa-star", class: "fa-fw text-muted") + # + # Return the HTML i tag for the icon. + def icon(*classes, **attributes) + tag.i("", **attributes.merge(class: [*classes, attributes[:class]])) end end end