!!! Strict
%html
%title LocomotiveCMS Restful API
%link{ href: '//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.no-icons.min.css', rel: 'stylesheet' }
%link{ href: '//netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css', rel: 'stylesheet' }
%link{ href: '//netdna.bootstrapcdn.com/bootswatch/2.1.1/superhero/bootstrap.min.css', rel: 'stylesheet' }
%script{ src: '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' }
%script{ src: '//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js' }
%body
.container
%header
%h1 LocomotiveCMS Restful API
.row
.span4
.well
%ul.nav.nav-list
- resources.each do |resource|
%li.nav-header= resource[:name].humanize
- resource[:actions].each do |name, info|
%li
%a{ href: "##{resource[:name].downcase}-#{name.downcase}" }
= name
- case info[:verb]
- when 'GET'
%span.label.label-info GET
- when 'POST'
%span.label.label-success POST
- when 'PUT'
%span.label.label-warning UPDATE
- when 'DELETE'
%span.label.label-important DELETE
.span8
- resources.each do |resource|
%h2= resource[:name].humanize
%p= resource[:overall]
%br
- resource[:actions].each do |name, info|
%h4{ id: "#{resource[:name].downcase}-#{name.downcase}" }
- case info[:verb]
- when 'GET'
%span.label.label-info GET
- when 'POST'
%span.label.label-success POST
- when 'PUT'
%span.label.label-warning UPDATE
- when 'DELETE'
%span.label.label-important DELETE
= info[:path]
.well
%p= info[:description]
- if info[:params] || (info[:example] && info[:example][:command])
%h5
%i.icon-signin
Params
- if info[:params].blank?
%p None
- else
%table.table.table-bordered.table-striped.table-hover
%tr
%th Name
%th Type
%th Required
%th Description
- info[:params].each do |name, attributes|
%tr
%td
- if attributes[:required]
= name
- else
%i= name
- unless attributes[:alias_of].blank?
alias of
%span.label.label-info= attributes[:alias_of]
%td
- if attributes[:type] == 'Array' && attributes[:collection_of]
- name = attributes[:collection_of][:name]
Collection of
%a{ href: "##{name.dasherize}" }= name.humanize
- elsif attributes[:alias_of]
—
- else
= attributes[:type]
%td
- if attributes[:required]
%i.icon-ok
- else
—
%td= attributes[:description]
- if info[:example] && info[:example][:command]
%h6 Example
%pre.prettyprint= info[:example][:command]
- if info[:response] || (info[:example] && info[:example][:response])
%h5
%i.icon-signout
Response
- if info[:response]
%table.table.table-bordered.table-striped.table-hover
%tr
%th Name
%th Type
%th Description
- info[:response].each do |name, attributes|
%tr
%td= name
%td
- if attributes[:type] == 'Array' && attributes[:collection_of]
- name = attributes[:collection_of][:name]
Collection of
%a{ href: "##{name.dasherize}" }= name.humanize
- elsif attributes[:alias_of]
—
- else
= attributes[:type]
%td= attributes[:description] || '—'
- if info[:example] && info[:example][:response]
%h6 Example
%pre.prettyprint= info[:example][:response]
%br
%hr
%h2 Embedded resourcess
%br
- embedded_resources.each do |resource|
%h4{ id: resource[:name].dasherize }= resource[:name].humanize
.well
%ul.nav.nav-tabs
%li.active
%a{ href: "##{resource[:name].dasherize}-getters", data: { toggle: 'tab' } } Out
%li
%a{ href: "##{resource[:name].dasherize}-setters", data: { toggle: 'tab' } } In
.tab-content
- %w(getters setters).each do |type|
.tab-pane{ id: "#{resource[:name].dasherize}-#{type}", class: "#{'active' if type == 'getters' }" }
- list = resource[type.to_sym]
%table.table.table-bordered.table-striped.table-hover
%tr
%th Name
%th Type
- if type == 'setters'
%th Required
%th Description
- list.each do |name, attributes|
%tr
%td
- if attributes[:required]
= name
- else
%i= name
- unless attributes[:alias_of].blank?
%b alias of
%span.label.label-info= attributes[:alias_of]
%td
- if attributes[:type] == 'Array' && attributes[:collection_of]
- name = attributes[:collection_of][:name]
Collection of
%a{ href: "##{name.dasherize}" }= name.humanize
- elsif attributes[:alias_of]
—
- else
= attributes[:type]
- if type == 'setters'
%td
- if attributes[:required]
%i.icon-ok
- else
—
%td= attributes[:description]
%hr