summaryrefslogtreecommitdiff
path: root/views/data.jade
blob: 15189e91087c0dffcdbeaddfccba4d5146744086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
extends layout

block link
  - var name = typeof link.name == 'string' ? link.name : '<no name attribute>'
  - var prompt = typeof link.prompt == 'string' ? link.prompt : '<no prompt attribute>'
  table
    tr
      td href
      td: a(href=link.href, name=link.name) #{link.href}
    tr
      td rel
      td 
        if isUrl(link.rel)
          a(href=link.rel) #{link.rel}
        else
          | #{link.rel}
    tr
      td name
      td #{name}
    tr
      td prompt
      td #{prompt}
    if link.render == 'image'
      tr
        td
        td: img(src=link.href, alt=link.name, title=name)

block content
  h1 Collection+JSON Explorer
  p Viewing #{url}

  form(action="/render")
    p
      label URL:
        input(name="url", value=url)
      input(type="submit", value="Render")

  form(action="http://redbot.org/?")
    p
      input(name="uri", value=url, type="hidden")
      input(type="submit", value="Check with redbot.org")

  ul
    li
      a(href="#meta") Meta
    li
      a(href="#items") Items
    li
      a(href="#headers") Headers
    li
      a(href="#formatted-body") Formatted body
    li
      a(href="#body") Raw body

  a(id="meta")
    h1
      a(href="#meta") Meta

    table
      tr
        td Version
        td #{doc.version}
      tr
        td URI
        td
          if typeof doc.uri == 'string'
            a(href=doc.uri) #{doc.uri}
          else
            span No URI

    h2 Collection Links
    each link, i in doc.links
      h3 Collection Link ##{i}
      block link

  a(id="items"): h1: a(href="#items") Items
  each item, i in doc.items
    a(id="item-#{i+1}")
      h2: a(href="#item-#{i+1}") Item ##{i+1}

    if typeof item.href == 'string'
      | href 
      a(href=item.href) #{item.href}

    h2 Item Links
    each link, i in item.links
      h3 Item Link ##{i}
      block link

    h3 Data
      table
        each data in item.data
          tr
            td #{data.name}
            td #{data.value}

  a(id="headers"): h1: a(href="#headers") Headers
  pre
    table
      each value, key in headers
        tr
          td #{key}:
          td #{value}

  a(id="formatted-body"): h1: a(href="#formatted-body") Formatted body
  pre= formattedRaw

  a(id="body"): h1: a(href="#body") Raw body
  pre= raw