Ignore:
Timestamp:
8 Apr 2012, 16:28:37 (13 years ago)
Author:
Henrik Bettermann
Message:

Include favicon as a resource.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/browser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/browser.txt

    r8062 r8065  
    3030  >>> browser = Browser()
    3131
    32 Let's get the default view of a university::
     32Let's get the default view of a university and see if the
     33favicon is properly referenced::
    3334
    3435  >>> browser.open('http://localhost/myuniversity')
    3536  >>> print browser.contents
    3637  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     38  ...href="http://localhost/myuniversity/@@/waeup_kofa/favicon.ico"
    3739  ...Welcome to WAeUP.Kofa...
    3840  ...
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/resources.py

    r7819 r8065  
    2020#from hurry import yui
    2121from hurry.resource import Library, ResourceInclusion
     22from hurry.resource.core import inclusion_renderers, EXTENSIONS
    2223from hurry.jqueryui import jqueryui, base, blitzer, ui_lightness, humanity
    2324from hurry.jquery import jquery
     
    2627#: All local resources are registered under the name ``waeup_kofa``.
    2728waeup_kofa = Library('waeup_kofa', 'static')
     29
     30#: A resource that includes a favicon.
     31#: In the `gerResource()` method of the theme
     32#: require the JavaScript code to be rendered into the page::
     33#:
     34#:   from waeup.kofa.browser.resources import favicon
     35#:   # ...
     36#:   class MyTheme(grok.GlobalUtility):
     37#:     # ...
     38#:     def getResources(self):
     39#:       favicon.need()
     40#:       return [...]
     41
     42def render_ico(url):
     43    return '<link rel="shortcut icon" type="image/x-icon" href="%s" />' % url
     44inclusion_renderers['.ico'] = render_ico
     45EXTENSIONS.append('.ico')
     46
     47favicon = ResourceInclusion(waeup_kofa, 'favicon.ico')
    2848
    2949#: A resource that binds a jQueryUI datepicker widget to each
     
    4363#:         datepicker.need()
    4464#:
    45 #:   This way all required JavaScripts will be rendered correctly
     65#:   This way all required JavaScript will be rendered correctly
    4666#:   into the HTML page generated.
    4767#:
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/staffsitelayout.pt

    r8063 r8065  
    88    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    99    <meta name="robots" content="index, follow" />
    10     <link rel="shortcut icon" tal:attributes="href static/favicon.ico" type="image/x-icon" />
    1110    <link rel="alternate" type="application/rss+xml" title="RSS"
    1211        href="http://www.example.net/feed.rss"
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/studentsitelayout.pt

    r8063 r8065  
    1212        tal:attributes="href python: view.url(layout.site, '@@/waeup.kofa.browser/mobile.css')"
    1313        type="text/css" />
    14     <link rel="shortcut icon" tal:attributes="href static/favicon.ico" type="image/x-icon" />
    1514    <link rel="alternate" type="application/rss+xml" title="RSS"
    1615        href="http://www.example.net/feed.rss"
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/theming.py

    r7819 r8065  
    2626from waeup.kofa.browser.interfaces import ITheme
    2727from waeup.kofa.browser.resources import (
    28     waeuptheme_empty, waeup_base_css,
     28    waeuptheme_empty, waeup_base_css, favicon
    2929    )
    3030
     
    3636
    3737    def getResources(self):
     38        favicon.need()
    3839        return [waeup_base_css]
    39 
    40 #class KofaThemeRed1(grok.GlobalUtility):
    41 #    grok.implements(ITheme)
    42 #    grok.name('red waeup theme')
    43 
    44 #    description = u"Uli's Red Theme"
    45 
    46 #    def getResources(self):
    47 #        return [waeuptheme_red1]
    48 
    49 #class KofaThemeGray1(grok.GlobalUtility):
    50 #    grok.implements(ITheme)
    51 #    grok.name('gray waeup theme')
    52 
    53 #    description = u"Henrik's Gray Theme"
    54 
    55 #    def getResources(self):
    56 #        return [waeuptheme_gray1]
    5740
    5841class KofaThemeEmpty(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.