apostrophe icon indicating copy to clipboard operation
apostrophe copied to clipboard

Support for managing arrays in build and here() macros

Open kerrygilbert opened this issue 10 years ago • 2 comments

  {% if (data.tag == tag) %}
    <a href="{{ here({ tag: { $pull: tag } }) }}" class="active">{{ tag }}</a>
  {% else %}
    <a href="{{ here({ tag: { $push: tag } }) }}">{{ tag }}</a>
  {% endif %}

kerrygilbert avatar Jul 21 '16 14:07 kerrygilbert

To match mongo this should be $addToSet rather than $push. The difference is that $addToSet does not create duplicates, which is the appropriate behavior when filtering.

boutell avatar Jul 21 '16 19:07 boutell

Completed in #617

On Thu, Jul 21, 2016 at 10:53 AM, Kerry Gilbert [email protected] wrote:

{% if (data.tag == tag) %} {{ tag }} {% else %} {{ tag }} {% endif %}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/punkave/apostrophe/issues/616, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB9fVw525OEAp1yGqUJRG277HyitvGIks5qX4fkgaJpZM4JR4ai .

*THOMAS BOUTELL, *SUPPORT LEAD P'UNK AVENUE | (215) 755-1330 | punkave.com

boutell avatar Jul 22 '16 14:07 boutell