Sha256: 28354df88586ad01c3277fde723ce96389202368a7c37a585e62434eafea54aa

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

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 button_input_types
        "input[type=submit], input[type=reset], button[type=submit]"
      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 number search tel time url datetime date datetime-local week month}.collect do |type| 
          "input[type=#{type}]"
        end
      end
      
      def textarea_input_types
        "textarea"
      end

    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facades-0.1.0 lib/facades/sass_ext/form_elements.rb
facades-0.0.7 lib/facades/sass_ext/form_elements.rb
facades-0.0.6 lib/facades/sass_ext/form_elements.rb
facades-0.0.5 lib/facades/sass_ext/form_elements.rb
facades-0.0.4 lib/facades/sass_ext/form_elements.rb
facades-0.0.3 lib/facades/sass_ext/form_elements.rb