Sha256: 7848d43b131156f766aeb62984a008086a1cbed360c4b589c7c8967f835da588

Contents?: true

Size: 600 Bytes

Versions: 44

Compression:

Stored size: 600 Bytes

Contents

module MotionPrime
  class ButtonElement < BaseElement
    include MotionPrime::ElementContentPaddingMixin
    include MotionPrime::ElementContentTextMixin

    after_render :size_to_fit

    def size_to_fit
      if computed_options[:size_to_fit]
        if computed_options[:width]
          view.setHeight cached_content_outer_height
        end
      end
    end

    def view_class
      "MPButton"
    end

    def text_value
      view.try(:currentTitle) || computed_options[:title]
    end

    def font
      computed_options[:title_label].try(:[], :font) || :system.uifont
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
motion-prime-1.0.3 motion-prime/elements/button.rb
motion-prime-1.0.2 motion-prime/elements/button.rb
motion-prime-1.0.1 motion-prime/elements/button.rb
motion-prime-1.0.0 motion-prime/elements/button.rb
motion-prime-0.9.9.2 motion-prime/elements/button.rb
motion-prime-0.9.9.1 motion-prime/elements/button.rb
motion-prime-0.9.9 motion-prime/elements/button.rb
motion-prime-0.9.8 motion-prime/elements/button.rb
motion-prime-0.9.7 motion-prime/elements/button.rb
motion-prime-0.9.6 motion-prime/elements/button.rb
motion-prime-0.9.5 motion-prime/elements/button.rb
motion-prime-0.9.4 motion-prime/elements/button.rb
motion-prime-0.9.3 motion-prime/elements/button.rb
motion-prime-0.9.2 motion-prime/elements/button.rb
motion-prime-0.9.1 motion-prime/elements/button.rb
motion-prime-0.9.0 motion-prime/elements/button.rb
motion-prime-0.8.12 motion-prime/elements/button.rb
motion-prime-0.8.11 motion-prime/elements/button.rb
motion-prime-0.8.10 motion-prime/elements/button.rb
motion-prime-0.8.9 motion-prime/elements/button.rb