Sha256: c8e73e8f26124ba2ba6b00e4fd5787c04feece8f8dbbe496b9e79961559098e3

Contents?: true

Size: 1.07 KB

Versions: 53

Compression:

Stored size: 1.07 KB

Contents

module ActiveScaffold
  module Helpers
    module FormColumnHelpers
      def active_scaffold_input_dragonfly(column, options)
        options = active_scaffold_input_text_options(options)
        input = file_field(:record, column.name, options)
        dragonfly = @record.send("#{column.name}")
        if dragonfly.present?
          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_dragonfly(column, @record)
          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

53 entries across 53 versions & 3 rubygems

Version Path
active_scaffold-sequel-0.7.1 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-sequel-0.7.0 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-sequel-0.6.2 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-sequel-0.6.1 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-sequel-0.6.0 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.20 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.19 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.17 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.16 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.15 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.14 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.13 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.12 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.11 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.10 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.9 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.8 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.7 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.6 lib/active_scaffold/bridges/dragonfly/form_ui.rb
active_scaffold-3.2.5 lib/active_scaffold/bridges/dragonfly/form_ui.rb