Sha256: 4152bfd810762144b9989129d54438d34684289c42a4f434af3c718d337e5c23

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module ActiveScaffold
  module Helpers
    # Helpers that assist with the rendering of a Form Column
    module FormColumns
      def active_scaffold_input_file_column(column, options)
        if @record.send(column.name) 
          # we already have a value?  display the form for deletion.
          content_tag(
            :div, 
            content_tag(
              :div, 
              get_column_value(@record, column) + " " +
              hidden_field(:record, "delete_#{column.name}", :value => "false") +
              " | " +
              link_to_function(as_("Remove file"), "$(this).previous().value='true'; p=$(this).up(); p.hide(); p.next().show();"),
              {}
            ) +
            content_tag(
              :div,
              file_column_field("record", column.name, options),
              :style => "display: none"
            ),
            {}
          )
        else
          # no, just display the file_column_field
          file_column_field("record", column.name, options)
        end
      end      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
antfarm-0.3.0 rails/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui.rb
antfarm-0.4.0 rails/vendor/plugins/active_scaffold/lib/bridges/file_column/lib/form_ui.rb