Ticket #34: docbox.patch

File docbox.patch, 3.7 kB (added by Kaan, 2 years ago)

An offline document viewer for the Toolbox (offline docs should be in turbogears/docs/)

  • setup.py

    old new  
    8686    designer = turbogears.toolbox.designer:Designer 
    8787    info = turbogears.toolbox.base:Info 
    8888    catwalk = turbogears.toolbox.catwalk:CatWalk 
     89    docbox = turbogears.toolbox.docbox:DocBox 
    8990 
    9091    """, 
    9192    extras_require = { 
  • turbogears/toolbox/docbox/docnav.kid

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
     3 
     4<head> 
     5    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> 
     6    <title>Welcome to TurboGears</title> 
     7    <LINK HREF="/tg_static/css/toolbox.css" TYPE="text/css" REL="stylesheet" /> 
     8    <style> 
     9#top { 
     10        background-position:top left; 
     11     } 
     12    </style> 
     13    <script> 
     14function clearnav () { 
     15  window.parent.location.pathname=window.parent.frames[1].location.pathname 
     16  } 
     17    </script> 
     18</head> 
     19<body> 
     20<div id='top'> 
     21<h1><a href='../' target='_top'>Toolbox</a> &#x00BB; Documentation : <a href="/docs/" onclick="clearnav()">Remove</a></h1> 
     22</div> 
     23</body> 
     24</html> 
  • turbogears/toolbox/docbox/docmain.kid

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
     3 
     4<head> 
     5    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> 
     6    <title>DocBox</title> 
     7</head> 
     8 
     9<frameset rows="48px,*"> 
     10 
     11<frame src="docnav" name="navframe" frameborder='0'/> 
     12<frame src="/docs/" name="docsframe" frameborder='0'/> 
     13 
     14</frameset> 
     15 
     16</html> 
  • turbogears/toolbox/docbox/__init__.py

    old new  
     1import turbogears as tg 
     2import pkg_resources 
     3import os 
     4 
     5directory = pkg_resources.resource_filename('turbogears','docs') 
     6 
     7tg.config.update({'/docs': 
     8  { 
     9    'static_filter.on' : True, 
     10    'static_filter.dir' : directory, 
     11    'static_filter.index' : 'index.html' 
     12      } 
     13    } 
     14   ) 
     15 
     16class DocBox(tg.controllers.RootController): 
     17        """Browse downloaded TurboGears Documentation. 
     18        """ 
     19        __label__ = "Documentation" 
     20        __version__ = "0.1" 
     21        __author__ = "Kaan Divringi" 
     22        __email__ = "KublaChaos@gmail.com" 
     23        __copyright__ = "" 
     24        __license__ = "MIT" 
     25         
     26        icon = "/tg_static/images/docbox.png" 
     27         
     28        @tg.expose(template="turbogears.toolbox.docbox.docmain") 
     29        def index(self): 
     30          return dict() 
     31         
     32        @tg.expose(template="turbogears.toolbox.docbox.docnav") 
     33        def docnav(self): 
     34          return dict()