etnbrd/flx-compiler

View on GitHub
test-set/express-endpoint-master/views/doc.jade

Summary

Maintainability
Test Coverage
doctype html
html
  head
    - config.stylesheets.forEach(function(css) {
        link(rel="stylesheet", href="#{css}", type="text/css", media="screen")
    - })
    script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", type="text/javascript")
    script(src="http://cloud.github.com/downloads/medialize/URI.js/URI.min.js", type="text/javascript")
    script(src="/endpoint/js/script.js", type="text/javascript")
  body
    div#header
      div.title
      div.description
        p

    div#body
      div.errors
        - if ("undefined" != typeof errors && errors.length > 0) {
          div.error
            - errors.forEach(function(error) {
              div
                - if (error.parameterName) {
                    p Error on paramater [#{error.parameterName}]: #{error.message}
                - } else {
                    p An application error occurred: #{error.message}
                    pre #{error.stack}
                - }
            - })
        - }
      div.doc
        ul.endpoints
          - endpoints.forEach(function(endpoint) {
            - if (endpoint) {
              div.endpoint
                div.section.path
                  div.section_title
                    p Path
                  div.section_text
                    p.pathname #{endpoint.path}

                div.section.description
                  div.section_title
                    p Description
                  div.section_text
                    p #{endpoint.description}

                div.section.params
                  div.section_title
                    p Parameters
                  div.section_text
                    dl.params
                      - Hash(endpoint.parameters).forEach(function(parameter, name) {
                      -   var classes = parameter.rules.map(function(rule) {return rule.split('(')[0]}).join(" ");
                        dt(class=classes) #{parameter.name}
                        dd
                          input(name=parameter.name, class=classes)
                          =parameter.description
                      - })

                    input.tryItButton(type="button", value="Try It")
                    br

                div.section.example
                  div.section_title
                    p Example
                  div.section_text
                    div.url
                      a(href='#{endpoint.example}')
                        span.pathname #{endpoint.exampleUrl.pathname}
                        \?
                        ul.params
                          - var i = 0
                          - var query = Hash(endpoint.exampleUrl.query)
                          - var length = query.size
                          - query.forEach(function(value, name) {
                          -   i++
                          li.param
                            span.name #{name}
                            \=
                            span.value #{value}
                            - if (length > i) {
                              &
                            - }
                          - })
            - }
          - })