%div{id: “repo-#{@repo.id}-config” }

!= JST["repos/menu"](repo: @repo, active: "config")

.title
  %h2
    %span#repo-name
      = @repo.name
    -#= haml :"repos/spinner", locals: {repo: repo}

  %h5
    %strong= @repo.url

.panel.panel-default
  .panel-heading
    Config Post Hook

  .panel-body

    - if @hook.config
      .col-sm-12

        .pull-right
          .badge
            = if @hook.active then "active" else "disabled"

        %h2
          %a{ href: @hook.url}
            = @hook.name
            \-
            = @hook.id

      %h4 Config:
      %ul
        - if @hook.config.secret
          %li
            %strong secret:
            = @hook.config.secret
        %li
          %strong url:
          = @hook.config.url
        %li
          %strong content type:
          = @hook.config.content_type
        %li
          %strong events:
          = @hook.events
        %li
          %strong ssl:
          = @hook.config.insecure_ssl

      %h4 Test url:
      %p
        = @hook.test_url

      %h4 Ping url:
      %p
        = @hook.ping_url

      %h4 Last response:
      %p

        - if @hook.last_response
          %strong Code:
          = @hook.last_response.code
          %strong Status:
          = @hook.last_response.status
          %strong Message:
          = @hook.last_response.message

    - else

      .col-sm-12
        %h2 No hay hook
        %h3
          = "Will create new hook."

        %form#add-hook{:action => "/repos/#{@repo.name}/add_hook", method: "post"}
          %input{:type => "text", name: "webhook_url", placeholder: "type the receive hook url...", style:"width:250px"}
          %button Send

        %p.small
          we are going to send the hook to
          %strong
            = @repo.url