<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="master.html" />

<head>
    <title>${tmpl_context.title} - ${model} Listing</title>
</head>

<?python
PAGER_ARGS = dict(link=mount_point+'/',
                  page_link_template='<li><a%s>%s</a></li>',
                  page_plain_template='<li%s><span>%s</span></li>',
                  curpage_attr={'class': 'active'})
?>

<body>
  <div class="row">
    <div class="col-md-12">
      <h1 class="page-header">$model Listing</h1>

      <div class="row">
        <div class="col-xs-3 col-md-2">
          <a class="btn btn-success"
             href='${tg.url("new", params=tmpl_context.kept_params)}'>New $model</a>
        </div>

        <div class="col-xs-9 col-md-3">
          <ul py:if="value_list" class="pagination pull-sm-right" style="margin:0;"
              py:with="paginator=tmpl_context.paginators.value_list"
              py:content="paginator.pager(**PAGER_ARGS)"/>
        </div>

        <div class="col-xs-12 col-md-7">
            <div class="hidden-lg hidden-md">&nbsp;</div>
            <form py:if="search_fields" class="form-inline pull-md-right">
              <div class="form-group">
                <select id="crud_search_field" class="form-control"
                        onchange="crud_search_field_changed(this);">
                  <py:for each="field, name, selected in search_fields" py:choose="selected">
                    <option py:when="False" value="${field}">${name}</option>
                    <option py:otherwise="" value="${field}" selected="selected">${name}</option>
                  </py:for>
                </select>
              </div>

              <div class="form-group">
                <input id="crud_search_value" class="form-control" type="text"
                       placeholder="equals / contains"
                       name="${current_search[0]}" value="${current_search[1]}"/>
              </div>

              <button type="submit" class="btn btn-default">Search</button>
            </form>
        </div>
      </div>

      <br/>

      <div class="table-responsive">
        ${Markup(tmpl_context.widget(value=value_list, action=mount_point+'.json'))}
      </div>

    </div>
  </div>
</body>
</html>