iain duncan <[EMAIL PROTECTED]> writes:

> Couple of things, 
>
> A) I can't get csslink and js link workin in custom widgets. I don't
> know where this is looking. From the book I tried:
>
> css = [widgets.CSSLink( __module__, "tree_view.css")]
>
> But it doesn't seem to be doing anything. tree_view.css is in my
> static/css dir. I tried a bunch of path name configurations but couldn't
> get any doing anything. I must be missing something somewhere!

Here's what I use:

================================================================================
import pkg_resources
from turbogears widgets
from turbogears.widgets import register_static_directory

pkg_name = "my_pkg"
static_dir = pkg_resources.resource_filename(pkg_name, "static")
register_static_directory(pkg_name, static_dir)
common_js = widgets.JSLink(pkg_name, "javascript/common.js")
================================================================================

Then, I use:

================================================================================
class MyForm(widgets.TableForm):
    name = 'my_form'
    javascript = [common_js, other_js, ...]
    fields = (...)
================================================================================


> B) The widget docs mention both the css link and js link attribute with
> no example and no link to further docs with examples. I think an example
> really needs to be in there and would be a trivial addition.
> Unfortunately, I don't know what it should say!

The CSSLink follows the same as the JSLink I've shown above.  Enjoy ;-)

-- 
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to