MODX Community

[Fred] How to see and edit resource TVs

Hi All,

I am preparing two existing sites with Fred and while on the front-end with Fred enabled, when going to settings (to edit current resource title, summary, etc) it is not visible any of the TVs assigned to it through the selected template. I have always to go to the manager in order to set the data for the TVs.

I went through Fred documentation but it seems that there’s nothing about this. Sot sure if the Devs are considering this for future releases.

Maybe I am missing something, but do you know if this is possible or if it is on the dev roadmap?

Many thanks in advance.

I believe this is one of the most requested features and should be available in version 1.1 from what I understand.

1 Like

Good news then! Many thanks.

Hi @jnogueira. Love to learn more about your application. You can save text-values to TV-types that support that (text, textarea, some of the number TVs…), but you can’t do more complex things like Google Map pickers. With 1.1 and its sidebar/element controls plugin support coming soon, more complex input types can probably be created.

Take a peek at the Fred docs for TVs for full details, but you should be able to target any TVs for saving by using the data-fred-target= attribute withe the TV name prefaced by tv_. For example:

<div data-fred-name="favorite_color" data-fred-target="tv_favorite_color">Lightcoral</div>
1 Like

For me at least the main functionality needed is using an image picker / date picker in the sidebar to save to a TV.
Needed for blog / article listing pages where those things are not on the inner page itself.

Thank you all for al the replies.
@rethrash I shall try this indeed. Thanks for the tip.

I got around the situation successfully.
What I did was setting a TemplateVar with Input as text and output as text. Fred pointing to is just like you posted.

Now on fred side:
Option Set:

{
    "remote": true,
    "settings": [
        {
            "name": "bannerImage",
            "label": "Banner Background Image",
            "type": "image",
            "value": "/assets/news_portal/images/banner_image.png",
            "mediaSource": "Assets",
            "imageMediaSource": "Assets",
            "showPreview": true
        },
        {
            "name": "showImageTV",
            "label": "Show image box",
            "type": "toggle",
            "value": true
        }
    ]
}

On the Fred Element:

[[$BannerTop?
    &bannerImage=`{{ bannerImage }}`
    &showImageTV=`{% if showImageTV %}{% else %} d-none{% endif %}`
]]

Then on the chunk called by the Fred Element markup I just had to use your example (adapting to my reality of course) and all went just fine! No need to worry about not havin the TV fields on the fred sidebar under “Settings”.

Cheers!

1 Like

Wow this works? Very nice!
Would it be possible to get some examples like this in the docs, @rethrash? :slight_smile:

We’d love to have more examples in the docs … but maybe another idea would be a starter or demo theme that all theme builders could use as a starting point. Thoughts on that @digitalpenguin? Any takers on collaborating on that?

I can certainly put something together but I thought you released the starter theme already?

I could just do a theme with some stock Bootstrap 4 elements if that’s what you’re thinking… ?
My concern with this is it would fill up the element space with mostly unused elements and is not necessarily something you’d want when starting a new site.

Maybe it would just be used as an example for people.

I was thinking a stock Bootstrap 4 elements theme indeed. It’d be something Themers could use and delete the bits they don’t need pretty quickly.

1 Like

Sorry I missed your reply. I’ll delve into the Fred/Gitify docs and set up a repo soon.

@rethrash I’m attempting to set up Fred with Gitify locally to build this bootstrap4 theme but currently getting a bit lost as it’s all geared towards MODX Cloud. e.g. the included script installs the dependencies in a spot that it’s not expecting.
Also the link “Setting up a theme to work with Gitify” https://modxcms.github.io/fred/collab/gitify/collab/initial_extract is currently giving me a 404.

I’ll go ahead with a non gitify/repo install for now and try to export it later.

Did you ever achieve this? I’m trying to do something very similar - I have an “event” page with a event_description tv which I use in the tpl of a getResources call on another page to bring up “upcoming events” and their descriptions. I don’t want the event_description rendered on the event page itself, I just want a way of setting the tv in Fred.