From 217e98f75fd6774764b0ac924c6f642bff2dfb18 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 2 Jul 2012 18:11:17 +0200 Subject: o Adding support for queries. --- views/data.jade | 80 +++++++++++++++++++++++++++----------------------------- views/index.jade | 2 +- 2 files changed, 40 insertions(+), 42 deletions(-) (limited to 'views') diff --git a/views/data.jade b/views/data.jade index f5a3b0a..5ef6ab6 100644 --- a/views/data.jade +++ b/views/data.jade @@ -48,23 +48,23 @@ block meta form(action='http://redbot.org/?') p - input(name='uri', value=url, type='hidden') - input(name='req_hdr', value='Accept: application/vnd.collection+json', type='hidden') - input(type='submit', value='Check with redbot.org') + input(type='text', name='uri', value=url, type='hidden') + input(type='text', name='req_hdr', value='Accept: application/vnd.collection+json', type='hidden') + input(type='text', type='submit', value='Check with redbot.org') - h2 Collection Links - if collection.links.length == 0 - p Collection has no links. - else + if collection.links.length > 0 + h2 Collection Links each link, i in collection.links - var title = link.prompt || link.name - title = title ? ': ' + title : '' h3 Collection Link ##{i}#{title} block link +// TODO: If the collection has prev/next links, add buttons to +// automaticaly navigate those. +// TODO: Add ability to show the raw part of the collection. block items - // a(id='items'): h1: a(href='#items') Items if collection.items.length == 0 p Collection has to items. else @@ -77,10 +77,8 @@ block items p href: block href - h3 Item Links - if item.links.length == 0 - p Item has no links. - else + if item.links.length > 0 + h3 Item Links each link, i in item.links h4 Item Link ##{i} block link @@ -90,19 +88,28 @@ block items each data in item.data dt #{data.name} dd #{data.value} - // - table(class='table table-striped table-bordered') - each data in item.data - tr - th #{data.name} - td #{data.value} - // - div(class='form-horizontal') - each data in item.data - div(class='control-group') - label(class='control-label') #{data.name} - div(class='controls') - div #{data.value} + +block queries + each query in collection.queries + - var name = query.prompt || query.name || 'Unnamed query' + h2= name + + div(class='row') + div(class='span12') + form(action='/render', class='well form-horizontal') + input(type='hidden', name='url', value=query.href) + fieldset + each data in query.data + - var value = params[data.name] || data.value + div(class='control-group') + label(class='control-label', for=data.name) #{data.name} + div(class='controls') + input(type='text', name='param-' + data.name, value=value, class='input-xlarge') + + div(class='control-group') + div(class='controls') + input(type='submit') Execute + // button(class='execute-query') Execute block headers // a(id='headers'): h1: a(href='#headers') Headers @@ -121,21 +128,6 @@ block raw_body // a(id='body'): h1: a(href='#body') Raw body pre= rawBody -block tabs - div(class='tabbable') - ul(class='nav nav-tabs') - li(class='active'): a(href='#tab-meta', data-toggle='tab') Meta - li: a(href='#tab-items', data-toggle='tab') Items - li: a(href='#tab-headers', data-toggle='tab') Headers - li: a(href='#tab-formatted-body', data-toggle='tab') Formatted Body - li: a(href='#tab-raw-body', data-toggle='tab') Raw Body - div(class='tab-content') - div(class='tab-pane active', id='tab-meta'): block meta - div(class='tab-pane', id='tab-items'): block items - div(class='tab-pane', id='tab-headers'): block headers - div(class='tab-pane', id='tab-formatted-body'): block formatted_body - div(class='tab-pane', id='tab-raw-body'): block raw_body - block navbar div(class='navbar navbar-fixed-top') div(class='navbar-inner') @@ -146,11 +138,13 @@ block navbar span(class='icon-bar') span(class='icon-bar') span(class='icon-bar') - a(class='brand', href='#') Collection+JSON Explorer + span(class='icon-bar') + a(class='brand', href='/') Collection+JSON Explorer div(class='nav-collapse') ul(class='nav') li(class='active'): a(href='#meta') Meta li: a(href='#items') Items + li: a(href='#queries') Queries li: a(href='#headers') Headers li: a(href='#formatted-body') Formatted Body li: a(href='#raw-body') Raw Body @@ -172,6 +166,10 @@ block content if collection.items.length > 1 small #{collection.items.length} items block items + section(id='queries') + div(class='page-header') + h1 Queries + block queries section(id='headers') div(class='page-header') h1 Headers diff --git a/views/index.jade b/views/index.jade index 5800f5f..3cbf438 100644 --- a/views/index.jade +++ b/views/index.jade @@ -6,7 +6,7 @@ block content form(action='/render', class='well') div(class='row') div(class='span10') - input(name='url', size='100', placeholder='Enter URL to explore...', class='span10') + input(type='text', name='url', size='100', placeholder='Enter URL to explore...', class='span10') // TODO: Fix div(class='row') div(class='span12') -- cgit v1.2.3