rasteiner / k3-whenquery

Conditionally show fields and sections. Better.
MIT License
64 stars 1 forks source link

Feature Request: `::count()` without expression #3

Closed owzim closed 2 years ago

owzim commented 2 years ago

Hi,

this plugins is a very welcome addition to the kirby panel.

Just to get the count of elements, without filtering them, it would be great to be able to skip the expression between the apprentices.

In fact I don't seem to get the count at all even with items::count(true = true).

rasteiner commented 2 years ago

you could use items.length :)

items ::count(true = true) as well as items ::count(true) or items ::count(1) should work however... Are you sure items is an array? Are there any messages in the console? I've just written a test case and it completes.

rasteiner commented 2 years ago

Though I agree that ::count() could be quite idiomatic.

rasteiner commented 2 years ago

Should be fixed in v0.2 - could you test that? You'd have to download the v0.2 tag: https://github.com/rasteiner/k3-whenquery/archive/refs/tags/0.2.0.zip

owzim commented 2 years ago

Working great!

you could use items.length :)

Neither this nor ::count(true = true) was not working, because I was testing it within the builder field (see #4).

Everything looking good now in v0.2

rasteiner commented 2 years ago

Should be available now.

(After many, many many many commits because packagist didn't want to update because of a version mismatch between files and tags - then I realized I was updating the version in package.json instead of composer.json 🤦)