Module: Line::Okuru::ButtonHelper

Defined in:
lib/line-okuru/helpers/button_helper.rb

Defined Under Namespace

Classes: InvalidButtonStyleError

Constant Summary collapse

FILES =
{
              small: {
                width: 20,
                height: 20,
              },
              medium: {
                width: 30,
                height: 30
              },
              large: {
                width: 40,
                height: 40
              },
              wide: {
                width: 86,
                height: 20
              },
              tall: {
                width: 36,
                height: 60
              }
}

Instance Method Summary collapse

Instance Method Details

#line_share_button(text, attrs = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/line-okuru/helpers/button_helper.rb', line 30

def line_share_button(text, attrs = {})
  style = attrs.delete(:button_style) || :medium

  raise InvalidButtonStyleError, "button_style argument should be one of [:small, :medium, :large, :wide, :tall] " unless FILES.has_key? style

  share_link(text, attrs) do
    image_tag("linebutton_#{FILES[style][:width]}x#{FILES[style][:height]}.png", :width => FILES[style][:width], :height => FILES[style][:height])
  end
end