PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/templates/base.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 97 lines | 77 code | 12 blank | 8 comment | 5 complexity | f2578e33501cf9dd58af0c4b7030b511 MD5 | raw file
 1<% _=n_ %>
 2<!DOCTYPE HTML>
 3<html>
 4    <!--base.mako-->
 5    ${self.init()}
 6    <head>
 7        <title>${self.title()}</title>
 8        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 9        ${self.metas()}
10        ${self.stylesheets()}
11        ${self.javascripts()}
12    </head>
13    <body class="inbound">
14        ${next.body()}
15    </body>
16</html>
17
18## Default title
19<%def name="title()"></%def>
20
21## Default init
22<%def name="init()"></%def>
23
24## Default stylesheets
25<%def name="stylesheets()">
26    ${h.css('base')}
27</%def>
28
29## Default javascripts
30<%def name="javascripts()">
31    
32    ## Send errors to Sntry server if configured
33    %if app.config.sentry_dsn:
34        ${h.js( "libs/tracekit", "libs/raven" )}
35        <script>
36            Raven.config('${app.config.sentry_dsn_public}').install();
37            %if trans.user:
38                Raven.setUser( { email: "${trans.user.email}" } );
39            %endif
40        </script>
41    %endif
42
43    ${h.js(
44        "libs/jquery/jquery",
45        "libs/jquery/jquery.migrate",
46        "libs/jquery/select2",
47        "libs/bootstrap",
48        "libs/underscore",
49        "libs/backbone/backbone",
50        "libs/handlebars.runtime",
51        "galaxy.base",
52        "mvc/ui",
53        'libs/require'
54    )}
55
56    <script type="text/javascript">
57        ## global configuration object
58        var galaxy_config =
59        {
60            root: '${h.url_for( "/" )}'
61        };
62
63        // console protection
64        window.console = window.console || {
65            log     : function(){},
66            debug   : function(){},
67            info    : function(){},
68            warn    : function(){},
69            error   : function(){},
70            assert  : function(){}
71        };
72
73        ## configure require
74        require.config({
75            baseUrl: "${h.url_for('/static/scripts') }",
76            shim: {
77                "libs/underscore": { exports: "_" },
78                "libs/backbone/backbone": { exports: "Backbone" }
79            }
80        });
81    </script>
82
83    %if not form_input_auto_focus is UNDEFINED and form_input_auto_focus:
84        <script type="text/javascript">
85            $(document).ready( function() {
86                // Auto Focus on first item on form
87                if ( $("*:focus").html() == null ) {
88                    $(":input:not([type=hidden]):visible:enabled:first").focus();
89                }
90            });
91        </script>
92    %endif
93
94</%def>
95
96## Additional metas can be defined by templates inheriting from this one.
97<%def name="metas()"></%def>