Class: Backend::ExportsController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/exports_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#indexObject


23
24
25
26
# File 'app/controllers/backend/exports_controller.rb', line 23

def index
  # FIXME: It should not be necessary to do that
  DocumentTemplate.load_defaults unless DocumentTemplate.any?
end

#showObject


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/backend/exports_controller.rb', line 28

def show
  unless klass = Aggeratio[params[:id]]
    head :not_found
    return
  end

  klass.parameters.each do |parameter|
    next if parameter.record_list?
    value_preference = "exports.#{klass.name}.parameters.#{parameter.name}.value"
    value = current_user.preference(value_preference, parameter.default).value
    params[parameter.name] ||= value
    current_user.prefer!(value_preference, params[parameter.name])
  end

  @aggregator = klass.new(params)
  t3e name: klass.human_name
  respond_with @aggregator
end