diff --git a/assets.json b/assets.json index 72150d1..5b04692 100644 --- a/assets.json +++ b/assets.json @@ -33,7 +33,7 @@ "view": [ "body", - "filters", "filter", "actions", + "filters", "filter", "request", "response", "edit", "field", diff --git a/public/css/main.css b/public/css/main.css index 808602f..639887d 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -28,27 +28,6 @@ FIELDSET, IMG { border: 0; } -INPUT, TEXTAREA, SELECT { - font-family: inherit; - font-weight: inherit; -} - -INPUT, A { - outline: none; -} - -TEXTAREA, -INPUT[type=text], -INPUT[type=number], -INPUT[type=password] { - background-color: white; - border: 1px solid #C0C0C0; -} - -INPUT.fixie { - border: 0; -} - LABEL { -moz-user-select: none; -khtml-user-select: none; @@ -224,6 +203,14 @@ H1 { z-index: 1; } +#header .btn { + margin-bottom: 3px; +} + +#header .input-group .btn { + margin-bottom: 0; +} + TH { text-align: left; } @@ -232,14 +219,6 @@ text-align: left; color: #666; } -INPUT { - margin: 2px; -} - -INPUT[type="button"] { - min-width: 20px; -} - #request-input TD { border: 1px solid #f8f8f8; } diff --git a/public/js/HTMLApi.js b/public/js/HTMLApi.js index 97bdf3a..862e5a3 100644 --- a/public/js/HTMLApi.js +++ b/public/js/HTMLApi.js @@ -54,7 +54,6 @@ HTMLApi.prototype.show = function(cb) var self = this; async.auto({ render: this.render.bind(this) , - actions: ['render', this.actionInit.bind(this) ], filters: ['render', this.filterInit.bind(this) ], }, showDone); @@ -338,6 +337,13 @@ HTMLApi.prototype.render = function(cb) } } + var actions = {}; + var allActions = ( data.type == 'collection' ? schema.collectionActions : schema.resourceActions ) || {}; + Object.keys(allActions).sort().forEach(function(key) { + // Set the action to true if it's available on this object or false if it isn't + actions[key] = !!data.actions[key]; + }); + var tpl = { data: this._data, docsPage: this._docsPage, @@ -346,6 +352,7 @@ HTMLApi.prototype.render = function(cb) error: this._error, schema: schema, operations: operations, + actions: actions, explorer: Cookie.get('debug') || false }; @@ -354,7 +361,6 @@ HTMLApi.prototype.render = function(cb) this._addCollapsers(); - $('#actions').html('None'); $('#filters').html('None'); return async.nextTick(cb); @@ -405,19 +411,9 @@ HTMLApi.prototype.getSchema = function(type, obj) // ---------------------------------------------------------------------------- -HTMLApi.prototype.actionInit = function(cb) +HTMLApi.prototype.showAction = function(button) { - var data = this._data; - - if ( !data.actions || !Object.keys(data.actions).length ) - return async.nextTick(cb); - - var html = Handlebars.templates['actions']({ - actions: data.actions - }); - $('#actions').html(html); - - async.nextTick(cb); + this.actionLoad(button.getAttribute('data-action'), undefined, {}); } HTMLApi.prototype.actionLoad = function(name, obj, body) diff --git a/public/view/actions.hbs b/public/view/actions.hbs deleted file mode 100644 index b2d3adc..0000000 --- a/public/view/actions.hbs +++ /dev/null @@ -1,7 +0,0 @@ - -
- diff --git a/public/view/body.hbs b/public/view/body.hbs index 243f366..ce75cae 100644 --- a/public/view/body.hbs +++ b/public/view/body.hbs @@ -3,26 +3,28 @@
-

- - -

+ + {{#if operations.post}} - + {{/if}} {{#if operations.put}} - + {{/if}} {{#if operations.delete}} - + {{/if}}

-
-
{{! Set based on schema }}
-
+
+ {{#eachProperty actions}} + + {{else}} + None + {{/eachProperty}} +

@@ -31,63 +33,85 @@
- {{#if data.sortLinks }}
- - {{#if data.sort.name }} - - {{/if}} +
+
+ + +
+
+ + {{#if data.sort.name }} +
+ {{#ifEqual data.sort.order "desc"}} + + + {{else}} + + + {{/ifEqual}} +
+ {{/if}} +
+
- - {{#if data.sort.name}} - {{data.sort.name}} {{#ifEqual data.sort.order "desc"}}↑{{else}}↓{{/ifEqual}} - {{else}} - Not Sorted - {{/if}} - {{else}} - Not available + +

Not available

{{/if}}
{{#if data.pagination}} -
-
- /page - -
-
{{#if data.pagination.partial}} {{#if data.pagination.first}} {{#ifEqual data.links.self data.pagination.first}} - {{! Nothing }} + {{else}} - First  + {{/ifEqual}} + {{else}} + {{/if}} {{#if data.pagination.prev}} - Prev  + + {{else}} + {{/if}} {{#if data.pagination.next}} - Next  + + {{else}} + {{/if}} {{#if data.pagination.last}} - Last + + {{else}} + {{/if}} {{else}} - Full result +

Full result

{{/if}}
+
+
+
+ Limit: + + + + +
+
+
{{else}} - Not available +

Not available

{{/if}}
diff --git a/public/view/filters.hbs b/public/view/filters.hbs index 04dd8b4..6072614 100644 --- a/public/view/filters.hbs +++ b/public/view/filters.hbs @@ -2,7 +2,7 @@
None
{{#if canFilter}} -   -   - + + + {{/if}}