Sha256: 9f55a119a4d2647b9a1234baf47036b7b31e827bb57c5948c2a7eb63f38ddf30

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

module Facades
  module SassExt
    module FormElements
  
      def fields_of_type(*args)
        types = args.collect do |type|
          send(:"#{type}_input_types")
        end
        Sass::Script::String.new(types.join(", "))
      end
      
      private
      
      def all_input_types
        [:checkbox, :password, :radio, :select, :string, :textarea].collect{ |t| send(:"#{t}_input_types") }.flatten.compact
      end
      
      def checkbox_input_types
        "input[type=checkbox]"
      end
      alias :check_input_types :checkbox_input_types
      
      def password_input_types
        "input[type=password]"
      end
      
      def radio_input_types
        "input[type=radio]"
      end
      
      def select_input_types
        "select"
      end
      
      def string_input_types
        %w{email password text}.collect{ |t| "input[type=#{t}]" }        
      end
      
      def textarea_input_types
        "textarea"
      end

    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facades-0.0.2 lib/facades/sass_ext/form_elements.rb