Project

General

Profile

Actions

Feature #11425

open

JavaScript library handler for teheming and plugins

Added by Terence Mill almost 12 years ago. Updated almost 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

This request is featured by an real problem i have:

Problem
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.

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


Related issues

Related to Redmine - Feature #11424: Allow more than one javascript library for themesNew

Actions
Actions #1

Updated by Terence Mill almost 12 years ago

related to #9710 Javascript repository cache , e.g. jquery

Actions #2

Updated by Go MAEDA almost 3 years ago

  • Related to Feature #11424: Allow more than one javascript library for themes added
Actions

Also available in: Atom PDF