application_helper.rb 748 B

123456789101112131415161718192021222324252627
  1. module ApplicationHelper
  2. def nav_link(name, path, options = {})
  3. (<<-HTML).html_safe
  4. <li class='#{(current_page?(path) ? "active" : "")}'>
  5. #{link_to name, path}
  6. </li>
  7. HTML
  8. end
  9. def yes_no(bool)
  10. if bool
  11. '<span class="label label-info">Yes</span>'.html_safe
  12. else
  13. '<span class="label label-default">No</span>'.html_safe
  14. end
  15. end
  16. def working(agent)
  17. if agent.disabled?
  18. link_to 'Disabled', agent_path(agent), :class => 'label label-warning'
  19. elsif agent.working?
  20. '<span class="label label-success">Yes</span>'.html_safe
  21. else
  22. link_to 'No', agent_path(agent, :tab => (agent.recent_error_logs? ? 'logs' : 'details')), :class => 'label label-danger'
  23. end
  24. end
  25. end