Sha256: e3cff596f9525249cc671c9157ed9e86dc515d589026d459c2137b8a286c927e
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
module ActiveScaffold module Helpers module FormColumnHelpers def active_scaffold_input_carrierwave(column, options) options = active_scaffold_input_text_options(options) input = file_field(:record, column.name, options) carrierwave = @record.send("#{column.name}") if carrierwave.file.present? && !carrierwave.file.empty? if ActiveScaffold.js_framework == :jquery js_remove_file_code = "$(this).prev().val('true'); $(this).parent().hide().next().show(); return false;"; else js_remove_file_code = "$(this).previous().value='true'; $(this).up().hide().next().show(); return false;"; end hidden_field_options = { :name => options[:name].gsub(/\[#{column.name}\]$/, "[delete_#{column.name}]"), :id => options[:id] + '_delete', :value => "false" } content_tag( :div, content_tag(:div, ( get_column_value(@record, column) + " | " + hidden_field(:record, "delete_#{column.name}", hidden_field_options) + content_tag(:a, as_(:remove_file), {:href => '#', :onclick => js_remove_file_code}) + hidden_field(:record, "#{column.name}_cache", {:name => options[:name].gsub(/\[#{column.name}\]$/, "[#{column.name}_cache]")}) ).html_safe ) + content_tag(:div, input, :style => "display: none") ) else input end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_scaffold_vho-3.0.12 | lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb |
active_scaffold_vho-3.0.11 | lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb |