{{define "home:items"}}

{{ $itemCount := 0 }}

{{ range.items }}
  <div class="col l4 m6 s12 item"
  {{ $itemCount = incr $itemCount}}
    {{ if eq $itemCount 10 }}
    {{ $offset := addI $.offset $itemCount}}
    hx-get="/?offset={{ $offset }}&out=items"
    hx-trigger="revealed"
    hx-swap="afterend"
    {{ end }}
  >
    <div class="item-card">
      <div class="row">
        <div class="col l11 m11 s11">
          <h5>
            <a class="show-large" href="/item/view/{{.Id}}" hx-get="/item/view/{{.Id}}" hx-target="body" hx-swap="beforeend"><i class="{{.Type_icon}}" title="{{.Type_title}}"></i> {{.Title}}</a>
            <a class="hide-large" href="/item/read/{{.Id}}" hx-get="/item/read/{{.Id}}" hx-target="#page-content" hx-push-url="true"><i class="{{.Type_icon}}" title="{{.Type_title}}"></i> {{.Title}}</a>
          </h5>
          <div class="home-card-summary">{{.Summary | markdownfy | safeHTML}}</div>
        </div>
        <div class="col l1 m1 s1">
          <a class="button" style="float: right; padding: 8px 8px" hx-get="/item/update/{{.Id}}" hx-push-url="true" hx-target="#page-content" href="/item/update/{{.Id}}" title="Edit"><i class="bi bi-pencil"></i></a>
          <a class="button" style="float: right; padding: 8px 8px" href="#" hx-target="body" hx-swap="beforeend" hx-get="/item/share/{{.Id}}" title="Share"><i class="bi bi-share-fill"></i> </a>
          <a class="button" style="float: right; padding: 8px 8px" href="#" hx-delete="/item/remove-from-dashboard/{{.Id}}" hx-target="closest .item" hx-swap="outerHTML swap:1s" hx-trigger="confirmed" onClick="bm_show_confirm(this, 'Dashboard', 'Remove this item from the dashboard ?')" title="Remove from dashboard"> <i class="bi bi-pin"></i></a>
        </div>
      </div>

    </div>
  </div>
  {{ end }}

  {{ end }}