Class: Waw::Routing::Feedback
- Inherits:
-
RoutingRule
- Object
- RoutingRule
- Waw::Routing::Feedback
- Defined in:
- lib/waw/routing/feedback.rb
Overview
Feedback routing
Instance Method Summary collapse
- #generate_js_code(result, align = 0) ⇒ Object
-
#initialize(opts = {}) ⇒ Feedback
constructor
Creates a feedback instance.
Methods inherited from RoutingRule
Constructor Details
#initialize(opts = {}) ⇒ Feedback
Creates a feedback instance
7 8 9 |
# File 'lib/waw/routing/feedback.rb', line 7 def initialize(opts = {}) @opts = opts end |
Instance Method Details
#generate_js_code(result, align = 0) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/waw/routing/feedback.rb', line 11 def generate_js_code(result, align=0) selector = @opts[:css_selector] || '.feedback' buffer = "" buffer << " "*align + "$(form + ' input').hide();\n" if @opts[:hide_input] buffer << " "*align + "$(form + ' #{selector}').show();\n" = @opts[:message] ? "'#{@opts[:message]}'" : 'data[1][0]' buffer << " "*align + "$(form + ' #{selector}').html(messages[#{}]);" buffer end |