application_helper.rb 578B

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