module Reins::ViewHelpers
Public Instance Methods
call_reins_controller()
click to toggle source
Helper for use in js.erb templates to automatically call the reins controller and action that matches the current rails controller and action name.
- Returns
-
The javascript code that will perform the necessary actions.
# File lib/reins/view_helpers.rb, line 29 def call_reins_controller "#{ update_reins_controller }r.call_js_controller();".html_safe end
reins_script_tag()
click to toggle source
Helper that creates a <script> tag insertable into HTML templates to set the reins controller and action to the current rails controller and action name.
- Returns
-
The javascript code that will perform the necessary actions.
# File lib/reins/view_helpers.rb, line 8 def reins_script_tag "<script>#{ update_reins_controller }</script>".html_safe end
update_reins_controller()
click to toggle source
Helper that emits JS code to set the reins controller and action to the current rails controller and action name.
- Returns
-
The javascript code that will perform the necessary actions.
# File lib/reins/view_helpers.rb, line 17 def update_reins_controller "r.controller = '#{ params[:controller] }'; r.action = '#{ params[:action] }'; r.params = #{ @reins_params.to_json };".html_safe end