HACKING ======= See the top-level docs in the ceph repository for general information about how to submit code. This file is about the specifics of how this module fits together. This module uses deliberately simple/explicit structure so that it is accessbile to people who are not specialists in webapps. Very little javascript knowledge is needed. The absence of a javascript toolchain (node, bower, grunt, etc) is considered a feature rather than a bug. All of the CSS and Javascript in the git repository is used as-is without any compilation/minification. On the server (i.e. python-side) -------------------------------- In the serve() method, there's a cherrypy request handler object with methods that correspond to URLs. See the cherrypy documentatino for how that stuff works. There is a mixture of endpoints that return JSON (for live updates of pages) and endpoints that return HTML (for initial loads of pages). The HTML files are rendered from jinja2 templates (the .html files in the source tree). The initial render of the HTML template includes some json-ized inline data, so that the page can be rendered immediately without having to make another request to the server to load the data after loading the markup. The pattern is that for some resource 'foo' we would generally have three methods, along the lines of: :: def _foo(self): return {...the data of interest...} @cherrypy.expose def foo(self): data = self._foo() *render a foo.html template with data inline* @cherrypy.expose @cherrypy.tools.json_out() def foo_data(self): return self._foo() In the browser (Javascript and markup) -------------------------------------- The javascript code uses the rivets.js (http://rivetsjs.com/) library to render the data from the server into HTML templates, and to enable subsequent updates without reloading the whole page. The use of rivets.js looks something like this: ::