Sha256: a896bf026a883b17e18cfc12d214fa2ec6b3428c262b3ee02006f30aa1e0d830

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

object false

node :writer_id do |rec|
  @order.confirmed_writer_id
end

child @notes, root: :notes, object_root: false do
  attributes :author_name, :content_html, :created_at, :updated_at, :dom_css,
             :confirmed_writer_id

  node :id do |rec|
    "#{rec.dom_id}_#{rec.id}"
  end

  node :author do |rec|
    if rec.html_class == 'out'
      rec.author_name
    else
      I18n.t(:self, scope: [:account, :tickets])
    end
  end
end

unless @order.relationships[:attachments].blank? || @order.attachments.blank?
  child @order.attachments, root: :attachments, object_root: false do
    attributes :id, :filename, :size

    node do |rec|
      {
        name: rec.filename.try(:truncate, 128) || "file_#{rec.id}",
        human_size: number_to_human_size(rec.try(:size)),
        type: rec.try(:extention).try(:upcase) || '',
        url: account_order_attachment_path(order_id: @order.number, id: rec.id)
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/views/account/orders/part.json.rabl