nav.DashboardNavigation
  ul.DashboardNavigation-list
    // Applications & Application Plans
    - if can? :manage, :partners
      li.DashboardNavigation-list-item
        // Applications
        => dashboard_collection_link 'Application',
                                     service.cinstances,
                                     admin_service_applications_path(service)

        // Application Plans
        - if can?(:edit, service)
          == dashboard_secondary_collection_link 'Plan',
                                                 service.application_plans.not_custom,
                                                 admin_service_application_plans_path(service)

    // Subscriptions & Service Plans
    - if show_subscriptions_on_dashboard?(service)
      li.DashboardNavigation-list-item
        // Subscriptions (would be nice to have API specific links)
        => dashboard_collection_link 'Subscription',
                                     service.service_contracts,
                                     admin_buyers_service_contracts_path(search: {service_id: service.id})

        // Service Plans
        - if show_service_plans_on_dashboard?(service)
          == dashboard_secondary_collection_link 'Plan',
                                                service.service_plans.not_custom,
                                                admin_service_service_plans_path(service)

    // End-users & End-user Plans
    - if show_end_users_on_dashboard?(service)
      li.DashboardNavigation-list-item
        // End-users (not countable)
        = link_to 'End-users',
                  admin_service_end_users_path(service),
                  class: "DashboardNavigation-link"

        // End-user Plans
        - if service.end_user_plans.size > 1
          == dashboard_secondary_collection_link 'Plan',
                                                 service.end_user_plans,
                                                 admin_service_end_user_plans_path(service)

    // Integration
    - if can?(:edit, service) && !service.has_traffic?
      li.DashboardNavigation-list-item.u-notice
        = link_to "Integrate this API",
                  path_to_service(service),
                  class: "DashboardNavigation-link u-notice"

    // Integration Errors
    = dashboard_widget :service_integration_errors, service_id: service.to_param
