Class: ODDB::Html::State::Drugs::AtcBrowser
- Defined in:
- lib/oddb/html/state/drugs/atc_browser.rb
Constant Summary collapse
- DIRECT_EVENT =
:atc_browser
- LIMIT =
true
- VIEW =
View::Drugs::AtcBrowser
Constants inherited from Global
Instance Attribute Summary
Attributes inherited from Global
Attributes included from LoginMethods
Instance Method Summary collapse
Methods inherited from Global
Methods included from Events
#_compare, #_complete, #_explain_ddd_price, #_explain_price, #_fachinfo, #_feedback, #_package, #_package_by_code, #_package_infos, #_patinfo, #_products, #_remote, #_remote_comparables, #_remote_infos, #_remote_package, #_remote_packages, #_search, #_search_append_products, #_search_append_sequences, #_search_by, #_search_local, #_search_remote, #_tax_factor, #compare_remote, #ddd, #limited?, #navigation, #search
Methods inherited from Global
#_download, #compare, #explain_ddd_price, #explain_price, #fachinfo, #feedback, #home, #limit_state, #limited?, #logout, #method_missing, #navigation, #package, #package_infos, #partitioned_keys, #patinfo, #proceed_export, #proceed_poweruser, #product, #products, #remote_infos, #sequence
Methods included from PayPal::Checkout
#ajax_autofill, #checkout, #checkout_keys, #checkout_mandatory, #collect, #create_user
Methods included from LoginMethods
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ODDB::Html::State::Global
Instance Method Details
#init ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/oddb/html/state/drugs/atc_browser.rb', line 15 def init @model = ODDB::Drugs::Atc.search_by_level_and_code(1, '') if(code = @session.user_input(:code)) parent = ODDB::Drugs::Atc.find_by_code(code) level = parent.level.next children = ODDB::Drugs::Atc.search_by_level_and_code(level, parent.code) while(level < 5 && children.size == 1) child = children.first level = level.next children = ODDB::Drugs::Atc.search_by_level_and_code(level, child.code) @model.concat children end parent.level.next.downto(2) { |level| @model.concat ODDB::Drugs::Atc.search_by_level_and_code(level, parent.code) parent = parent.parent } end @model.sort! end |