<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7 lang="en"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8 lang="en"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="description" content="Search based application built using ElasticSearch, elastic.js, and jQuery">
    <meta name="viewport" content="width=device-width">

    <title>Elastic.js jQuery Example</title>

    <link rel="stylesheet" href="/common/css/normalize.min.css">
    <link rel="stylesheet" href="/common/css/main.min.css">
    <link rel="stylesheet" href="/common/css/bootstrap.min.css">
    <link rel="stylesheet" href="/common/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" href="/common/css/elasticjs.css">

    <!-- project dependency libs -->
    <script src="/common/lib/modernizr-2.6.1.min.js"></script>
    <script src="/common/lib/jquery-1.8.0.min.js"></script>
    <script src="/common/lib/underscore.min.js"></script>
    <script src="/dist/elastic.min.js"></script>
    <script src="/dist/elastic-jquery-client.min.js"></script>
      
    <!-- project specific files -->
    <script src="js/app.js"></script>
</head>

<script type="text/template" id="searchTmpl">
    <div class="row-fluid" style="margin-top:15%">
        <span class="span4 offset4">
            <i class="icon-search"></i>
            <strong>Elastic.js jQuery Example</strong>
        </span>
    </div>
    <div class="row-fluid">
        <form id="formSearch" class="span4 offset4 form-inline" action="#">
            <input id="txtSearch" class="input-xlarge" type="text" 
                placeholder="Enter a keyword" autofocus>
            <button class="btn" type="submit">Search</button>
        </form>
    </div>
    <div class="row-fluid">
        <small class="span4 offset4" style="margin-top:20px">
            In order for this example application to work, please have an ElasticSearch instance
            running at localhost:9200.  If you would like to use another instance of 
            ElasticSearch, please update <code>js/app.js</code> with the
            correct url.
        </small>
    </div>
</script>

<script type="text/template" id="resultsTmpl">
    <div class="row-fluid" style="margin-top:10%">
        <div class="span4 offset4">
            <span class="span5">Found <%= results.hits.total %> Results</span></span>
            <span class="span5 offset2">
                <a id="goBack" href="#"> <i class="icon-search"></i> Return to Search</a>
            </span>
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>User</th>
                        <th>Message</th>
                    </tr>
                </thead>
                <tbody>
                    <% _.each(results.hits.hits, function(doc) { %>
                        <tr>
                            <td><%= doc._source.user %></td>
                            <td><%= doc._source.message %></td>
                        </tr>
                    <% }); %>
                </tbody>
            </table>
        </div>
    </div>
</script>

<body>
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid">
                <span class="brand">Elastic.js jQuery Example</span>
                <button id="btnIndexDocs" class="btn btn-inverse pull-right">Index Sample Docs</button>
            </div>
        </div>
    </div>

    <div class="container-fluid">
        <div class="row-fluid">
            <div id="viewport"></div>
        </div>
    </div>
</body>
</html>