Module: PrimeAwesome::ViewStyler

Defined in:
lib/prime_awesome/view_styler.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/prime_awesome/view_styler.rb', line 4

def self.included(base)
  base.class_eval do
    alias_method :_prepare_options!, :prepare_options!
    def prepare_options!
      if icon = options.delete(:fa_icon)
        options[:attributed_text] = attributed_string(
          font: 'FontAwesome'.uifont(options.delete(:fa_size) || 14),
          text: MotionAwesome.hex_for_icon(icon.to_s.gsub('_', '-'))
        )
      end
      _prepare_options!
    end
  end
end