Class: OrdergroupsCsv

Inherits:
RenderCSV show all
Includes:
ApplicationHelper
Defined in:
lib/ordergroups_csv.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#base_errors, #bootstrap_flash_patched, #close_button, #expand, #foodcoop_css_path, #foodcoop_css_tag, #format_currency, #format_date, #format_datetime, #format_datetime_timespec, #format_roles, #format_time, #heading_helper, #icon, #items_per_page, #link_to_gmaps, #link_to_top, #pagination_links_remote, #remote_link_to, #show_title?, #show_user, #show_user_link, #sort_link_helper, #tab_is_active?, #title, #truncate, #weekday

Methods included from PathHelper

#finance_group_transactions_path

Methods inherited from RenderCSV

#initialize, #number_to_currency, #save_tmp, #to_csv

Constructor Details

This class inherits a constructor from RenderCSV

Instance Method Details

#dataObject


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ordergroups_csv.rb', line 22

def data
  @object.each do |o|
    row = [
      o.id,
      o.name,
      o.description,
      o.,
      o.created_on,
      o.contact_person,
      o.contact_phone,
      o.contact_address,
      o.break_start,
      o.break_end,
      o.last_user_activity,
      o.last_order.try(:starts),
    ]
    yield row + Ordergroup.custom_fields.map { |f| o.settings.custom_fields[f[:name]] }
  end
end

#headerObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ordergroups_csv.rb', line 4

def header
  row = [
    Ordergroup.human_attribute_name(:id),
    Ordergroup.human_attribute_name(:name),
    Ordergroup.human_attribute_name(:description),
    Ordergroup.human_attribute_name(:account_balance),
    Ordergroup.human_attribute_name(:created_on),
    Ordergroup.human_attribute_name(:contact_person),
    Ordergroup.human_attribute_name(:contact_phone),
    Ordergroup.human_attribute_name(:contact_address),
    Ordergroup.human_attribute_name(:break_start),
    Ordergroup.human_attribute_name(:break_end),
    Ordergroup.human_attribute_name(:last_user_activity),
    Ordergroup.human_attribute_name(:last_order),
  ]
  row + Ordergroup.custom_fields.map { |f| f[:label] }
end