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



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

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

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



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

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

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



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

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



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

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

#icon_librariesObject



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

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.



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

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



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

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

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



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

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



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

view :icons, template: :haml