We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36722
    • 101 Posts
    I expanded the Title some to help it be more searchable assuming we'll solve this.

    Ok, so the use case here is a configurable header. Below I'll try and outline the possible selections and options associated with each.

    Why not just leave them all up? Because clients, even simpletons like us will forget how it all works. This is good user experience, to not show options that can't be used, keep it simple.

    How I'll try and do it
    I'm thinking we use a plugin to inject some jQuery into the manager to hide and show these other TVs base on the selections of the Header Type TV. Initially it might be single use case, hard coded to our application. But I'd think with a little work it could be pretty dynamic, possibly using description text or something as the selectors for parent and child TVs and what groups they belong to.

    I know what you're thinking ? Use separate Templates - If we played it that game out, we'd end up with 20-30 templates, maybe more once we multiply it by other configurable options we have going. IMHO Templates are about specific content types, Events, Articles, Home Pages, Bios, etc ... but each of these could have different headers.

    Ideas?

    So.. what am I missing here? I did look at Dynamic Drop Down TV https://github.com/Bruno17/DynamicDropdownTV/blob/master/README.md , but I don't think that's the right fit here. [ed. note: himmdesign last edited this post 11 years, 7 months ago.]
      Shawn Himmelberger
      Himmelberger Design
      https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development
      • 14911
      • 7 Posts
      To expound on what I understand the OP to be saying here:

      In addition to leveraging templates, one could also use form customization, however, even that doesn't cut it. The ability to make TVs dynamic based on other TVs would be very awesome. Not just dynamic in visibility, but also in content, all asynchronously. Indeed, what is being asked is somewhat complex.

      I'm sure there are many possible solutions. While a stop-gap is not ideal, I'm pretty sure it would help a lot. Having this sort of functionality in MODx 3.0 would be awesome. I say this not having looked at the roadmap for MODx 3.0.
        • 3749
        • 24,544 Posts
        JavaScript might be a good fit. I'd recommend against using output modifiers or Form Customization.

        Personally, (if I'm understanding what you want to do) I think I'd do it with some placeholders and a single snippet with a big switch statement. I'd probably also use ClassExtender and put things in a custom DB table rather than in TVs.

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 36722
          • 101 Posts
          @bobray - How these things get sorted out on the front end is sorted out in my mind. I should clarify. This is more Backend Manager Development. I want things to be dead easy for my client, never having to see header TVs that don't apply to that page because they can't be used.
            Shawn Himmelberger
            Himmelberger Design
            https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development
            • 23018
            • 353 Posts
            Hi Shawn,

            watch this and tell me, if it fits your needs:

            http://quick.as/dvdkfjwo

            you can find the code for this plugin here:

            https://gist.github.com/pepebe/a5be5d1f17e2f807496e

            I've done some basic tests and it seems to do the job. Don't know though how it will react to MIGX, TinyMCE and other TVS.

            Cheers,

            pepebe

            Edit: If you have already copied the plugin update it to v0.0.3. (damn cut'n'paste...) [ed. note: pepebe last edited this post 11 years, 7 months ago.]
              Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
              • 36722
              • 101 Posts
              @pepebe #1 Awesome. You nailed the interaction.

              One thing I forgot of course (always something right?) My thought was to use the Header Type TV to choose the chunk that loads in the header type code. So I guess the only questions is, how to load in the right header chunk without a mess of if / then statements.
                Shawn Himmelberger
                Himmelberger Design
                https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development
                • 23018
                • 353 Posts
                Quote from: himmdesign at Mar 06, 2015, 09:42 AM
                @pepebe #1 Awesome. You nailed the interaction.

                One thing I forgot of course (always something right?) My thought was to use the Header Type TV to choose the chunk that loads in the header type code. So I guess the only questions is, how to load in the right header chunk without a mess of if / then statements.

                Already solved. Have a look at the repo you'll find there 2 snippet (getTVLabel, getTVNames) that hit the nail right where you need it.

                Cheers,

                pepebe
                  Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                  • 36722
                  • 101 Posts
                  You should package this bugger up. It's killer!
                    Shawn Himmelberger
                    Himmelberger Design
                    https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development
                    • 23018
                    • 353 Posts
                    After some intense testing (Cross-Browser, etc)...

                    Things I still need to solve.

                    * Always move select TV on top
                    * Handle multiple tvSets
                    * ...

                    Throw some feedback at me and well see what happens. Be my guest.

                    BTW: Your footer is broken...
                      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
                      • 36722
                      • 101 Posts
                      Looks like I have a bug here.

                      Uncaught TypeError: Cannot read property 'setStyle' of null


                      https://www.dropbox.com/s/lcczi7aacjz9vdr/Screenshot%202015-03-06%2009.59.28.png?dl=0

                      What did I mess up? smiley
                        Shawn Himmelberger
                        Himmelberger Design
                        https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development