Sha256: 1389590881a574775b2e5886703666cd2e0038e2b5a91e6ef509043afcb3fe39

Contents?: true

Size: 1.8 KB

Versions: 53

Compression:

Stored size: 1.8 KB

Contents

module CmAdmin::FileImport
  extend ActiveSupport::Concern
  included do
    cm_admin do
      STATUS_TAG_COLOR = { in_progress: 'yellow-tag', success: 'success'}
      actions only: [:index, :show]
      set_icon 'fa fa-file-upload'
      cm_index do
        page_title 'File Import'
        page_description 'Manage all file import progress here'

        filter [:id, :associated_model_name], :search, placeholder: 'ID, Table Name'
        filter :status, :single_select,
               collection: %w[in_progress success failed],
               placeholder: 'Status'
        filter :created_at, :date, placeholder: 'Created At'

        column :id
        column :imported_file_name, header: 'File'
        column :created_at, header: 'Created At', field_type: :datetime, format: '%B %d, %Y, %H:%M %p'
        column :status, field_type: :tag, tag_class: STATUS_TAG_COLOR
        column :associated_model_name, header: 'Table name'
        column :added_by_name, header: 'Uploaded By'
        
      end

      cm_show page_title: :id do
        tab :profile, '' do
          cm_show_section 'Import details' do
            field :id, label: 'Import ID'
            field :import_file, label: 'File', field_type: :attachment
            field :created_at, header: 'Created At', field_type: :datetime, format: '%B %d, %Y, %H:%M %p'
            field :completed_at, header: 'Completed At', field_type: :datetime, format: '%B %d, %Y, %H:%M %p'
            field :associated_model_name, header: 'Table name'
            field :added_by_name, header: 'Uploaded By'
            field :status, field_type: :tag, tag_class: STATUS_TAG_COLOR
          end
          cm_show_section 'Errors' do
            field :invalid_row_items, field_type: :custom, helper_method: :formatted_error_message
          end
        end

      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
cm-admin-1.5.1 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.5.0 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.9 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.8 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.7 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.6 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.5 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.4 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.3 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.2 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.1 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.4.0 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.9 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.8 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.7 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.6 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.5 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.4 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.3 app/models/concerns/cm_admin/file_import.rb
cm-admin-1.3.2 app/models/concerns/cm_admin/file_import.rb