<metal:page define-macro="master">
  <metal:master use-macro="here/main_template/macros/master">
    <metal:content fill-slot="content">
      <div class="search-results"
           id="attach-documents-2-results"
           i18n:domain="ploneintranet"
      >
        <div class="item-selector mode-add"
             tal:define="
               results view/results;
               friendly_type2type_class nocall:here/@@proto/friendly_type2type_class;
             "
        >
          <p class="pat-message notice"
             tal:condition="not:results"
             i18n:translate=""
          >
            No results found matching your query
          </p>
          <p class="pat-message notice"
             tal:condition="view/display_length_warning"
             i18n:translate=""
          >
            Only the first
            <tal:i18n i18n:name="limit">${view/result_limit}</tal:i18n>
             matching items have been returned. Please use the searchterm to narrow your search.
          </p>
          <div class="search-result docs">
            <fieldset class="checklist pat-checklist docs pat-subform pat-autosubmit pat-inject"
                      data-pat-inject="source: #attached-documents-attachments-2; target: #attached-documents-attachments-2 &amp;&amp; source: #global-statusmessage; target: #global-statusmessage;"
            >

              <label class="item document ${python:friendly_type2type_class(item.portal_type)} has-description"
                     tal:repeat="item python: results[:20]"
              >
                <a class="pat-modal follow"
                   href="${item/getURL}#document-content"
                >
                  <strong class="title">${item/Title}</strong>
                  <dfn class="byline">${item/Description}</dfn>
                </a>
                <button class="pat-button icon-plus-circle button-add"
                        formaction="${here/absolute_url}#attached-documents-attachments-2"
                        name="new-related-item"
                        type="submit"
                        value="${item/UID}"
                        i18n:translate=""
                >Add</button>
              </label>
            </fieldset>
          </div>
        </div>
      </div>
    </metal:content>
  </metal:master>
</metal:page>
