mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Move rack elevation CSS to project-static/rack_elevation.css
This commit is contained in:
@ -60,67 +60,6 @@ COMPATIBLE_TERMINATION_TYPES = {
|
||||
}
|
||||
|
||||
|
||||
RACK_ELEVATION_STYLE = """
|
||||
* {
|
||||
font-family: sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
rect {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
text {
|
||||
text-anchor: middle;
|
||||
dominant-baseline: middle;
|
||||
}
|
||||
.rack {
|
||||
background-color: #f0f0f0;
|
||||
fill: none;
|
||||
stroke: black;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
.slot {
|
||||
fill: #f7f7f7;
|
||||
stroke: #a0a0a0;
|
||||
}
|
||||
.slot:hover {
|
||||
fill: #fff;
|
||||
}
|
||||
.slot+.add-device {
|
||||
fill: none;
|
||||
}
|
||||
.slot:hover+.add-device {
|
||||
fill: blue;
|
||||
}
|
||||
.add-device:hover {
|
||||
fill: blue;
|
||||
}
|
||||
.add-device:hover+.slot {
|
||||
fill: #fff;
|
||||
}
|
||||
.reserved {
|
||||
fill: url(#reserved);
|
||||
}
|
||||
.reserved:hover {
|
||||
fill: url(#reserved);
|
||||
}
|
||||
.occupied {
|
||||
fill: url(#occupied);
|
||||
}
|
||||
.occupied:hover {
|
||||
fill: url(#occupied);
|
||||
}
|
||||
.blocked {
|
||||
fill: url(#blocked);
|
||||
}
|
||||
.blocked:hover {
|
||||
fill: url(#blocked);
|
||||
}
|
||||
.blocked:hover+.add-device {
|
||||
fill: none;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
# Rack Elevation SVG Size
|
||||
RACK_ELEVATION_UNIT_WIDTH_DEFAULT = 230
|
||||
RACK_ELEVATION_UNIT_HEIGHT_DEFAULT = 20
|
||||
|
@ -375,7 +375,8 @@ class RackElevationHelperMixin:
|
||||
drawing = svgwrite.Drawing(size=(width, height))
|
||||
|
||||
# add the stylesheet
|
||||
drawing.defs.add(drawing.style(RACK_ELEVATION_STYLE))
|
||||
with open('{}/css/rack_elevation.css'.format(settings.STATICFILES_DIRS[0])) as css_file:
|
||||
drawing.defs.add(drawing.style(css_file.read()))
|
||||
|
||||
# add gradients
|
||||
RackElevationHelperMixin._add_gradient(drawing, 'reserved', '#c7c7ff')
|
||||
|
58
netbox/project-static/css/rack_elevation.css
Normal file
58
netbox/project-static/css/rack_elevation.css
Normal file
@ -0,0 +1,58 @@
|
||||
/* Stylesheet for rendering SVG rack elevations */
|
||||
* {
|
||||
font-family: sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
rect {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
text {
|
||||
text-anchor: middle;
|
||||
dominant-baseline: middle;
|
||||
}
|
||||
.rack {
|
||||
background-color: #f0f0f0;
|
||||
fill: none;
|
||||
stroke: black;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
.slot {
|
||||
fill: #f7f7f7;
|
||||
stroke: #a0a0a0;
|
||||
}
|
||||
.slot:hover {
|
||||
fill: #fff;
|
||||
}
|
||||
.slot+.add-device {
|
||||
fill: none;
|
||||
}
|
||||
.slot:hover+.add-device {
|
||||
fill: blue;
|
||||
}
|
||||
.add-device:hover {
|
||||
fill: blue;
|
||||
}
|
||||
.add-device:hover+.slot {
|
||||
fill: #fff;
|
||||
}
|
||||
.reserved {
|
||||
fill: url(#reserved);
|
||||
}
|
||||
.reserved:hover {
|
||||
fill: url(#reserved);
|
||||
}
|
||||
.occupied {
|
||||
fill: url(#occupied);
|
||||
}
|
||||
.occupied:hover {
|
||||
fill: url(#occupied);
|
||||
}
|
||||
.blocked {
|
||||
fill: url(#blocked);
|
||||
}
|
||||
.blocked:hover {
|
||||
fill: url(#blocked);
|
||||
}
|
||||
.blocked:hover+.add-device {
|
||||
fill: none;
|
||||
}
|
Reference in New Issue
Block a user