jquery and other js scrip stuff works for theming done right

Added by Terence Mill almost 6 years ago

I wanted to make the right sidbar menu slide-in, slide-out with jqeury (javscript) using redmine themes. The first problem was that themes only can provide one javascript file theme.js, but we need at leat two js (jquery min and slider module) to be able to do the job. So i wrote a js which included other js via header.addccild document.write() , which worked so far the js was imported. But first themes js is loaded to late in layouts base.rhtml (first js heads from "core", then plugin's js the themes.js, moreover jquery is not available at right time, mean when i pushed slider behaviour into document by jquery(document).ready() function which i also called in theme.js.
No i ended up to <script src=".../jquery...js> include direct into layouts base.rthml before js heads and use it by theme.js "jquery(document).ready()" block in my theme.
That is not the code seperation i aimed, means to pack all into the theme. Futhermore i hade to extens layouts base rhtml sidebar div with my slider class handler and onlick tag. THis again i couldn't pack into theme, cause there is no html injection or kind or templating possible.
Everyone is welcome to show me direction how redmine themes can apply thing better "seperated" without core modification, however sidebar slider works now like a charm

I wanna male sidebar menue use accordion qith jquery too and top menu stay fixd (when scolled) with css.
I really wanna share this, but as theme package without base.rhtml mod i don't get it done.

Any ideas are welcome, or new features to enhance theme support in redmine.

Replies (5)

RE: jquery and other js scrip stuff works for theming done right - Added by Jan Niggemann (redmine.org team member) over 5 years ago

Did you ever manage to get this done?
It's exactly what I'm looking for...

RE: jquery and other js scrip stuff works for theming done right - Added by Terence Mill over 5 years ago

It's still like i desribed above. It works but i need to extend the base.rhtml to include jquery before loading theme.js. If put the js into theme (where i only can load one js file btw) its not available when renderimng the sidebar.
Furthemore the apprach that every plugin can bring its own js is really ugly from architects view. You can get loaded several version of the the same e.g. jquery lib and don't know which one's forced.
It would need a redmine (rails?)Javscript Handler core class, where every plugin must register its js lib with name, version and url. This class will at least throw error if js already registered with same or warning if with similar name.

RE: jquery and other js scrip stuff works for theming done right - Added by Terence Mill over 5 years ago

I juts added two issues accoding this problem.
Go and vote for it, maybe it will raise some day in raodmap ;)

#11424
#11425

RE: jquery and other js scrip stuff works for theming done right - Added by Jan Niggemann (redmine.org team member) over 5 years ago

Terence Mill wrote:

It's still like i desribed above. It works but i need to extend the base.rhtml to include jquery before loading theme.js. If put the js into theme (where i only can load one js file btw) its not available when renderimng the sidebar.

I now understand why there no themes that implement this...

Furthemore the apprach that every plugin can bring its own js is really ugly from architects view. You can get loaded several version of the the same e.g. jquery lib and don't know which one's forced.

Right, that's bad.

If I understand correctly, this plugin whould do the same http://www.redmine.org/projects/redmine/wiki/PluginCollapse - but I can't find out if it's 1.4.x compatible...

PS I'll vote for the issues!

RE: jquery and other js scrip stuff works for theming done right - Added by Terence Mill over 5 years ago

Well, my plugin (with base extension) slides in and out from right side and lools more web2.0 like i would think.
I thought abou doing main menu (projects tabs) as slider from left with accordion similar to chili's theme, but that impossible without base/core mods. I want ti have theming be more mighty, cause a theme shouldn't need to modify cor classes.

(1-5/5)