Improvements #9115
closedSet the version in WBootstrapTheme C'tor
0%
Description
Namaskara,
Currently I create a BootstrapTheme object and then set the them version as follows:
auto btheme_ptr = std::make_shared<Wt::WBootstrapTheme>();
btheme_ptr->setVersion (Wt::BootstrapVersion::V3);
this->setTheme(btheme_ptr);
can we make it more robust as :
this->setTheme(WT::BootstrapTheme,Wt::BootstrapVersion::V3,path_to_bootstrap_theme_css_dir);
further
this->setTheme(WT::WtTheme,Wt::WT3,path_to_wt_css_dir);
If I have to add my own theme then...
this->setTheme(WT::Other,Wt::Other,path_to_other_css_dir);
that way I can have clean interface to set the theme for the page/widget.
Its preferable to set the pass to css directory...so that we have the flexibility to define our own themes in self contained directory.
Regards
Rathnadhar K V
Updated by Roel Standaert about 3 years ago
- Target version set to future
We were actually refactoring the Bootstrap theme to be split up in multiple classes, so WBootstrap2Theme
, WBootstrap3Theme
, WBootstrap4Theme
, and WBootstrap5Theme
, since they end up being dissimilar enough to warrant their own class.
The theme directory may be something we can take into consideration.
Updated by Rathnadhar K V about 3 years ago
Namaskara Roel,
That is wonderful.
May I suggest an improvement,
Have a common glue CSS class....WThemeContainer()....(name just a example, you can call it whatever you deem fit).
Now to this WThemeContainer class I add backend (s) ....WBootstrap2Theme ...WBootstrap5Theme....
Say I can add max of 8 backends.
int index = WThemeContainer(WBootStrap5Theme,responsive=true,path=path_to_css_file);
index 0 is fixed for Wt.css (fall back option) in case other css are not added.
Now WTheme class will have virtual member functions that is implemented by other CSS classes....
that way I can add any bootstrap similar theme easily ....
so in the application, only WThemeContainer is visible and based on index I get the css classes...
That way my WApplication is decoupled from back end theme....and I can easily add other frameworks' themes.
Regards
Rathnadhar KV
Updated by Rathnadhar K V about 3 years ago
Instead of index as int, you can even get a iterator to the theme within the container.
Updated by Roel Standaert about 2 years ago
- Status changed from New to Closed
- Target version deleted (
future)
I'm closing this since we now have separate Bootstrap classes.
Your idea does not seem feasible to me (or I don't quite understand it), since it's more than just CSS. The theme directly affects what HTML is being generated for the widgets.