Skip to content

Conversation

@mjschock
Copy link
Contributor

@mjschock mjschock commented Jan 5, 2017

adds the ability to use the if helper as a subexpression

context:
helpers/handlebars-helpers#224
https://github.com/assemble/handlebars-helpers/pull/225/files#diff-63430960261956d4a86cbd6cf21d229aR539

why:
to prevent this kind of thing: https://github.com/bigcommerce/stencil/blob/28eea2f9e8e88b4fdc43a2bc01c264d2989261f9/templates/components/products/card.html#L84-L98

instead it could be:

{{#or customer if(theme_settings.restrict_to_login '===' false)}}
            <div class="card-text" data-test-info-type="price">
                {{> components/products/price price=price customer=../../customer}}
            </div>
{{else}}
            <div class="card-text" data-test-info-type="price">
                <p translate>Log in for pricing</p>
            </div>
{{/or}}

or

{{#all theme_settings.restrict_to_login if(customer '!=' true)}}
            <div class="card-text" data-test-info-type="price">
                <p translate>Log in for pricing</p>
            </div>
{{else}}
            <div class="card-text" data-test-info-type="price">
                {{> components/products/price price=price customer=../../customer}}
            </div>
{{/all}}

@mjschock mjschock requested review from abernard and mcampa and removed request for abernard January 5, 2017 01:57
@mcampa
Copy link
Contributor

mcampa commented Jan 5, 2017

👍 LGTM

@mjschock mjschock merged commit 4053366 into bigcommerce:master Jan 5, 2017
@mjschock mjschock deleted the support_non_block_helpers_as_sub_expressions branch January 12, 2017 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants