Hello!
I am hoping to find a way to apply Tregner's version filter (http://tregner.com/flare-blog/version-f ... l5-output/) to an entire TopNav site. My goal is to allow users to select the version of documentation that they need from the home page one time — then they won't need to select a version every time they navigate to a new topic.
Has anyone else had success in applying the version filter across the TopNav site? I would truly appreciate any insight and assistance!
Thanks!
Version Filter in TopNav Output
-
- Jr. Propeller Head
- Posts: 2
- Joined: Fri Jun 24, 2016 10:03 am
Re: Version Filter in TopNav Output
We do something similar in one of our help projects.
In order to remember the 'version', we store a value for the version in localstorage (see http://www.w3schools.com/html/html5_webstorage.asp).
When we display a topic, a script checks the value in localstorage, and then sets a class on the HTML tag to indicate the version; e.g. html.versionA.
Our stylesheet is set up so that it will hide content based on this class; e.g. if it's versionA we hide content with the condition Versions.VersionB:
In order to remember the 'version', we store a value for the version in localstorage (see http://www.w3schools.com/html/html5_webstorage.asp).
When we display a topic, a script checks the value in localstorage, and then sets a class on the HTML tag to indicate the version; e.g. html.versionA.
Our stylesheet is set up so that it will hide content based on this class; e.g. if it's versionA we hide content with the condition Versions.VersionB:
Code: Select all
html.versionA [data-mc-conditions*="Versions.VersionB"]
{
display: none;
}
-
- Jr. Propeller Head
- Posts: 2
- Joined: Fri Jun 24, 2016 10:03 am
Re: Version Filter in TopNav Output
Hi Dave Lee,
Thanks so much for your response. Please forgive my lack of coding skills, but would you mind clarifying a few things?
Where do you add the HTML code for local storage? To the master page?
What script are you using to check for the local storage value?
How do you define a class that excludes another class?
I'm revealing my ignorance in the realm of css, html, and javascript. Any additional insight you could provide would be greatly appreciated.
Thanks again!
Thanks so much for your response. Please forgive my lack of coding skills, but would you mind clarifying a few things?
Where do you add the HTML code for local storage? To the master page?
What script are you using to check for the local storage value?
How do you define a class that excludes another class?
I'm revealing my ignorance in the realm of css, html, and javascript. Any additional insight you could provide would be greatly appreciated.
Thanks again!
Re: Version Filter in TopNav Output
I usually put all scripts in js files then link to them from the master page.TabarSmith wrote:Where do you add the HTML code for local storage? To the master page?
The link I posted shows you how to store/retrieve data using localstorage.TabarSmith wrote:What script are you using to check for the local storage value?
If you search (e.g try "localstorage select option"), you'll also be able to find plenty of examples of how you can store/retrieve values from form controls in localstorage.
I don't think you understood what I meant.TabarSmith wrote:How do you define a class that excludes another class?
We check for a value in localstorage, e.g. we check the localstorage data 'AppVersion' and see it is set to 'versionA'.
Then we use that value and apply it as a class to the HTML tag, e.g change it to <html class="versionA">.
We can then use that class name to control what conditional content is displayed in the page, so content with the condition Versions.VersionB is hidden:
Code: Select all
html.versionA [data-mc-conditions*="Versions.VersionB"]
{
display: none;
}
Re: Version Filter in TopNav Output
Hi Dave, I need some help with the version filter. I initially posted for the first time at: viewtopic.php?f=9&t=31577 (post titled Javascript in version filter does not redirect on 404). This was implemented by a UI developer but he left and am trying to fix it -- but so far no luck.
Am adding the same here in the hope that I would get your attention. I have seen that you provide solutions for all things Flare and scripts.
Could you please help?
Thanks
Giri
Am adding the same here in the hope that I would get your attention. I have seen that you provide solutions for all things Flare and scripts.
Could you please help?
Thanks
Giri
Re: Version Filter in TopNav Output
I've looked at the post, but don't know how to handle the redirect. Maybe ask your developer?
Re: Version Filter in TopNav Output
Thanks Dave.Dave Lee wrote:I've looked at the post, but don't know how to handle the redirect. Maybe ask your developer?
Yes I have asked a developer to help. The 404 redirect (on the IIS server side) seems to have priority over what's done through the javascript...