[Cubicweb] Cubicweb Digest, Vol 5, Issue 3

Adrien Di Mascio adrien.dimascio at logilab.fr
Thu Jul 9 07:53:06 CEST 2009


Hi Carlos,

On Thursday 09 July 2009 00:00:48 Carlos Balderas wrote:
> I needed to add a javascrit file too, when I put it in the
> external_resources file, I noticed that I lost some functionality of the
> edit-forms (double click editing attribute of an entity in the primary view
> for example), so, what I did was add this files with

If you redefine the JAVASCRIPTS or the STYLESHEETS variables in your 
external_resources file, it will totally ignore the default values of those 
variables. For the record, here are the default values :

STYLESHEETS = DATADIR/cubicweb.css
JAVASCRIPTS = DATADIR/jquery.js, DATADIR/jquery.corner.js, \
                         DATADIR/jquery.json.js, DATADIR/cubicweb.compat.js,\ 
                         DATADIR/cubicweb.python.js,
                         DATADIR/cubicweb.htmlhelpers.js

(this can be found in cubicweb/web/views/webconfig.py)

CSS & JS defined in those variables will then be included in every page served 
by your application. In a standard cubicweb application, those default files 
are more or less required in order to have a fully operational application 
(which is certainly not a good thing considering the ton of JS files 
required). Therefore in your case, are you sure you simply haven't forgotten 
one of those files ? 

One last thing, if your JS file is not required in most pages of your 
application, you should maybe think about only doing the :

  self.req.add_js('myfile.js')

in the views specifically requiring it.

Hope this helps.

-- 
Adrien Di Mascio                              LOGILAB, Paris (France).
Formations Python,Zope,Debian,Calcul    http://www.logilab.fr/formations
Développement logiciel sur mesure:      http://www.logilab.fr/services
Informatique scientifique:              http://www.logilab.fr/science
Gestion de connaissances:               http://www.cubicweb.org/
Python in Python:     http://codespeak.net/pypy/dist/pypy/doc/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090709/8bf6751d/attachment-0048.sig>


More information about the Cubicweb mailing list