jon48 / webtrees-theme-rural

Rural theme for webtrees
GNU General Public License v3.0
11 stars 2 forks source link

Minor change to help other modules coexist #46

Closed makitso closed 2 years ago

makitso commented 2 years ago

HI. I own the custom-css module and have noticed that quite a few users mix both the custom-css and rural theme. As documented in webtrees forum, custom-css only works with standard webtrees themes. However, I have made changes to custom-css for other modules and have been looking at what might be done to prevent the person box sizing conflict.

There is a way and that is that my attributes for setting these sizes can be dependent on [class*="wt-theme-"] option -- webtrees only themes. This would work but when tested with rural I see that you set an attribute in the body wt-theme-_myartjaubruraltheme . So, I am asking if you could remove this attributes since it appears it is not being used.?

jon48 commented 2 years ago

Hello, I would not mind helping, but this is not my code setting that attribute, but webtrees itself:

https://github.com/fisharebest/webtrees/blob/afb5350299c9c74d6e2f67d8dcf31e56def8d940/resources/views/layouts/default.phtml#L67

The only way to remove that would be to overwrite the layout.phtml in the theme, which I hope you understand I am not willing to do (this would not be a minor change anymore).

Maybe you could request for a new attribute to be added to differentiate custom/native modules.

Or, if, as advertised, the CSS file should be loaded only for native themes, why don't you check for that in your code? (assuming that people are indeed using ModuleCustomInterface for custom modules (I do, for sure)

public function headContent(): string
{
    if(!(app(ModuleThemeInterface::class) instanceof ModuleCustomInterface)) {
        $url = $this->assetUrl('css/custom.css');

        return '<link rel="stylesheet" href="' . e($url) . '">';
    }
    return '';
}
makitso commented 2 years ago

Jonathan, yes I see that now. I looked at the Justblack theme and it does not use that module. Anyway, I have addressed the problem with a new release of custom-css that only sets the chartbox sizes for webtrees standard themes.