Class: ODDB::Html::State::RegisterExport

Inherits:
Global
  • Object
show all
Includes:
Util::NeedAllInput
Defined in:
lib/oddb/html/state/register_export.rb

Constant Summary collapse

VIEW =
View::RegisterExport

Constants inherited from Global

Global::GLOBAL_MAP, Global::LIMIT

Instance Attribute Summary

Attributes inherited from Global

#passed_turing_test

Attributes included from LoginMethods

#desired_input

Instance Method Summary collapse

Methods included from Util::NeedAllInput

#user_input

Methods inherited from Global

#_download, #compare, #explain_ddd_price, #explain_price, #fachinfo, #feedback, #grant_download, #home, #limit_state, #limited?, #logout, #method_missing, #navigation, #package, #package_infos, #partitioned_keys, #patinfo, #proceed_download, #proceed_poweruser, #product, #products, #remote_infos, #sequence

Methods included from PayPal::Checkout

#ajax_autofill, #checkout, #checkout_keys, #checkout_mandatory, #create_user

Methods included from PayPal::Download

#collect

Methods included from Util::Download

compressed_download, #compressed_download

Methods included from LoginMethods

#login_

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ODDB::Html::State::Global

Instance Method Details

#direct_eventObject



20
21
22
# File 'lib/oddb/html/state/register_export.rb', line 20

def direct_event
  [:proceed_export, :query, @query, :dstype, @dstype]
end

#initObject



14
15
16
17
18
19
# File 'lib/oddb/html/state/register_export.rb', line 14

def init
  super
  @query = @session.persistent_user_input(:query)
  @dstype = @session.persistent_user_input(:dstype) \
    || ODDB.config.default_dstype
end

#proceed_exportObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/oddb/html/state/register_export.rb', line 23

def proceed_export
  query = @session.persistent_user_input(:query)
  dstype = @session.persistent_user_input(:dstype) \
    || ODDB.config.default_dstype
  filename = sprintf('%s_%s.csv', query.tr(' ', '-'), dstype)
  if @model.is_a?(ODDB::Business::Invoice) \
    && @model.items.any? { |item| item.text == filename }
    self
  else
    super
  end
end