Looks like it's time to make our forum more easily skinnable. Do you have any suggestions?
A few things to look at:
edit: sorry used some made up terminology. by "native" I mean the "core" elements. For example I would consider question title a "core" element, but any layout elements as belonging to local customization - any containers that package say question title, tool links - non-mandatory. That way we could clearly mark which elements are key, and which are up to the skin designer.
edit 2: we should probably limit element lookup in javascript to those "core" elements only - that way it will be easier to guarantee that skin javascript will work - another good reason to mark those up clearly.
how should site administrator change/customize skin?
I think the current way skins are customized is fine. The template system is easy to understand, and Django's cascading mechanism (i.e. if a file isn't there in the custom template, load it from the default directory) is great. I personally am also fine with the skin being defined in a config file. Once there's an admin tool, it's of course also nice to have it there as a drop-down menu, but it's not really a priority IMO.
what naming conventions to choose for id and class names
I think it pretty much doesn't matter as long as they are consistent, and written down in the Wiki.
I would propose to make a choice between Camel Case and underlines:
.MainQuestion or .main_question
there are arguments for and against both of them. Using underlines and small caps prevents case errors that are often easy to overlook.
Other than that, I think class names should be as short as possible, and be defined by function (and not by properties).
.YellowBox No!
.InfoBox yes!
One thing that should be decided early on is whether we're going to use multiple classes. Using more than two classes breaks in IE6.
Multiple classes would be a great tool. Consider
<div class="InfoBox LeftMenu Warning">
it would be possible to split CSS rules that generally apply to Info boxes, rules that apply to Info boxes in the left hand menu, and Info boxes that are warnings into three reusable classes.
We are going to want to support IE6 in the standard template, though, I presume. Sadly, it still has a considerable market share.
what elements to pick as "application native" and which - leave them as part of local customization?
Can you make an example of an element that could be part of the local customization? I'm not sure I understand this entirely.
how to make javascript that is part of UI automatically work in new skins?
This is a very good question. If I understand Django's templating system right, it would be possible to have a common.js in the default template. As long as people don't overwrite that with a local common.js in their template, the default file is used. Is this correct? If it is, I would suggest to maintain a core JavaScript directory that is directly connected with the JavaScript framework used.
/default/media/js/askbot_core/jquery.js
/default/media/js/askbot_core/org.askbot.editor.js
/default/media/js/askbot_core/org.askbot.utils.js
/default/media/js/askbot_core/...
people looking to customize their template will be told not to create a askbot_core directory so the one from the default template can be used (and updated). Should people, however, want to fork the JavaScript core (e.g. in order to use a different JS framework) they can override the askbot_core directory completely (at their own risk).
Would this be a workable idea? I'm still a total newbie in all matters Django and Python.
One other thing we should be working on is using semantically correct elements everywhere. There are a few page titles here and there that are divs that really should be h1, h2 etc...
Regarding cascaded skins - they are not part of django per se, I've built that system for the forum.
Its weak point is that it makes possibility for two kinds of skins - the "full" ones that have all the files and "lazy" ones that have only some files. They are not the same because you cannot inherit from the "lazy" template in the same way (and it's actually impossible), yet they are stored the same way and may confuse people that they are equivalent in their function.
Secondly we have only one full skin - but I imagine that there might be several - e.g. with different layouts. If we want to support more than one base skin then we need two variables to define skin: name of full base skin and name of "lazy" one.
I thought that it would also be nice to upload media images through the admin UI (something that less tech savvy users will probably like) - so that is asking for another layer for media resolution on top of "lazy"->"full": "uploaded"->"lazy"->"full". However for the templates we'd leave "lazy"->"full". Or "uploaded"->"full" if lazy skin is not defined.
An unsolved issue is resolution of media files in javascript. Currently javascript is pulling media from the skin - i.e. your customized skin - there is no cascaded fallback, that's why you have to copy at least all media files from default into your directory or replace them all with your files. However, media is resolved correctly on the server side. I gues we'll have to provide a javascript media lookup map which has correct url for each media file.
Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.
create your Q&A siteAsked: 2010-05-06 13:42:33 -0500
Seen: 558 times
Last updated: May 06 '10
Feature request: Add classes to body in default skin
Should we have any mandatory stuctural elements in skins?
Question about creating a custom skin
Does the skin setting in /settings work?
Are there skins/templates for askbot?
What to improve in the askbot theme?
How to fix "UndefinedError: 'settings' is undefined" in git branch
Copyright Askbot, 2010-2011. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.