wvuweb / cleanslate-cms

A place to file issues and view releases for CleanSlate CMS. http://cleanslatecms.wvu.edu
6 stars 0 forks source link

Page ordering for r:descendants #231

Closed adamglenn closed 7 years ago

adamglenn commented 7 years ago

I don’t think either sort_order or published_at work correctly (or at least how I think it is supposed to work). For example, on this page: http://www.events.wvu.edu/home-test I have a list of events set to display by published_date, but they are not ordered by the published date. The Rick Springfield page was published last, but is displayed 3rd.

It uses this pattern: https://bitbucket.org/wvudigital/ur-arts-and-entertainment/src/4e7cdcafd8c7bf657f6b428179cd0f0e360a7bee/views/custom-patterns/_ae-featurettes.html?at=master&fileviewer=file-view-default

Then on this page: http://www.events.wvu.edu/ they are ordered by sort_order but don't seem to be ordered by how they show in CleanSlate. For example, the Rick Springfield show is last in CleanSlate, but is shown 3rd on the page. I am using a to loop through all pages in the site and some of the pages have different parents if that makes any difference.

It uses this pattern: https://bitbucket.org/wvudigital/ur-arts-and-entertainment/src/6868fbea1a5be8726d4a4dac8f45c36b0bbd9266/views/custom-patterns/_ae-featurettes--root.html?at=master&fileviewer=file-view-default

The site is Arts & Entertainment in CleanSlate if you want to see the page order, published dates.

nreckart commented 7 years ago

Sorting by sort_order is not going to work for pages with different parents.

nreckart commented 7 years ago

@adamglenn I bet this is related to #233. Instead of splitting the <r:children> and <r:each>, try using <r:children:each> as follows:

<div class="ae-featurettes__featurettes ae-featurettes__featurettes--<r:count />">
  <r:children:each by="name" order="asc" labels="feature" labels_match="any">
    <div class="ae-featurettes__featurette">
      <r:set_var name="soFeaturettesInfoWide" default="nophoto" />

      <div class="ae-featurettes__photo">
        <a href="<r:if expr="{{ NOT(BLANK(alternate_url)) }}"><r:page:data name="alternate_url" /></r:if><r:if expr="{{ BLANK(alternate_url) }}"><r:page:url /></r:if>"><r:page:content name="event__photo" /></a>
      </div>

      <div class="ae-featurettes__info ae-featurettes__info--has-photo">
        <h3><a href="<r:if expr="{{ NOT(BLANK(alternate_url)) }}"><r:page:data name="alternate_url" /></r:if><r:if expr="{{ BLANK(alternate_url) }}"><r:page:url /></r:if>"><r:page:first_non_blank_attr names="alternate_name,name" /></a></h3>
        <p>
          <r:page:content name="event__date-and-time" /><br>
          <r:page:content name="event__place" />
        </p>
        <a class="button" href="<r:if expr="{{ NOT(BLANK(alternate_url)) }}"><r:page:data name="alternate_url" /></r:if><r:if expr="{{ BLANK(alternate_url) }}"><r:page:url /></r:if>"><r:if expr="{{ NOT(BLANK(link_text)) }}"><r:page:data name="link_text" /></r:if><r:if expr="{{ BLANK(link_text) }}">Details</r:if></a>
        <p>
          <a href="<r:page:content name="event__tickets-link" />">Tix</a> | <a href="<r:page:url />#venue">Venue</a> | <a href="<r:page:url />#directions">Directions</a>
        </p>
      </div>
    </div>
  </r:children:each>
</div>

The same would apply to any of the page looping tags: children, descendants, siblings, ancestors

nreckart commented 7 years ago

@adamglenn

The sorting should now work as originally implemented with <r:each> split out, as of wvuweb/cleanslate@d4b3532ac212e0e999f39581faba365cf972b77c.