- page_title << @server.name
- page_title << "Webhooks"

= render 'servers/sidebar', :active_server => @server
= render 'servers/header', :active_nav => :webhooks
= render 'header', :active_nav => :webhooks
.pageContent.pageContent--compact
  - if @webhooks.empty?
    .noData.noData--clean
      %h2.noData__title No webhooks have been configured for this server.
      %p.noData__text
        You haven't added any webhooks for this server yet. A webhook enables your web
        application to be notified when certain events occur in the lifecycle of the mail server.
      %p.noData__button= link_to "Add your first webhook", [:new, organization, @server, :webhook], :class => "button button--positive"
  - else
    %ul.webhookList.u-margin
      - for webhook in @webhooks
        %li.webhookList__item
          .webhookList__top
            %p.webhookList__name= link_to webhook.name, [:edit, organization, @server, webhook]
            %p.webhookList__labels
              - if webhook.enabled?
                %span.label.label--green Enabled
              - else
                %span.label.label--red Disabled
          .webhookList__bottom
            %p.webhookList__usageTime
              - if webhook.last_used_at
                Last sent request #{distance_of_time_in_words_to_now webhook.last_used_at}.
              - else
                Not used yet.
            %ul.webhookList__links
              %li.webhookList__link= link_to "Edit Webhook", [:edit, organization, @server, webhook]

    %p.u-center= link_to "Add another webhook", [:new, organization, @server, :webhook], :class => 'button button--positive'
