Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRY up triptych pattern #57

Open
adamjohnson opened this issue Feb 11, 2016 · 0 comments
Open

DRY up triptych pattern #57

adamjohnson opened this issue Feb 11, 2016 · 0 comments
Assignees

Comments

@adamjohnson
Copy link
Contributor

Lots of repeated code in that partial. It would be better to use <r:loop:each> and variables to keep that DRYer (and more configurable).

Here's a start (much thanks goes to @nreckart):

<!-- TODO: Make lines 8-11 variables so that you can set the names in the template -->

<r:set_var name="triptych_items" value="{$triptych_items}" default="3" />
<div class="wvu-triptych <r:var name="wvu-triptych__classes" />">
  <div class="wvu-triptych__container">
    <r:loop:each times="{$triptych_items}">
      <div class="wvu-spotlight">
        <r:set_var name="region1">wvu-triptych__image-<r:item /></r:set_var>
        <r:set_var name="region2">wvu-triptych__header-<r:item /></r:set_var>
        <r:set_var name="region3">wvu-triptych__description-<r:item /></r:set_var>
        <r:set_var name="region4">wvu-triptych__button-<r:item /></r:set_var>

        <div class="wvu-spotlight__image">
          <r:editable_region name="{$region1}" />
        </div>
        <div class="wvu-spotlight__copy">
          <h2><r:editable_region name="{$region2}" type="simple" /></h2>
          <p><r:editable_region name="{$region3}" type="simple" /></p>
          <r:editable_region name="{$region4}" />
        </div>
      </div>
    </r:loop:each>
  </div> <!-- /.wvu-triptych__container -->
</div> <!-- /.wvu-triptych -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants