Sha256: 9f51bcde1ebacf827d4b188e128138546c8ea8ac61c4b4cca35ca2a5e0acccbb

Contents?: true

Size: 1.07 KB

Versions: 103

Compression:

Stored size: 1.07 KB

Contents

module ActiveScaffold
  module Helpers
    module FormColumnHelpers
      def active_scaffold_input_paperclip(column, options)
        options = active_scaffold_input_text_options(options)
        input = file_field(:record, column.name, options)
        paperclip = @record.send("#{column.name}")
        if paperclip.file?
          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
          
          content = active_scaffold_column_paperclip(column, @record)
          content_tag(:div,
            content + " | " +
              hidden_field(:record, "delete_#{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

103 entries across 103 versions & 5 rubygems

Version Path
active_scaffold-3.2.5 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.2.4 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.2.3 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.2.2 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.2.1 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold_vho-3.0.25 lib/active_scaffold/bridges/paperclip/lib/form_ui.rb
active_scaffold-sequel-0.3.0 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.2.0 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold_vho-3.1.3 lib/active_scaffold/bridges/paperclip/lib/form_ui.rb
active_scaffold_vho-3.1.2 lib/active_scaffold/bridges/paperclip/lib/form_ui.rb
active_scaffold-3.1.20 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.19 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.18 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.17 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.15 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.14 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.0.26 lib/active_scaffold/bridges/paperclip/lib/form_ui.rb
active_scaffold_vho-3.1.1 lib/active_scaffold/bridges/paperclip/lib/form_ui.rb
active_scaffold-3.1.13 lib/active_scaffold/bridges/paperclip/form_ui.rb
active_scaffold-3.1.12 lib/active_scaffold/bridges/paperclip/form_ui.rb