Alien-Web-HalBrowser

 view release on metacpan or  search on metacpan

share/browser.html  view on Meta::CPAN

          <th>name / index</th>
          <th>docs</th>
          <th>GET</th>
          <th>NON-GET</th>
        </tr>
      </thead>
      <tbody>
      <% _.each(links, function(obj, rel) { %>
        <% if ($.isArray(obj)) { %>
          <% _.each(obj, function(link, i) { %>
            <tr>
              <td><strong><%= HAL.truncateIfUrl(rel) %></strong></td>
              <td><%= link.title || '' %></td>
              <td><%= link.name ? 'name: ' + link.name : 'index: ' + i %></a></td>
              <td>
              <% if (HAL.isUrl(rel)) { %>
                <a class="dox" href="<%= HAL.buildUrl(rel) %>"><i class="icon-book"></i></a>
              <% } %>
              </td>
              <td>
                <% if (link.templated === true) { %>
                  <a class="query btn btn-success" href="<%= link.href %>" title="Query URI template"><i class="icon-question-sign"></i></a>
                <% } else { %>
                  <a class="follow btn btn-success" href="<%= link.href %>" title="Follow link"><i class="icon-arrow-right"></i></a>
                <% } %>
              </td>
              <td>
                <a class="non-get btn btn-warning" href="<%= link.href %>" title="Perform non-GET request">!</a>
              </td>
            </tr>
          <% }); %>
        <% } else { %>
          <tr>
            <td><strong><%= HAL.truncateIfUrl(rel) %></strong></td>
            <td><%= obj.title || '' %></td>
            <td><%= obj.name || '' %></td>
            <td>
            <% if (HAL.isUrl(rel)) { %>
              <a class="dox" href="<%= HAL.buildUrl(rel) %>"><i class="icon-book"></i></a>
            <% } %>
            </td>
            <td>
              <% if (obj.templated === true) { %>
                <a class="query btn btn-success" href="<%= obj.href %>" title="Query URI template"><i class="icon-question-sign"></i></a>
              <% } else { %>
                <a class="follow btn btn-success" href="<%= obj.href %>" title="Follow link"><i class="icon-arrow-right"></i></a>
              <% } %>
            </td>
            <td>
              <a class="non-get btn btn-warning" href="<%= obj.href %>" title="Perform non-GET request">!</a>
            </td>
          </tr>
        <% } %>
      <% }) %>
      </tbody>
    </table>
  </script>

  <script id="properties-template" type="text/template">
    <h2>Properties</h2>
    <pre><%= _.escape(JSON.stringify(properties, null, HAL.jsonIndent)) %></pre>
  </script>

  <script id="request-headers-template" type="text/template">
    <h2>Custom Request Headers</h2>
    <textarea class="span12"></textarea>
  </script>

  <script id="response-headers-template" type="text/template">
    <h2>Response Headers</h2>
    <pre><%= status.code %> <%= status.text %>

<%= _.escape(headers) %></pre>
  </script>

  <script id="response-body-template" type="text/template">
    <h2>Response Body</h2>
    <pre><%= _.escape(body) %></pre>
  </script>

  <script id="query-uri-template" type="text/template">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>Expand URI Template</h3>
    </div>

    <form id="query" action="<%= href %>">
      <div class="modal-body">
        <p>URI Template:</p>
        <pre><%= href %></pre>
        <p>Input (JSON):</p>
        <textarea><%= input %></textarea>
        <p>Expanded URI:</p>
        <pre class="preview">&nbsp;</pre>
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-primary">Follow URI</button>
      </div>
    </form>
  </script>


  <script id="non-safe-request-template" type="text/template">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>Make a non-GET request</h3>
    </div>

    <form class="non-safe" action="<%= href %>">
      <div class="modal-body">
        <p>Target URI</p>
        <input name="url" type="text" class="url" value="<%= href %>" />
        <p>Method:</p>
        <input name="method" type="text" class="method" value="POST" />
        <p>Headers:</p>
<textarea name="headers" class="headers" style="height: 100px">
Content-Type: application/json
<%= user_defined_headers %>
</textarea>
        <p>Body:</p>
<textarea name="body" class="body" style="height: 200px">
{

}
</textarea>
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-primary">Make Request</button>
      </div>
    </form>
  </script>

  <script id="embedded-resources-template" type="text/template">
    <h2>Embedded Resources</h2>
  </script>



( run in 0.440 second using v1.01-cache-2.11-cpan-02777c243ea )