Class: ODDB::Html::State::Drugs::Feedback
- Includes:
- Util::NeedAllInput
- Defined in:
- lib/oddb/html/state/drugs/feedback.rb
Defined Under Namespace
Classes: Feedbackable
Constant Summary collapse
Constants inherited from Global
Instance Attribute Summary collapse
-
#passed_turing_test ⇒ Object
readonly
Returns the value of attribute passed_turing_test.
Attributes included from LoginMethods
Instance Method Summary collapse
Methods included from Util::NeedAllInput
Methods inherited from Global
Methods included from Events
#_compare, #_complete, #_explain_ddd_price, #_explain_price, #_fachinfo, #_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, #_sequence_by_code, #_tax_factor, #compare_remote, #ddd, #limited?, #navigation, #search
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_export, #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
Methods included from Util::Download
compressed_download, #compressed_download
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 Attribute Details
#passed_turing_test ⇒ Object (readonly)
Returns the value of attribute passed_turing_test.
32 33 34 |
# File 'lib/oddb/html/state/drugs/feedback.rb', line 32 def passed_turing_test @passed_turing_test end |
Instance Method Details
#_feedback(code) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/oddb/html/state/drugs/feedback.rb', line 44 def _feedback(code) if(@model.code(:cid, 'DE') == code || @model.uid == code) self else super end end |
#direct_event ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/oddb/html/state/drugs/feedback.rb', line 37 def direct_event direct_event = [:feedback] if(code = @model.code(:cid, 'DE')) direct_event.push([:pzn, code.value]) end direct_event end |
#init ⇒ Object
33 34 35 36 |
# File 'lib/oddb/html/state/drugs/feedback.rb', line 33 def init @model = Feedbackable.new(@model) super end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/oddb/html/state/drugs/feedback.rb', line 51 def update mandatory = [:name, :email, :email_public, :item_good_experience, :item_recommended, :item_good_impression, :item_helps] unless @passed_turing_test mandatory.push :captcha end keys = mandatory + [:message] hash = user_input(keys, mandatory) if(@passed_turing_test) # do nothing elsif((candidates = hash[:captcha]) && candidates.any? { |key, word| @session.lookandfeel.captcha.valid_answer? key, word }) @passed_turing_test = true else @errors.store(:captcha, create_error('e_failed_turing_test', :captcha, nil)) end unless(error?) feedback = @model.current info_key = (@model.created?) ? :feedback_changed : :feedback_saved hash.each { |key, value| writer = "#{key}=" if(feedback.respond_to? writer) feedback.send writer, value end } feedback.time = Time.now feedback.item = @model.item feedback.save @session.update_feedback_rss_feed @infos = [info_key] end self end |