mirror of
https://github.com/apache/superset.git
synced 2026-04-22 01:24:43 +00:00
* Fix examples charts/dashboards and refactor * pylinting * Fix pylint * Lint the refactor * Rebased
104 lines
2.8 KiB
Python
104 lines
2.8 KiB
Python
import textwrap
|
|
|
|
from superset import db
|
|
from superset.models.core import CssTemplate
|
|
|
|
|
|
def load_css_templates():
|
|
"""Loads 2 css templates to demonstrate the feature"""
|
|
print('Creating default CSS templates')
|
|
|
|
obj = db.session.query(CssTemplate).filter_by(template_name='Flat').first()
|
|
if not obj:
|
|
obj = CssTemplate(template_name='Flat')
|
|
css = textwrap.dedent("""\
|
|
.gridster div.widget {
|
|
transition: background-color 0.5s ease;
|
|
background-color: #FAFAFA;
|
|
border: 1px solid #CCC;
|
|
box-shadow: none;
|
|
border-radius: 0px;
|
|
}
|
|
.gridster div.widget:hover {
|
|
border: 1px solid #000;
|
|
background-color: #EAEAEA;
|
|
}
|
|
.navbar {
|
|
transition: opacity 0.5s ease;
|
|
opacity: 0.05;
|
|
}
|
|
.navbar:hover {
|
|
opacity: 1;
|
|
}
|
|
.chart-header .header{
|
|
font-weight: normal;
|
|
font-size: 12px;
|
|
}
|
|
/*
|
|
var bnbColors = [
|
|
//rausch hackb kazan babu lima beach tirol
|
|
'#ff5a5f', '#7b0051', '#007A87', '#00d1c1', '#8ce071', '#ffb400', '#b4a76c',
|
|
'#ff8083', '#cc0086', '#00a1b3', '#00ffeb', '#bbedab', '#ffd266', '#cbc29a',
|
|
'#ff3339', '#ff1ab1', '#005c66', '#00b3a5', '#55d12e', '#b37e00', '#988b4e',
|
|
];
|
|
*/
|
|
""")
|
|
obj.css = css
|
|
db.session.merge(obj)
|
|
db.session.commit()
|
|
|
|
obj = (
|
|
db.session.query(CssTemplate).filter_by(template_name='Courier Black').first())
|
|
if not obj:
|
|
obj = CssTemplate(template_name='Courier Black')
|
|
css = textwrap.dedent("""\
|
|
.gridster div.widget {
|
|
transition: background-color 0.5s ease;
|
|
background-color: #EEE;
|
|
border: 2px solid #444;
|
|
border-radius: 15px;
|
|
box-shadow: none;
|
|
}
|
|
h2 {
|
|
color: white;
|
|
font-size: 52px;
|
|
}
|
|
.navbar {
|
|
box-shadow: none;
|
|
}
|
|
.gridster div.widget:hover {
|
|
border: 2px solid #000;
|
|
background-color: #EAEAEA;
|
|
}
|
|
.navbar {
|
|
transition: opacity 0.5s ease;
|
|
opacity: 0.05;
|
|
}
|
|
.navbar:hover {
|
|
opacity: 1;
|
|
}
|
|
.chart-header .header{
|
|
font-weight: normal;
|
|
font-size: 12px;
|
|
}
|
|
.nvd3 text {
|
|
font-size: 12px;
|
|
font-family: inherit;
|
|
}
|
|
body{
|
|
background: #000;
|
|
font-family: Courier, Monaco, monospace;;
|
|
}
|
|
/*
|
|
var bnbColors = [
|
|
//rausch hackb kazan babu lima beach tirol
|
|
'#ff5a5f', '#7b0051', '#007A87', '#00d1c1', '#8ce071', '#ffb400', '#b4a76c',
|
|
'#ff8083', '#cc0086', '#00a1b3', '#00ffeb', '#bbedab', '#ffd266', '#cbc29a',
|
|
'#ff3339', '#ff1ab1', '#005c66', '#00b3a5', '#55d12e', '#b37e00', '#988b4e',
|
|
];
|
|
*/
|
|
""")
|
|
obj.css = css
|
|
db.session.merge(obj)
|
|
db.session.commit()
|