application.html.erb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title><%= content_for?(:title) ? yield(:title) : "Huginn" %></title>
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <%= stylesheet_link_tag "application", :media => "all" %>
  10. <%= javascript_include_tag "application" %>
  11. <%= csrf_meta_tags %>
  12. <%= yield(:head) %>
  13. </head>
  14. <body>
  15. <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  16. <div class="container">
  17. <%= render 'layouts/navigation' %>
  18. </div>
  19. </nav>
  20. <div id="main" role="main">
  21. <div class="container">
  22. <div class="row">
  23. <%= render 'layouts/messages' %>
  24. </div>
  25. </div>
  26. <% if user_signed_in? %>
  27. <%= render "upgrade_warning" %>
  28. <% end %>
  29. <div id="main-content">
  30. <%= yield %>
  31. </div>
  32. </div>
  33. <script>
  34. window.agentPaths = {};
  35. window.agentNames = [];
  36. <% if current_user.present? -%>
  37. var myAgents = <%= Utils.jsonify(current_user.agents.pluck(:name, :id).inject({}) {|m, a| m[a.first] = agent_path(a.last); m }) %>;
  38. var myScenarios = <%= Utils.jsonify(current_user.scenarios.pluck(:name, :id).inject({}) {|m, s| m[s.first + " Scenario"] = scenario_path(s.last); m }) %>;
  39. $.extend(window.agentPaths, myAgents);
  40. $.extend(window.agentPaths, myScenarios);
  41. window.agentPaths["All Agents Index"] = <%= Utils.jsonify agents_path %>;
  42. window.agentPaths["New Agent"] = <%= Utils.jsonify new_agent_path %>;
  43. window.agentPaths["Account"] = <%= Utils.jsonify edit_user_registration_path %>;
  44. window.agentPaths["Events Index"] = <%= Utils.jsonify events_path %>;
  45. window.agentPaths["View Agent Diagram"] = <%= Utils.jsonify diagram_path %>;
  46. window.agentPaths["Run Event Propagation"] = { url: <%= Utils.jsonify propagate_agents_path %>, method: 'POST' };
  47. $.each(window.agentPaths, function(name, v) { window.agentNames.push(name); });
  48. <% end -%>
  49. </script>
  50. </body>
  51. </html>