Commit 3d974ad1 authored by Ryan Herbert's avatar Ryan Herbert

add some stats decorators

adds boolean decorator and a bar decorator (boolean should display a
check of cross and bar displays a percentage bar)
parent 613b568e
......@@ -2197,6 +2197,24 @@ form .form_label {
min-width: 85px;
width: 85px;
}
.meter {
height: 5px;
/* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.01);
border: 1px solid #839496;
}
.meter > span {
display: block;
height: 100%;
background-color: #3bdb65;
background-image: linear-gradient(center bottom, #3bdb65 37%, #54f054 69%);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......@@ -2197,6 +2197,24 @@ form .form_label {
min-width: 85px;
width: 85px;
}
.meter {
height: 5px;
/* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.01);
border: 1px solid #657b83;
}
.meter > span {
display: block;
height: 100%;
background-color: #3bdb65;
background-image: linear-gradient(center bottom, #3bdb65 37%, #54f054 69%);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......@@ -2197,6 +2197,24 @@ form .form_label {
min-width: 85px;
width: 85px;
}
.meter {
height: 5px;
/* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.01);
border: 1px solid #657b83;
}
.meter > span {
display: block;
height: 100%;
background-color: #3bdb65;
background-image: linear-gradient(center bottom, #3bdb65 37%, #54f054 69%);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......
......@@ -2196,6 +2196,24 @@ form .form_label {
min-width: 85px;
width: 85px;
}
.meter {
height: 5px;
/* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.01);
border: 1px solid #777777;
}
.meter > span {
display: block;
height: 100%;
background-color: #3bdb65;
background-image: linear-gradient(center bottom, #3bdb65 37%, #54f054 69%);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......
......@@ -2191,6 +2191,24 @@ form .form_label {
min-width: 85px;
width: 85px;
}
.meter {
height: 5px;
/* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.01);
border: 1px solid #657b83;
}
.meter > span {
display: block;
height: 100%;
background-color: #3bdb65;
background-image: linear-gradient(center bottom, #3bdb65 37%, #54f054 69%);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......
......@@ -2513,6 +2513,32 @@ form {
}
}
.meter {
height: 5px; /* Can be anything */
position: relative;
background: #fff;
padding: 2px;
box-shadow: inset 0 -1px 1px rgba(255,255,255,0.01);
border: 1px solid @default;
}
.meter > span {
display: block;
height: 100%;
background-color: rgb(59, 219, 101);
background-image: linear-gradient(
center bottom,
rgb(59, 219, 101) 37%,
rgb(84,240,84) 69%
);
box-shadow:
inset 0 1px 1px rgba(255,255,255,0.3),
inset 0 -1px 1px rgba(0,0,0,0.4);
position: relative;
overflow: hidden;
}
[hidden] {
display: none !important;
}
......@@ -7,3 +7,23 @@ class StatDecorator():
def decorate(self, data):
return data if data is not None else ""
class BooleanDecorator(StatDecorator):
def __init__(self):
super(BooleanDecorator, self).__init__()
def decorate(self, data):
if data:
myclass = "icon-ok-circled"
else:
myclass = "icon-cancel-circled"
return I(_class=myclass)
class BarDecorator(StatDecorator):
def __init__(self):
super(BarDecorator, self).__init__()
def decorate(self, data):
return DIV(SPAN(_style="width: %d%%" % data), _class="meter", _title="%d%%" % data)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment