annotate views/hello_template.tpl @ 3:3f5bcad45756

pars a .conf | dynamic adding of divs | dynamiv VP scaling
author sean
date Wed, 15 Jul 2015 14:06:03 +0200
parents 3671857d1dfe
children 3e66e2f92770
rev   line source
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
1 <%
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
2 import math
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
3 break_tile_lines = math.ceil(len(tiles)/2)
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
4 tilecounter = 1
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
5 vp_size = 1;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
6
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
7 if len(tiles) <= 2:
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
8 vp_size = "6vw"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
9 elif len(tiles) >2 and len(tiles) <=4 :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
10 vp_size = "5vw"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
11 elif len(tiles) >4 and len(tiles) <=6 :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
12 vp_size = "4vw"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
13 elif len(tiles) >6 and len(tiles) <=8 :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
14 vp_size = "3vw"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
15 end
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
16 %>
2
3671857d1dfe added views
sean
parents:
diff changeset
17
3671857d1dfe added views
sean
parents:
diff changeset
18 <style>
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
19 *{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
20 margin: 0 auto;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
21 padding: 0 auto;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
22 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
23
2
3671857d1dfe added views
sean
parents:
diff changeset
24 #wrapper{
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
25 display: table;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
26 color: black;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
27 background-color: #F2F2F2;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
28 min-width: 100%;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
29 min-height: 100%;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
30 border-spacing: 10px;
2
3671857d1dfe added views
sean
parents:
diff changeset
31 }
3671857d1dfe added views
sean
parents:
diff changeset
32
3671857d1dfe added views
sean
parents:
diff changeset
33 .tile{
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
34 background-color: #FFFFFF;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
35 display:table-cell;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
36
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
37 width: auto;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
38 height: auto;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
39 border: 1px solid #999999;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
40 text-align:center;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
41 vertical-align: middle;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
42
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
43 -webkit-box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.4);
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
44 -moz-box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.4);
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
45 box-shadow: 0px 0px 3px 3px rgba(0,0,0,0.4);
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
46
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
47 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
48
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
49 .clear{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
50 display: table-row;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
51 clear: both;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
52 margin: 0;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
53 padding: 0;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
54 height: 0;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
55 overflow: hidden;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
56 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
57
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
58 .statusmon{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
59 border: 1px solid #000000;
2
3671857d1dfe added views
sean
parents:
diff changeset
60 color: white;
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
61 font-size: {{vp_size}};
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
62 font-family: "Lucida Console", Monaco, monospace;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
63 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
64
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
65 .chart{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
66 font-size: {{vp_size}};
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
67 font-family: "Lucida Console", Monaco, monospace;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
68 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
69
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
70 .active{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
71 background-color: #009900;
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
72 }
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
73
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
74 .dead{
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
75 background-color: #990000;
2
3671857d1dfe added views
sean
parents:
diff changeset
76 }
3671857d1dfe added views
sean
parents:
diff changeset
77
3671857d1dfe added views
sean
parents:
diff changeset
78 </style>
3671857d1dfe added views
sean
parents:
diff changeset
79
3671857d1dfe added views
sean
parents:
diff changeset
80 <div id = "wrapper">
3671857d1dfe added views
sean
parents:
diff changeset
81
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
82 % for tile in tiles :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
83 % type = ""
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
84 % text = ""
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
85 % status = ""
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
86 % if tile["type"] == "mon" :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
87 % type = "statusmon"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
88 % text = tile["source"]
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
89 % if tile["status"] == "up" :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
90 % status = "active"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
91 % elif tile["status"] == "down" :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
92 % status = "dead"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
93 % end
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
94 % elif tile["type"] == "d3.js" :
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
95 % type = "chart"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
96 % text = "place for a chart!"
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
97 % end
2
3671857d1dfe added views
sean
parents:
diff changeset
98
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
99 <div class = "tile {{type}} {{status}}">
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
100 {{text}}
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
101 </div>
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
102
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
103 % if tilecounter == break_tile_lines:
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
104 <div class = "clear"></div>
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
105 % end
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
106
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
107 % tilecounter += 1
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 2
diff changeset
108 % end
2
3671857d1dfe added views
sean
parents:
diff changeset
109
3671857d1dfe added views
sean
parents:
diff changeset
110 </div>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)