%html

%head
  %style{:type => 'text/css'}=css
%body
  %ul.breadcrumb.well{:style=>'margin-bottom:0;'}
    %li
      %a{ :href => url('/docs') } Documentation
      %span.divider='/'
    %li.active=collection.collection_name.to_s.split('_').map {|p| p.capitalize}.join(' ')
  .container
    %h1.pull-right=collection.collection_name.to_s.split('_').map {|p| p.capitalize}.join(' ')
    %blockquote.clearfix
      %p{ :style => 'width : 400px;font-size:small;padding-top:1em;'}
        =collection.description || 'Collection does not have description set'
    - if !collection.features.empty?
      %h3 Features
      %table.table.table-bordered
        %thead
          %tr
            %th Name
            %th Constraints
            %th Description
        %tbody.features
          - collection.features.each do |f|
            %tr
              %td.feature
                %em=f.name
              %td
                - f.constraints.each do |c, v|
                  ="#{c}=#{v}<br/>"
              %td
                %small=f.description

    - if !collection.collections.empty?
      %h3 Sub-Collections
      %table.table.table-bordered
        %tbody
          - collection.collections.each do |c|
            %tr
              %td
                %a{ :href => url(c.docs_url)}=c.collection_name
              %td
                %small=c.description || '%s subcollection of %s' % [ c.collection_name.to_s.capitalize, collection.collection_name]

    %h3 Operations
    %table.table.table-bordered
      %thead
        %tr
          %th Name
          %th HTTP method
          %th URL
          %th Description
      %tbody.operations
        - collection.operations.each do |o|
          %tr
            %td
              %a{:href => url(o.docs_url) }=o.operation_name
            %td=o.http_method.to_s.upcase
            %td
              %a{ :href=> url(o.full_path) }=o.full_path
            %td
              %small=o.description
  %footer.footer
    .container
      %p
        Documentation generated by
        %a{ :href => 'http://github.com/mifo/sinatra-rabbit'} Rabbit
        extension.