Project

General

Profile

[Wt 3.3.0] Bootstrap <i>

Added by Thomas Saquet almost 12 years ago

Hello,

I am currently integrating a bootstrap theme using the new Wt compatibility with bootstrap. I am using a menu with icons. I tried to use the .setIcon of Wt::WMenuItem but it is not compatible with the used by bootstrap. (I don't understand why they choosed since it is still described here : http://www.w3.org/TR/html5/text-level-semantics.html#the-i-element and it could be a problem for retro-compatibility, but it is another subject)

Do you have an idea for a workaround ? Do you think it would be possible to make Wt compatible ?

Thank you in advance,

Regards.

Thomas


Replies (5)

RE: [Wt 3.3.0] Bootstrap <i> - Added by Koen Deforche almost 12 years ago

Hey Thomas,

I believe that the only thing that is needed is a CSS declaration, very similar to what we did for WPopupMenuItem which does support images in bootstrap theme. Because icons weren't support for plain menu items in Wt before this release, and aren't supported for menu items in bootstrap, we didn't bother (yet).

Regards,

koen

RE: [Wt 3.3.0] Bootstrap <i> - Added by Thomas Saquet almost 12 years ago

Hello Koen,

A simple CSS declaration could work, but it would

- duplicate the theme css declaration (duplication is never the good solution !),

  • prevent me to benefit from the new versions of the theme since i override the declaration.

I think the simplest way to make it easy to use would be to give access to "Wt::WText icon_" in the WMenuItem with a simple getIcon() that would allow me to add the CSS class I need to that element. Do you think it is possible to add that ?

Regards,

Thomas

RE: [Wt 3.3.0] Bootstrap <i> - Added by Koen Deforche almost 12 years ago

Hey Thomas,

I've filed this as a feature request for 3.3.1: http://redmine.emweb.be/issues/1755

Regards,

koen

RE: [Wt 3.3.0] Bootstrap <i> - Added by Thomas Saquet almost 12 years ago

Great, thank you :)

RE: [Wt 3.3.0] Bootstrap <i> - Added by Thomas Saquet over 11 years ago

Hello,

I found a workaround for this too :

Wt::WMenuItem *newMenuItem = new Wt::WMenuItem("name");
Wt::WText *iconHTML = new Wt::WText("</span><i class='icon icon-class'></i><span>",Wt::XHTMLUnsafeText);
Wt::WAnchor *anchorInsideMenu = (Wt::WAnchor*)newMenuItem->widget(0);
anchorInsideMenu->insertWidget(0,alertCount);

Regards,

Thomas

    (1-5/5)