Forums | Mahara Community

Developers /
Override thumb.png icons


Jeff Ferrell's profile picture
Posts: 9

07 June 2014, 14:09

Hi! Just poking around, trying to tweak a theme to my liking. Is there a clean way to override the "thumb.png" icons that show up, for instance, in the tabs on the Edit Content portfolio page? (Things like "Text Box", "Image", "Image Gallery" etc.) I'm working in Mahara 1.9.1. Thanks!

Jeff Ferrell's profile picture
Posts: 9

08 June 2014, 15:54

Hmm. So it seems to work if, for instance, to change the Media > Folder icon in the interface, I go to artefact/file/blocktype/folder/theme/ and add <mythemename>/static/images/thumb.png

But that has to be a kludge, right? That's a lot of folders to add if I want to tweak all the icons, and those will be wiped (possibly? I assume?) after an upgrade. Would I have to backup every instance of /theme/<mythemename>/static/images/thumb.png?

Aaron Wells's profile picture
Posts: 896

09 June 2014, 11:39

Hi Jeff,

Unfortunately that is the way themes for plugins work currently. There's a "/theme" directory within each plugin's directory, and you have to put custom theme code into each one of those.

I agree, this is not a very practical way to do things and it makes upgrades more difficult. Language strings used to be the same way (with a separate /lang under each plugin) but we have since centralized those so that custom lang files for plugins can go under the main /lang directory. There's currently a bug in our bug tracker to centralize themes the same way, so that custom theme files for those can go under the main /theme directory: https://bugs.launchpad.net/mahara/+bug/1231755

Cheers,

Aaron

Jeff Ferrell's profile picture
Posts: 9

09 June 2014, 12:53

Thanks, Aaron—I just wanted to make sure I wasn't making something easy into something difficult, simply because I'd mised a wrinkle somewhere. It's not so bad, once I developed an upload workflow.

Is this something I'll have tokeep an eye on during a future upgrade—will I have to carry over all my individual /theme changes individually?

Aaron Wells's profile picture
Posts: 896

09 June 2014, 16:13

Hi Jeff,

Well, it's worth keeping an eye on the Launchpad bug because we'll fix it eventually. The proposed fix will be backwards-compatible, though, so if you don't move the thumbnails into the main /theme directory, we'll still find them and use them at the old location under each plugin.

Until we get that fix in, you will indeed have to put your thumbnails under each plugin's directory, and be careful not to overwrite them when you do a major version upgrade.

If you're packaging your theme for distribution, you can basically tell each file where it should go in Mahara by making your ZIP file have portions of Mahara's directory structure. Like if you have a zip file that contains this directory structure:

/theme/{themename} : most of your custom theme files go here

/artefact/file/blocktype/folder/theme/{themename}/static/images : contains only a "thumb.png"

/blocktype/wall/theme/{themename}/static/images : contains only a "thumb.png"

... etc

And then you copy that root "theme", "artefact", and "blocktype" directories into your Mahara htdocs directory, most operating systems are smart enough that they will "merge" the copied file structure with the existing Mahara file structure, leave the existing directories in place, and only copy your new "thumb.png" files over the old "thumb.png" files.

Using a version control system is very helpful for handling these kind of changes as well.

Cheers,

Aaron

Kristina Hoeppner's profile picture
Posts: 4729

10 June 2014, 7:51

Hello Jeff,

The Mahara project manages its code via Git like many other open source projects. You can find the repository at https://gitorious.org/mahara/ and a clone of it at https://github.com/MaharaProject/mahara if you prefer to use Github.

Cheers

Kristina

 

Aaron Wells's profile picture
Posts: 896

17 June 2014, 16:26

Good news on this issue! We've merged in the patch to centralize plugin theme files ( https://bugs.launchpad.net/mahara/+bug/1231755 ).

So, this will be present in Mahara 1.10.0. Here is what has changed:

Before:

Plugin theme files (i.e. templates & images) were stored in each plugin's own directory, with a subdirectory under each plugin for each supported theme: /{plugintype}/{pluginname}/theme/{themename}/static/images/thumb.png

After:

Plugin theme files are searched for in a series of locations. First a local override, then in the theme's own directory, and lastly for backwards compatibility we look in the old location, the plugin's directory. In order of priority:

1. Local override: /local/theme/{plugintype}/{pluginname}/static/images/thumb.png

2. Within the theme's own directory: /theme/{themename}/{plugintype}/{pluginname}/static/images/thumb.png

3. The old location within the plugin's directory: /{plugintype}/{pluginname}/theme/{themename}/static/images/thumb.png

This should make it easier for custom theme authors to override the images and templates of themes. Just place them all under a directory for that plugin, inside your theme's directory, as shown in item #2 in the list.

Cheers,

Aaron

Jeff Ferrell's profile picture
Posts: 9

18 June 2014, 12:03

That's awesome! Thanks for the update!

8 results