<div tal:replace="nothing">
<!--

camcops_server/templates/deform/readonly/horizontal_mapping_item.pt

===============================================================================

    Copyright (C) 2012, University of Cambridge, Department of Psychiatry.
    Created by Rudolf Cardinal (rnc1001@cam.ac.uk).

    This file is part of CamCOPS.

    CamCOPS is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    CamCOPS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with CamCOPS. If not, see <https://www.gnu.org/licenses/>.

===============================================================================

A Zope page template, used by Deform.
Mostly original Deform code but with some modifications.

-->
</div>
<div tal:define="error_class error_class|field.widget.error_class;
                 description description|field.description;
                 title title|field.title;
                 oid oid|field.oid;
                 hidden hidden|field.widget.hidden;
                 category category|field.widget.category;
                 structural hidden or category == 'structural';
                 required required|field.required;"
     class="form-group ${field.error and 'has-error' or ''} ${field.widget.item_css_class or ''} ${field.default_item_css_class()}"
     title="${description}"
     id="item-${oid}"
     tal:omit-tag="structural"
     i18n:domain="deform">  <!-- added field.default_item_css_class(), not present in Deform's readonly/horizontal_mapping_item.pt -->

  <!-- added "col-sm-3 col-md-3" -->
  <label for="${oid}"
         class="control-label col-sm-3 col-md-3 ${required and 'required' or ''}"
         tal:condition="not structural"
         id="req-${oid}"
         >
    ${title}
  </label>

  <!-- added this encapsulating <div class="col-sm-9 col-md-9">; minor formatting tidy-up -->
  <div class="col-sm-9 col-md-9">

    <div tal:define="input_prepend field.widget.input_prepend | None;
                     input_append field.widget.input_append  | None"
         tal:omit-tag="not (input_prepend or input_append)"
         class="input-group">
      <span class="input-group-addon"
            tal:condition="input_prepend">${input_prepend}</span>
      <span tal:replace="structure field.serialize(cstruct, readonly=True).strip()"/>
      <span class="input-group-addon"
            tal:condition="input_append">${input_append}</span>
    </div>

    <p class="help-block"
       tal:define="errstr 'error-%s' % field.oid"
       tal:repeat="msg field.error.messages()"
       i18n:translate=""
       tal:attributes="id repeat.msg.index==0 and errstr or ('%s-%s' % (errstr, repeat.msg.index))"
       tal:condition="field.error and not field.widget.hidden and not field.typ.__class__.__name__=='Mapping'">
      ${msg}
    </p>

    <p tal:condition="field.description and not field.widget.hidden"
       class="help-block" >
      ${field.description}
    </p>

  </div>
</div>
