Toggle a graphic on/off in a repeater, in the CMS

I’m having trouble with
Giving a real estate client the option to turn a graphic on/off in a repeater

Working in
Wix Studio Editor

What I’m trying to do
It’s specifically for a real estate client, and I want them to be able to update the listing with a ‘new to market’ graphic when it’s new, and be able to turn it off when it’s not. Like a true/false option in the CMS I think?

You will have to write a few lines of code to make it work.

Start by searching on the forum and try out the solutions provided:
https://forum.wixstudio.com/search?q=hide%20repeater%20element%20boolean%20order%3Arelevance

I’d set up the icon to be hidden by default
This code takes some liberties with the object and field names:

  • CMS collection’s boolen field - new
  • Repeater - #repeater
  • New to Market graphic - #icon
$w('#repeater').onItemready(($item, data) => {
    if (data.new) $item('#new').show()
])

This code simply says:
When an item loads in the repeater, if the new property is true, show the #new icon