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

Constant Summary collapse

ICON_MAP =

same for all: :search,

{
  material: {
    plus: :add,
    pencil: :edit,
    trash: :delete,
    wrench: :build,
    new_window: :open_in_new,
    history: :history,
    triangle_left: :expand_less,
    triangle_right: :expand_more,
    flag: :flag,
    option_horizontal: :more_horiz,
    option_vertical: :more_vert,
    pushpin: :pin_drop,
    baby_formula: :device_hub,
    log_out: :call_made,
    log_in: :call_received,
    explore: :explore,
    remove: :close,
    expand: :expand_more,
    collapse_down: :expand_less,
    globe: :public,
    commenting: :comment
  },
  font_awesome: {
    option_horizontal: :ellipsis_h,
    pushpin: "thumb-tack",
    globe: :globe,
    zoom_out: "search-minus",
    close: :times,
    check_circle: "check-circle",
    reorder: "align-justify",
    commenting: :comments
  },
  glyphicon: {
    option_horizontal: "option-horizontal",
    option_vertical: "option-vertical",
    triangle_left: "triangle-left",
    triangle_right: "triangle-right",
    baby_formula: "baby-formula",
    log_out: "log-out",
    log_in: "log-in",
    collapse_down: "collapse-down",
    globe: :globe,
    zoom_out: "zoom-out",
    close: :remove,
    new_window: "new-window",
    history: :time,
    check_circle: "ok-sign",
    reorder: "align-justify"
  }

}.freeze

Instance Method Summary collapse

Instance Method Details

#default_icon_libraryObject



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

def default_icon_library
  :material
end

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



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

def fa_icon icon, opts={}
  universal_icon_tag icon, :font_awesome, opts
end

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



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

def font_awesome_icon_tag icon, opts={}

  prepend_class opts,
                "fa#{'b' if opts.delete :brand} fa-#{icon_class(:font_awesome, icon)}"
  wrap_with :i, "", opts
end

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



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

def glyphicon icon, opts={}
  universal_icon_tag icon, :glyphicon, opts
end

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



100
101
102
103
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 100

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

#icon_class(library, icon) ⇒ Object



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

def icon_class library, icon
  ICON_MAP[library][icon] || icon
end

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



81
82
83
84
85
86
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 81

def icon_tag icon, opts={}
  with_icon_tag_opts(opts) do |tag_opts|
    library = tag_opts.delete(:library) || default_icon_library
    universal_icon_tag icon, library, tag_opts
  end
end

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



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

def material_icon icon, opts={}
  universal_icon_tag icon, :material, opts
end

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



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

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

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



88
89
90
91
92
93
94
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/icon.rb', line 88

def universal_icon_tag icon, icon_library=default_icon_library, opts={}
  return "" unless icon.present?

  with_icon_tag_opts(opts) do |tag_opts|
    send "#{icon_library}_icon_tag", icon, tag_opts
  end
end