Span tags in menu proxies

This forum is for all Flare issues related to styles, stylesheets and XML.

Span tags in menu proxies

Postby Jbleasdale on Fri Aug 18, 2017 1:48 am

I think the answer is - not possible... but I'm going to put it out there anyway.

I have a .beta class that adds some colour & superscript to some text. Its to identify a feature as a beta feature (obviously).

Now this works gloriously in my topics, but in the side menu & top nav the word beta, it appears without the span tag it has within the topic (as expected).

Is there a way to put a span in the TOC item or something to style just that word as I wish so it appears in the top nav & side menu?
Joe Bleasdale

My Linkedin

Image
Jbleasdale
Propeller Head
 
Posts: 58
Joined: Tue Mar 21, 2017 3:35 pm

Re: Span tags in menu proxies

Postby Dave Lee on Fri Aug 18, 2017 4:36 am

Jbleasdale wrote:I think the answer is - not possible... but I'm going to put it out there anyway.

I have a .beta class that adds some colour & superscript to some text. Its to identify a feature as a beta feature (obviously).

Now this works gloriously in my topics, but in the side menu & top nav the word beta, it appears without the span tag it has within the topic (as expected).

Is there a way to put a span in the TOC item or something to style just that word as I wish so it appears in the top nav & side menu?


Hi Joe.

You can't add span tags (or any HTML tag) inside a TOC item - it's text only.

You can format a TOC item with a different style - but it works for Tripane skin and not Top Nav (which isn't clear in the help).
http://help.madcapsoftware.com/flare201 ... _Entry.htm
Dave Lee
Master Propellus Maximus
 
Posts: 5579
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Span tags in menu proxies

Postby Jbleasdale on Fri Aug 18, 2017 5:45 am

Thanks Dave.

I thought as much. Feature request then I think.
Joe Bleasdale

My Linkedin

Image
Jbleasdale
Propeller Head
 
Posts: 58
Joined: Tue Mar 21, 2017 3:35 pm

Re: Span tags in menu proxies

Postby Jbleasdale on Mon Aug 21, 2017 5:44 am

So, I was doing some further research on this at the weekend and found, arguably, the best Flare customization related article I've ever read.

https://www.linkedin.com/pulse/how-i-co ... itte-gagne

Brigitte, if you are reading.... amazing job.

I was able to use the logic from this topic to do something slightly different, and accomplish what I wanted.

What I wanted, was to be able to add a little superscript to a few select TOC items that denoted them as beta features. However, doing this the same as I did with the H1 style, by simply adding a little span class, is not possible as Dave already mentioned.

So, I edited the Top Nav XML skin, per the article, and added the following code -

Code: Select all
    <Styles>
         <Style
        Name="TocEntry">
        <Classes>
          <StyleClass
            Name="TOCbetaLuxRenderer"
            Custom="true">
            <Properties></Properties>
          </StyleClass>
      <StyleClass
        Name="TOCbetaLuxMap"
         Custom="true">
      <Properties></Properties>
      </StyleClass>
      <StyleClass
        Name="TOCbetaVR"
         Custom="true">
          <Properties></Properties>
       </StyleClass>               
        </Classes>
      </Style>


Then I made some style classes like this -

Code: Select all
.TOCbetaLuxRenderer > a:after
{
   content: "beta";
   vertical-align: super;
   position: relative;
   left: 5px;
   bottom: 2px;
   color: #ff7045;
   font-size: smaller;
}

.TOCbetaLuxMap > a:after
{
   content: "beta";
   vertical-align: super;
   position: relative;
   left: 5px;
   bottom: 2px;
   color: #ff7045;
   font-size: smaller;
}

.TOCbetaVR > a:after
{
   content: "beta";
   vertical-align: super;
   position: relative;
   left: 5px;
   bottom: 2px;
   color: #ff7045;
   font-size: smaller;
}


I then went to my TOC item properties and applied the TOC styles.

Now, I am fairly inexperienced with CSS, so there is probably a tidier way of doing it, but this works for now. Here is the end result -

Image

The styles also work in the side menu, although I did not edit the side menu XML as the article talks about. I'm not entirely sure why that is the case either. Despite this, I *think* I could add to the selector to define which skin gets which style, and style the Top Nav differently to the Side Menu without having additional classes.

This method does now mean I have 3 additional styles to maintain, but as these beta features become core release features, I can rename the styles to other things to use with new beta features (as more beta features will come along).

Overall, I am quite pleased with the result. Hopefully someone else finds all this rambling helpful.
Joe Bleasdale

My Linkedin

Image
Jbleasdale
Propeller Head
 
Posts: 58
Joined: Tue Mar 21, 2017 3:35 pm

Re: Span tags in menu proxies

Postby arkana on Mon Apr 15, 2019 6:45 pm

Thanks Joe (and brigitte) for the great tip. I used your technique to achieve what I need and it's working perfectly.

Two minor things: 1) in your code, the opening and ending tag doesn't match (styles vs. style). 2) I think you can just add one selector instead of three and you can apply the same selector to all menu items.
Arthur Cui
Flare 2019
arkana
Propeller Head
 
Posts: 21
Joined: Wed Mar 14, 2018 11:10 pm

Re: Span tags in menu proxies

Postby mattf on Wed Apr 17, 2019 1:12 pm

I tried this in a new Side Nav and a new Tripane and it did not work in either. I'm attempting to add a custom icon in front of just one topic. I'm sure I did something incorrectly but don't know what it is.

In the Side Nav experiment, I created a new skin, opened it in Notepad++ as suggested in the article, and added a new style at the level of the Side Navigation Menu Item. I successfully saved the file as valid XML, but the new style did not show up in the Skin Editor.

In the Tripane, there was no stylesheet content in the skin when I looked at it in Notepad++, even though when I look at it in the Skin Editor there are a ton of styles listed. When I tried to add a stylesheet section in Notepad++, it again had no effect once I opened that skin in the skin editor.

The only way I was able to create a custom icon was in a skin that was associated with a test Webhelp target that I made. But webhelp targets are deprecated. I created a new class in that experiment ("pdf") and now, oddly, I have that pdf option in the Style Class dropdown on all the properties dialogs for all my topics, even though I deleted the test target and the associated test skin.

I would love some help if anyone has any ideas. Officially we're using the Side Nav HTML5 target, not the Top Nav. Still, I thought this trick might work for Side Nav, too.
Matt F
You learn something new every day if you're not careful.
User avatar
mattf
Sr. Propeller Head
 
Posts: 276
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: Span tags in menu proxies

Postby jjw on Wed Apr 17, 2019 4:05 pm

You can always add a class manually to a TocEntry by editing the toc file with a text editor. Then target the enclosed link in a stylesheet.

Code: Select all
<TocEntry
      Title="Logging on to SPM"
      Link="/Content/Topics/Interface/SPM/pcd_Logon_SPM.htm"
     Class="pdf"
/>


and then in the stylesheet:

Code: Select all
.pdf a::before {
   content: "";
    display: block;
    background: url("pdf.jpg") no-repeat;
    width: 20px;
    height: 20px;
    float: left;
    margin: 0 6px 0 0;
}


pdftoc.jpg


The style won't show up as an option in the toc entry properties screen if you add it this way - you'll have to add it manually - but at least you won't have to hack the skin.

Actually it would be kind of cool to have a plugin or script that ran through the toc file before publication and applied a class to toc entries depending on some property - for example, you could add custom icons depending on the file extension, or you could add a "new" class to files that had a recent "file modified" date. But then plugins aren't working in Flare 2019 ...
You do not have the required permissions to view the files attached to this post.
jjw
Sr. Propeller Head
 
Posts: 131
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: Span tags in menu proxies

Postby arkana on Thu Apr 18, 2019 12:10 am

@Matt F, I'm using side-nav and it's working. Maybe you can post the relevant skin XML code here..
Arthur Cui
Flare 2019
arkana
Propeller Head
 
Posts: 21
Joined: Wed Mar 14, 2018 11:10 pm

Re: Span tags in menu proxies

Postby mattf on Thu Apr 18, 2019 9:44 am

@jjw, what is your added .pdf style a subclass of? Can you supply more detail about that? I get the principle behind this, just not sure where to do each of these things.
@arkana, what version of Flare are you using? And what target type and skin type? I'm using the latest (Flare 2019) and there is nothing in the Side Nav skin editor to add a new side nav menu item as there used to be. I can still add toc entry classes if I create a Webhelp target, which also has a left-side nav menu, but Webhelp's deprecated. I'd love to know how you're doing this.

Thanks all for the responses.
-Matt
Matt F
You learn something new every day if you're not careful.
User avatar
mattf
Sr. Propeller Head
 
Posts: 276
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: Span tags in menu proxies

Postby jjw on Thu Apr 18, 2019 3:40 pm

If you add a class to the TocEntry (either manually as I did, or by adding it to the skin and selecting it in the properties as people here have described) it just gets added to the classes that are applied to the menu item when you generate the output. Specifically it's added to the list item in the menu. The text that you are targeting is in a link element inside that list item so you need to target that link element in your style.

flareclass.png
You do not have the required permissions to view the files attached to this post.
jjw
Sr. Propeller Head
 
Posts: 131
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: Span tags in menu proxies

Postby arkana on Thu Apr 18, 2019 6:37 pm

mattf wrote:@jjw, what is your added .pdf style a subclass of? Can you supply more detail about that? I get the principle behind this, just not sure where to do each of these things.
@arkana, what version of Flare are you using? And what target type and skin type? I'm using the latest (Flare 2019) and there is nothing in the Side Nav skin editor to add a new side nav menu item as there used to be. I can still add toc entry classes if I create a Webhelp target, which also has a left-side nav menu, but Webhelp's deprecated. I'd love to know how you're doing this.

Thanks all for the responses.
-Matt

I'm also using Flare 2019 and the HTML5 skin. I suspect that the problem is where you added the style—it shouldn't be nested inside the Side Navigation Menu. This is my skin file.
You do not have the required permissions to view the files attached to this post.
Arthur Cui
Flare 2019
arkana
Propeller Head
 
Posts: 21
Joined: Wed Mar 14, 2018 11:10 pm

Re: Span tags in menu proxies

Postby mattf on Fri Apr 19, 2019 1:40 pm

Thanks again both of you. I think I'm almost there, but there are gaps in my CSS experience that are obscuring my path here. I have added the below code from Arkana to my skin, right above the Side Navigation Menu style:

<Styles>
<Style
Name="TocEntry">
<Classes>
<StyleClass
Name="AddPDFIcon"
Custom="true">
<Properties></Properties>
</StyleClass>
</Classes>
</Style>

But I still need help adding the appropriate style class to my stylesheet. First off, am I adding it to my main stylesheet or the stylesheet in the skin code?
Secondly, JJW suggested a style class (below) that looks like exactly what I want...

.pdf a::before {
content: "";
display: block;
background: url("pdf.jpg") no-repeat;
width: 20px;
height: 20px;
float: left;
margin: 0 6px 0 0;
}

...but why does it have a period in front of it? Nothing else in my stylesheet does. Is this a <p> subclass, or an <a> subclass or span class? What is it part of? I'm sure I can't just throw it into the stylesheet anywhere. Also, I'll need to stash a jpeg of the PDF icon somewhere, and I don't know where that goes. (This is why Madcap should have left a good thing alone.)

Also, if I use Arkana's code for the toc entry in the skin and JJW's code for the style class, then I would have to rename either JJW's example style class or Arkana's StyleClass name, to make them match, is that right?
Thanks for your patience on this, friendly helpers.
-mdf
Matt F
You learn something new every day if you're not careful.
User avatar
mattf
Sr. Propeller Head
 
Posts: 276
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: Span tags in menu proxies

Postby jjw on Fri Apr 19, 2019 3:19 pm

In this case I just put the style in the stylesheet which is specified as the master in my project properties so it defaults into my targets. Tbh, I rarely use the style editing features in Flare because I find it faster and more flexible to just do everything in Notepad++ or VSCode or whatever (and you can use nifty tools like SASS for example) - so I'm not much help when it comes to adding styles using the Flare interface.

In this case the class we add ends up being applied to an li element in the table of contents so you could use li.pdf as the selector instead of .pdf if you prefer. But you can target a class in general without specifying the element to which it is applied:
  • .pdf targets any element at all with a class of pdf
  • li.pdf targets any li with a class of pdf

.pdf a::before targets any a element whose parent element has a class of pdf (and prepends content before the contents of that a element).

The link to the image in the stylesheet (url("pdf.jpg")) is relative to the location of the stylesheet - so in this case, the icon is in the same folder as the stylesheet.

You can name the class whatever you like as long as the class you pick in your table of contents matches the one in your stylesheet, but I strongly recommend "my-awesome-class". :wink:

J
jjw
Sr. Propeller Head
 
Posts: 131
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: Span tags in menu proxies

Postby arkana on Mon Apr 22, 2019 1:29 am

mattf wrote:am I adding it to my main stylesheet or the stylesheet in the skin code?

Add it in the main stylesheet. There's no separate stylesheet for the skin. The skin code only specifies a selector used to control the styling of the menu item in the side menu, and you should include that selector in your main stylesheet.

mattf wrote:...but why does it have a period in front of it? Nothing else in my stylesheet does. Is this a <p> subclass, or an <a> subclass or span class? What is it part of? I'm sure I can't just throw it into the stylesheet anywhere. Also, I'll need to stash a jpeg of the PDF icon somewhere, and I don't know where that goes. (This is why Madcap should have left a good thing alone.)

This is generic class. Read the Flare help (https://help.madcapsoftware.com/flare20 ... ricClasses) to understand this concept.
Arthur Cui
Flare 2019
arkana
Propeller Head
 
Posts: 21
Joined: Wed Mar 14, 2018 11:10 pm

Re: Span tags in menu proxies

Postby mattf on Mon Apr 22, 2019 9:42 am

Success! Thanks all for your help. Also, @arkana, thanks for the article. That's helpful.
-mdf
Matt F
You learn something new every day if you're not careful.
User avatar
mattf
Sr. Propeller Head
 
Posts: 276
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window

Re: Span tags in menu proxies

Postby Jbleasdale on Tue May 21, 2019 6:54 am

Sometimes you do not need to use the XML file to do this kind of thing. If you know the CSS selector (that can be found using the developer tools in the browser), then you can add that to your mainstyles.css or homestyes.css stylesheets which should override whatever has been specified in the skin.

For icons in the top nav, using the nth child selector or attribute equals selector is often a fairly easy way to do it with CSS.
Joe Bleasdale

My Linkedin

Image
Jbleasdale
Propeller Head
 
Posts: 58
Joined: Tue Mar 21, 2017 3:35 pm

Re: Span tags in menu proxies

Postby doc_guy on Fri May 24, 2019 1:59 pm

I'll add one more thing that I don't think was covered above. (Pardon if I'm wrong.)

While the Top/Side nav skin does not allow you to create a class of TOC entry, you can use the TriPane skin to create the class. So you add the TriPane skin to your project, even though you aren't going to use it. Then in the TriPane skin you to to the Styles tab, and go down to the TOC Entry item. Then click Add Class.

Image

Your new class is added to the list. Now close the skin file you're done there.

Now go to your TOC, and when you click on the class option, your class is present:

Image

In the output, the class is added:

Image

Now you just use CSS to create whatever style you want for that class in your main style sheet.
User avatar
doc_guy
Propellus Maximus
 
Posts: 1940
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West

Re: Span tags in menu proxies

Postby mattf on Fri May 24, 2019 3:13 pm

Doc Guy, thanks. That jibes with what I saw earlier when I added the class using the old Webhelp skin. After I blew it away (realizing I could not use that skin) the class persisted in my other skin's drop-down menu. Nice shortcut.
Matt F
You learn something new every day if you're not careful.
User avatar
mattf
Sr. Propeller Head
 
Posts: 276
Joined: Thu Feb 09, 2006 5:35 pm
Location: Next to the window


Return to Styles, Stylesheets and XML

Who is online

Users browsing this forum: No registered users and 2 guests

cron