Permalink
Browse files

Mention tw2.core.DirLink in the docs. Fixes #69.

  • Loading branch information...
ralphbean committed Apr 16, 2013
1 parent 4aef579 commit dce1db6979d3c3abfae5ca10f05ad536b5a3347d
Showing with 10 additions and 0 deletions.
  1. +1 −0 docs/design.rst
  2. +9 −0 tw2/core/resources.py
@@ -166,6 +166,7 @@ To define a resource, just add a :class:`tw2.core.Resource` subclass to the widg
.. autoclass:: tw2.core.CSSSource
.. autoclass:: tw2.core.JSLink
.. autoclass:: tw2.core.JSSource
.. autoclass:: tw2.core.DirLink
Resources are widgets, but follow a slightly different lifecycle. Resource subclasses are passed into the :attr:`resources` parameter. An instance is created for each request, but this is only done at the time of the parent Widget's :meth:`display` method. This gives widgets a chance to add dynamic resources in their :meth:`prepare` method.
@@ -191,6 +191,15 @@ def __repr__(self):
class DirLink(Link):
''' A whole directory as a resource.
Unlike :class:`JSLink` and :class:`CSSLink`, this resource doesn't inject
anything on the page.. but it does register all resources under the
marked directory to be served by the middleware.
This is useful if you have a css file that pulls in a number of other
static resources like icons and images.
'''
link = Variable()
filename = Required
whole_dir = True

0 comments on commit dce1db6

Please sign in to comment.