Sha256: adb28d661cb04fa6fbf002242d2d29dbb0a8ae475565adac4edf2d913efd8a10

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

module Jobshop
  class Builder < ActionView::Helpers::FormBuilder # :nodoc:
    [ :email_field, :password_field, :text_field ].each do |field_method|
      define_method field_method do |field, options = {}|
        output  = ""
        output += @template.content_tag(:div, class: "mdl-textfield mdl-js-textfield") do
          content  = ""
          content += super(field, class: [ "mdl-textfield__input" ])
          content += label(field, class: [ "mdl-textfield__label" ])
          content.html_safe
        end
        output.html_safe
      end
    end

    def check_box(field, *args)
      output = ""
      output += label(field, class: [ "mdl-checkbox", "mdl-js-checkbox", "mdl-js-ripple-effect" ]) do
        content  = ""
        content += super(field, class: [ "mdl-checkbox__input" ])
        content += @template.content_tag(:span, field.to_s.humanize, class: [ "mdl-checkbox__label" ])
        content.html_safe
      end
      output.html_safe
    end

    def button(value = nil, *args)
      button_classes = [ "mdl-button", "mdl-js-button", "mdl-button--raised",
        "mdl-button--colored", "mdl-js-ripple-effect" ]

      super(value, class: button_classes)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
jobshop-0.0.16 app/builders/jobshop/builder.rb
jobshop-0.0.15 app/builders/jobshop/builder.rb
jobshop-0.0.14 app/builders/jobshop/builder.rb
jobshop-0.0.13 app/builders/jobshop/builder.rb
jobshop-0.0.12 app/builders/jobshop/builder.rb
jobshop-0.0.11 app/builders/jobshop/builder.rb
jobshop-0.0.10 app/builders/jobshop/builder.rb
jobshop-0.0.9 app/builders/jobshop/builder.rb
jobshop-0.0.7 app/builders/jobshop/builder.rb
jobshop-0.0.6 app/builders/jobshop/builder.rb
jobshop-0.0.5 app/builders/jobshop/builder.rb