Module: RequirejsControllersHelper
- Defined in:
- app/helpers/requirejs_controllers_helper.rb
Instance Method Summary collapse
Instance Method Details
#requirejs_controller_tag ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/requirejs_controllers_helper.rb', line 2 def requirejs_controller_tag html = requirejs_include_tag html.concat " <script>\n define('main', function() {\n require(['controllers/\#{controller.controller_path}'], function(controller) {\n window.controller = new controller('\#{controller.action_name}')\n })\n })\n </script>\n HTML\n html.html_safe\nend\n".html_safe |