Sha256: c51a2d314dda67aa37f9a6dd592fa3a9f1fdf32b4b35dc7dc6c2e9a9fbf090eb

Contents?: true

Size: 702 Bytes

Versions: 6

Compression:

Stored size: 702 Bytes

Contents

# This allows the app to call f.input :something, :as => :asset_box
# in either Formtastic or SimpleForm, but not both at the same time

if defined?(SimpleForm)
  class AssetBoxInput < SimpleForm::Inputs::FileInput
    def input(wrapper_options = nil)
      AssetBox.new(object, object_name, template, attribute_name, options).to_html
    end
  end
elsif defined?(Formtastic)
  class AssetBoxInput < Formtastic::Inputs::FileInput
    def to_html
      input_wrapping do
        label_html << AssetBox.new(@object, @object_name, @template, @method, @options).to_html
      end
    end
  end
else
  class AssetBoxInput < Object
    def to_html
      'expected simpleform or formtastic'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_assets-1.12.2 lib/inputs/asset_box_input.rb
effective_assets-1.12.1 lib/inputs/asset_box_input.rb
effective_assets-1.12.0 lib/inputs/asset_box_input.rb
effective_assets-1.11.5 lib/inputs/asset_box_input.rb
effective_assets-1.11.4 lib/inputs/asset_box_input.rb
effective_assets-1.11.3 lib/inputs/asset_box_input.rb