##// END OF EJS Templates
js tests: simplify js test html
ergo -
Show More
@@ -1,12 +1,14 b''
1 {% extends "/layout.jinja2" %}
2 {% from '/reports/reports_small_list_old.jinja2' import render_reports with context %}
3 {% block additional_layout_scripts %}
4 <script src="/static/scripts/jerrormator.js" type="text/javascript"></script>
5 {% endblock %}
6 {% block content_class %}{% endblock %}
7 {% set layout_disable_menu = True %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
8 5
9 {% block additional_styles %}
6 <title>Error test</title>
7 <meta name="description" content="">
8 </head>
9 <body>
10
11 <h1>Error test</h1>
10 12
11 13
12 14 <script type="text/javascript">
@@ -24,7 +26,7 b''
24 26 Airbrake.setHost('api.appenlight.com');
25 27 console.log(Airbrake)
26 28 // insert your public api key
27 Airbrake.setKey('1ec3119102154a8caaa307a4495b8558');
29 Airbrake.setKey('{{ request.registry.settings.get('appenlight.public_api_key') }}');
28 30 Airbrake.setEnvironment('production');
29 31 Airbrake.setErrorDefaults({
30 32 url: document.URL,
@@ -47,11 +49,6 b' setTimeout(function(){'
47 49
48 50
49 51 </script>
50 {% endblock %}
51
52 {% block page_title %}
53 <h1 class="page-title">{{_('JS')}}</h1>
54 {% endblock %}
55 {% block content %}
56 52
57 {% endblock %}
53 </body>
54 </html>
@@ -1,17 +1,50 b''
1 {% extends "/layout.jinja2" %}
2 {% block dojodeps %}
3 deps: ["appenlight","appenlight/sections/test_error"]
4 {% endblock %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 5
6 {% block additional_layout_scripts %}
6 <title>Error test</title>
7 <meta name="description" content="">
8 {% if request.registry.settings.get('appenlight.public_api_key') %}
9 <script type="application/javascript">
10 var initAppEnlight = function () {
11 if(this.readyState!='loading'){
12 AppEnlight.init({
13 apiKey:'{{ request.registry.settings.get('appenlight.public_api_key') }}',
14 windowOnError: 1 // enable to hook to window.onerror
15 });
16 // setting request info is completly optional
17 AppEnlight.setRequestInfo({
18 server:"{{ request.environ.get('SERVER_NAME', '<unknown>') }}",
19 {% if request.user %}
20 username:'{{ request.user.user_name }}',
21 {% endif %}
22 ip: "{{ request.environ.get('REMOTE_ADDR', '') }}",
23 request_id:"{{ request.environ.get('appenlight.request_id', '') }}"
24 });
7 25
8 {% endblock %}
9 {% block content_class %}{% endblock %}
10 {% set layout_disable_menu = True %}
26 AppEnlight.addGlobalTags({framework:'angular', 'language':'javascript'});
27 AppEnlight.addGlobalExtra({some_key:'on every request'});
11 28
12 {% block additional_styles %}
13 <script type="text/javascript">
29 }
30 };
31 // load the script asynchroneously
32 var scrElem = document.createElement('script');
33 scrElem.type = 'text/javascript';
34 scrElem.async = true;
35 scrElem.onload = scrElem.onreadystatechange = initAppEnlight;
36 scrElem.src = "//cdn.jsdelivr.net/appenlight/latest/appenlight-client.min.js";
37 scrElem.src = "/static/appenlight/js/appenlight-client.js";
38 var p = document.getElementsByTagName('script')[0];
39 p.parentNode.insertBefore(scrElem, p);
40 </script>
41 {% endif %}
42 </head>
43 <body>
44
45 <h1>Error test</h1>
14 46
47 <script type="text/javascript">
15 48
16 49 function subfunction() {
17 50 subsubfunction();
@@ -43,11 +76,6 b''
43 76 }, 3000);
44 77
45 78 </script>
46 {% endblock %}
47
48 {% block page_title %}
49 <h1 class="page-title">{{ _('JS') }}</h1>
50 {% endblock %}
51 {% block content %}
52 79
53 {% endblock %}
80 </body>
81 </html>
@@ -1,33 +1,58 b''
1 {% extends "/layout.jinja2" %}
2 {% block additional_layout_scripts %}
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5
6 <title>Error test</title>
7 <meta name="description" content="">
8 {% if request.registry.settings.get('appenlight.public_api_key') %}
9 <script type="application/javascript">
10 var initAppEnlight = function () {
11 if(this.readyState!='loading'){
12 AppEnlight.init({
13 apiKey:'{{ request.registry.settings.get('appenlight.public_api_key') }}',
14 windowOnError: 1 // enable to hook to window.onerror
15 });
16 // setting request info is completly optional
17 AppEnlight.setRequestInfo({
18 server:"{{ request.environ.get('SERVER_NAME', '<unknown>') }}",
19 {% if request.user %}
20 username:'{{ request.user.user_name }}',
21 {% endif %}
22 ip: "{{ request.environ.get('REMOTE_ADDR', '') }}",
23 request_id:"{{ request.environ.get('appenlight.request_id', '') }}"
24 });
25
26 AppEnlight.addGlobalTags({framework:'angular', 'language':'javascript'});
27 AppEnlight.addGlobalExtra({some_key:'on every request'});
28
29 }
30 };
31 // load the script asynchroneously
32 var scrElem = document.createElement('script');
33 scrElem.type = 'text/javascript';
34 scrElem.async = true;
35 scrElem.onload = scrElem.onreadystatechange = initAppEnlight;
36 scrElem.src = "//cdn.jsdelivr.net/appenlight/latest/appenlight-client.min.js";
37 scrElem.src = "/static/appenlight/js/appenlight-client.js";
38 var p = document.getElementsByTagName('script')[0];
39 p.parentNode.insertBefore(scrElem, p);
40 </script>
41 {% endif %}
42 </head>
43 <body>
3 44
4 {% endblock %}
45 <h1>Error test</h1>
5 46
6 {% block additional_styles %}
7 47 <script type="text/javascript">
48
8 49 setTimeout(function(){
9 50 AppEnlight.log('error',"some test message");
10 51 AppEnlight.log('info',"some info message");
11 52 AppEnlight.log('warning',"some warn message");
12 53 },2000);
13 54
14
15
16
17
18 55 </script>
19 {% endblock %}
20
21 {% block content_class %}{% endblock %}
22 {% set layout_disable_menu = True %}
23
24
25
26 {% block page_title %}
27 <h1 class="page-title">{{_('JS')}}</h1>
28 {% endblock %}
29 {% block content %}
30
31
32 56
33 {% endblock %}
57 </body>
58 </html>
General Comments 0
You need to be logged in to leave comments. Login now