Sha256: c013255cedaae669b6c4f7fbbc4437d2efb34beee6382080f4c504c20603f835

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

class MessageDatatable < AjaxDatatablesRails::Base
  def_delegators :@view, :link_to, :manage_message_path

  def view_columns
    @view_columns ||= {
      id: { source: "Message.id" },
      name: { source: "Message.name" },
      subject: { source: "Message.subject" },
      delivered_at: { source: "Message.delivered_at", searchable: false }
    }
  end

  private

  def data
    records.map do |record|
      {
        link: link_to('<i class="fa fa-search"></i>'.html_safe, manage_message_path(record)),
        id: record.id,
        name: record.name,
        subject: record.subject,
        status: record.status.titleize,
        delivered_at: record.delivered_at.present? ? record.delivered_at.strftime("%B %d, %Y at %I:%M %p") : ''
      }
    end
  end

  # rubocop:disable Style/AccessorMethodName
  def get_raw_records
    Message.unscoped
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackathon_manager-0.5.11 app/datatables/message_datatable.rb