Module: Card::Set::All::Bootstrap::Icon::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb

Instance Method Summary collapse

Instance Method Details

#all_icon_keysObject



146
147
148
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 146

def all_icon_keys
  basket[:icons].values.map(&:keys).flatten.uniq
end

#bootstrap_icon_tag(icon, opts = {}) ⇒ Object



134
135
136
137
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 134

def bootstrap_icon_tag icon, opts={}
  prepend_class opts, "bi-#{icon}"
  wrap_with :i, "", opts
end

#font_awesome_icon_tag(icon, opts = {}) ⇒ Object



124
125
126
127
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 124

def font_awesome_icon_tag icon, opts={}
  prepend_class opts, "fa#{'b' if opts.delete :brand} fa-#{icon}"
  wrap_with :i, "", opts
end

#glyphicon_icon_tag(icon, opts = {}) ⇒ Object



119
120
121
122
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 119

def glyphicon_icon_tag icon, opts={}
  prepend_class opts, "glyphicon glyphicon-#{icon}"
  wrap_with :span, "", opts.merge("aria-hidden": true)
end

#icon_librariesObject



115
116
117
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 115

def icon_libraries
  @icon_libraries ||= Cardio.config.icon_libraries
end

#icon_tag(icon_key, opts = {}) ⇒ String

Generates an HTML tag for an icon with optional parameters.

Examples:

icon_tag(:heart, class: 'favorite-icon', style: 'color: red')

Parameters:

  • icon_key (String)

    The key representing the desired icon.

  • opts (Hash) (defaults to: {})

    The options for the icon tag.

Options Hash (opts):

  • :class (String)

    Additional CSS classes for the icon tag.

  • :style (String)

    Additional inline styles for the icon tag.

Returns:

  • (String)

    The HTML code for the icon tag.



106
107
108
109
110
111
112
113
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 106

def icon_tag icon_key, opts={}
  return "" unless icon_key.present?

  library, icon = icon_lookup icon_key
  with_icon_tag_opts(opts) do |tag_opts|
    universal_icon_tag library, icon, tag_opts
  end
end

#material_icon_tag(icon, opts = {}) ⇒ Object



129
130
131
132
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 129

def material_icon_tag icon, opts={}
  add_class opts, "material-icons"
  wrap_with :i, icon, opts
end

#universal_icon_tag(library, icon, opts = {}) ⇒ Object



139
140
141
142
143
144
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 139

def universal_icon_tag library, icon, opts={}
  add_class opts, "notranslate"
  with_icon_tag_opts(opts) do |tag_opts|
    send "#{library}_icon_tag", icon, tag_opts
  end
end

#view: iconsObject



93
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 93

view :icons, template: :haml