Changes between Version 15 and Version 16 of EggCookingTutorial/AdvancedEggCooking2
- Timestamp:
- 06/14/06 12:38:27 (1 year ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
EggCookingTutorial/AdvancedEggCooking2
v15 v16 26 26 #!text/css 27 27 div.helloworld h1 { 28 28 color: red; 29 29 } 30 30 }}} 53 53 version=VERSION, 54 54 packages=['helloworld'], 55 package_data={'helloworld' : ['htdocs/css/*.css', 'htdocs/images/*.jpg',56 'templates/*.cs' ]}57 55 entry_points={'trac.plugins': '%s = helloworld' % PACKAGE}, 56 package_data={'helloworld': ['htdocs/css/*.css', 'htdocs/images/*.jpg', 57 'templates/*.cs']}, 58 58 ) 59 59 }}} 69 69 #!python 70 70 def get_htdocs_dirs(self): 71 """ 72 Return a list of directories with static resources (such as style 71 """Return a list of directories with static resources (such as style 73 72 sheets, images, etc.) 74 73 76 75 `prefix` part defines the path in the URL that requests to these 77 76 resources are prefixed with. 78 77 79 78 The `abspath` is the absolute path to the directory containing the 80 79 resources on the local file system. 98 97 {{{ 99 98 #!python 100 from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet 99 from trac.web.chrome import INavigationContributor, ITemplateProvider, \ 100 add_stylesheet 101 101 }}} 102 102 108 108 109 109 from trac.core import * 110 from trac.web.chrome import INavigationContributor, ITemplateProvider, add_stylesheet 110 from trac.web.chrome import INavigationContributor, ITemplateProvider, \ 111 add_stylesheet 111 112 from trac.web.main import IRequestHandler 112 113 from trac.util import escape, Markup 114 115 class UserbaseModule(Component): 115 116 implements(INavigationContributor, IRequestHandler, ITemplateProvider) 116 117 117 118 # INavigationContributor methods 118 119 def get_active_navigation_item(self, req): 119 120 return 'helloworld' 120 121 121 122 def get_navigation_items(self, req): 122 123 yield 'mainnav', 'helloworld', Markup('<a href="%s">Hello</a>', 123 124 124 self.env.href.helloworld()) 125 125 126 # IRequestHandler methods 126 127 def match_request(self, req): 127 128 return req.path_info == '/helloworld' 128 129 129 130 def process_request(self, req): 130 131 add_stylesheet(req, 'hw/css/helloworld.css') 131 132 return 'helloworld.cs', None 132 133 133 134 # ITemplateProvider methods 134 135 def get_templates_dirs(self): 135 """ 136 Return the absolute path of the directory containing the provided 137 ClearSilver templates. 136 """Return a list of directories containing the provided ClearSilver 137 templates. 138 138 """ 139 139 from pkg_resources import resource_filename 140 140 return [resource_filename(__name__, 'templates')] 141 141 142 142 def get_htdocs_dirs(self): 143 """ 144 Return a list of directories with static resources (such as style 143 """Return a list of directories with static resources (such as style 145 144 sheets, images, etc.) 146 145 148 147 `prefix` part defines the path in the URL that requests to these 149 148 resources are prefixed with. 150 149 151 150 The `abspath` is the absolute path to the directory containing the 152 151 resources on the local file system. 168 167 <div id="content" class="helloworld"> 169 168 <h1>Hello world!</h1> 170 <img src="<?cs var:chrome.href ?>/hw/images/helloworld.jpg" >169 <img src="<?cs var:chrome.href ?>/hw/images/helloworld.jpg" /> 171 170 </div> 172 171