Sha256: 8a7a128515ce71249345e2d2f7f46f88e4d6ff061d270737511bc9bd267d28e3
Contents?: true
Size: 1.43 KB
Versions: 17
Compression:
Stored size: 1.43 KB
Contents
module ActiveScaffold module Helpers module FormColumnHelpers def active_scaffold_input_dragonfly(column, options) record = options[:object] ActiveSupport::Deprecation.warn "Relying on @record is deprecated, include :object in html_options with record.", caller if record.nil? # TODO Remove when relying on @record is removed record ||= @record # TODO Remove when relying on @record is removed options = active_scaffold_input_text_options(options.merge(column.options)) input = file_field(:record, column.name, options) dragonfly = record.send("#{column.name}") if dragonfly.present? case ActiveScaffold.js_framework when :jquery js_remove_file_code = "jQuery(this).prev().val('true'); jQuery(this).parent().hide().next().show(); return false;"; when :prototype js_remove_file_code = "$(this).previous().value='true'; $(this).up().hide().next().show(); return false;"; end content = active_scaffold_column_dragonfly(record, column) content_tag(:div, content + " | " + hidden_field(:record, "remove_#{column.name}", :value => "false") + content_tag(:a, as_(:remove_file), {:href => '#', :onclick => js_remove_file_code}) ) + content_tag(:div, input, :style => "display: none") else input end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems