## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>

<%block name="title">
    ${_('Admin Journal')}
</%block>

<%def name="breadcrumbs_links()">
    <form id="filter_form" class="pull-left form-inline input-group-sm">
        <input class="form-control q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('journal filter...')}"/>
        <span data-toggle="popover" data-content="${h.journal_filter_help()}">?</span>
        <input type='submit' value="${_('Filter')}" class="btn btn-default btn-xs"/>
        ${_('Admin Journal')} - ${ungettext('%s Entry', '%s Entries', c.users_log.item_count) % (c.users_log.item_count)}
    </form>
</%def>

<%block name="header_menu">
    ${self.menu('admin')}
</%block>
<%def name="main()">
<div class="panel panel-primary">
    <div class="panel-heading clearfix">
        ${self.breadcrumbs()}
    </div>
    <div id="user_log" class="panel-body">
            <%include file='admin_log.html'/>
    </div>
</div>

<script>'use strict';
$(document).ready(function() {
  $('#j_filter').click(function(){
    var $jfilter = $('#j_filter');
    if($jfilter.hasClass('initial')){
        $jfilter.val('');
    }
  });
  function fix_j_filter_width(len){
      $('#j_filter').css('width', Math.max(80, len*6.50)+'px');
  }
  $('#j_filter').keyup(function () {
    fix_j_filter_width($('#j_filter').val().length);
  });
  $('#filter_form').submit(function (e) {
      e.preventDefault();
      var val = $('#j_filter').val();
      window.location = ${h.js(url.current(filter='__FILTER__'))}.replace('__FILTER__',val);
  });
  fix_j_filter_width($('#j_filter').val().length);
});
</script>
</%def>
