<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation

Contributors:
Jeff Bryner jbryner@mozilla.com

contains two ways to display the same intel data
non-modal: for http(s)://servername/ipintel/1.2.3.4
modal: for  Session.set('ipintelipaddress','1,2.3.4') then
            $('#modalintelwindow').modal()
-->

<template name="ipintel">
<style>
    .row {
        color: white;
    }
</style>
<body>


<div class="container">
    <div class="well">
        intel: {{intel.status}} {{intel.error}}
    </div>
    <div class="row"><a class="showmodal" href=#>click me for modal</a></div>
    <div class="row center">
        <pre>{{ stringify intel.data }}</pre>
    </div>
    {{>intelmodal}}
</div>
</body>
</template>

<template name="intelmodal">
    <style>
    .modal-body .row { color: black;
    }
    </style>
    <div class="modal fade" id="modalintelwindow">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                   <button type="button" class="close" data-dismiss="modal">&times;</button>
                   <h4>intel Results</h4>
                </div>
                <div class="modal-body">
                    <div class="row center">
                        <div class="well">
                            intel: {{intel.status}} {{intel.error}}
                        </div>
                    </div>
                    {{#if isEqual intel.data.status 200}}
                        <div class="row center">
                            <pre>{{ stringify intel.data }}</pre>
                        </div>
                    {{else}}
                        <div class="row center">
                            <pre>Nothing found </pre>
                        </div>
                    {{/if}}
                    <div class="col-xs-1"><button class="btn btn-xs" data-toggle="collapse" data-target="#rawinteljson">raw json</button></div>
                    <div class="col-xs-7 col-xs-offset-1">
                        <div id='rawinteljson' class="collapse">
                            <pre>{{intel.content}}</pre>
                        </div>
                    </div>
              </div>
              <div class="modal-footer">
                <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
              </div>
            </div>
        </div>
    </div>
</template>
