application_helper.rb 571B

1234567891011121314151617181920
  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 working(agent)
  10. if agent.disabled?
  11. link_to 'Disabled', agent_path(agent), :class => 'label label-warning'
  12. elsif agent.working?
  13. '<span class="label label-success">Yes</span>'.html_safe
  14. else
  15. link_to 'No', agent_path(agent, :tab => (agent.recent_error_logs? ? 'logs' : 'details')), :class => 'label label-danger'
  16. end
  17. end
  18. end