Remove hard-coded static prefix from JS and CSS files

Use global variable STATIC_URL in JavaScript, use relative
urls instead of absolute in CSS files.

Change-Id: Ib89d95c4cb425479e3e7af3d8b38292b3a335faa
Closes-Bug: #1342079
This commit is contained in:
Timur Sufiev 2014-08-08 17:17:55 +04:00
parent da9b2e4bd6
commit 806b626b28
4 changed files with 34 additions and 32 deletions

View File

@ -61,8 +61,9 @@ horizon.datatables = {
if ($new_row.hasClass('status_unknown')) {
var spinner_elm = $new_row.find("td.status_unknown:last");
var imagePath = $new_row.find('.btn-action-required').length > 0 ?
"/static/dashboard/img/action_required.png":
"/static/dashboard/img/loading.gif";
"dashboard/img/action_required.png":
"dashboard/img/loading.gif";
imagePath = STATIC_URL + imagePath;
spinner_elm.prepend(
$("<div>")
.addClass("loading_gif")

View File

@ -3,6 +3,7 @@
{% comment %} Django's JavaScript i18n Implementation {% endcomment %}
<script type="text/javascript" src="{% url 'horizon:jsi18n' 'horizon' %}"></script>
<script type="text/javascript">var STATIC_URL = "{{ STATIC_URL }}";</script>
{% comment %} Compress jQuery, Angular, Plugins, Bootstrap, Hogan.js and Horizon-specific JS. {% endcomment %}
{% compress js %}

View File

@ -14,7 +14,7 @@ $accordionBorderColor: #e5e5e5;
background-color: #f0f0f0;
background-repeat: no-repeat;
background-position: 96% center;
background-image: url("/static/dashboard/img/right_droparrow.png");
background-image: url("../img/right_droparrow.png");
padding: 10px 0 10px 0;
line-height: 16px;
margin-top: 0;
@ -37,7 +37,7 @@ $accordionBorderColor: #e5e5e5;
max-width: 177px; } }
h4.active {
border-bottom: 1px solid #bbbbbb;
background-image: url("/static/dashboard/img/drop_arrow.png"); }
background-image: url("../img/drop_arrow.png"); }
a {
color: #6e6e6e;
font-size: 16px;
@ -79,7 +79,7 @@ $accordionBorderColor: #e5e5e5;
background-color: $accordionBorderColor;
background-repeat: no-repeat;
background-position: 96% center;
background-image: url("/static/dashboard/img/right_droparrow.png");
background-image: url("../img/right_droparrow.png");
padding-right: 16px;
max-width: 231px;
cursor: pointer;
@ -94,7 +94,7 @@ $accordionBorderColor: #e5e5e5;
text-overflow: ellipsis;
max-width: 201px; } }
dt.active {
background-image: url("/static/dashboard/img/drop_arrow.png"); }
background-image: url("../img/drop_arrow.png"); }
dt:first-child {
border-top: 0; }
dt a {

View File

@ -1,5 +1,5 @@
// bootstrap overrides:
$icon-font-path: "/static/bootstrap/fonts/bootstrap/";
$icon-font-path: "../../bootstrap/fonts/bootstrap/";
$font-size-base: 13px;
$modal-md: 732px;
@ -34,14 +34,14 @@ $modal-md: 732px;
@font-face {
font-family: 'anivers';
src: url('/static/dashboard/fonts/Anivers_Regular-webfont.eot');
src: url('/static/dashboard/fonts/Anivers_Regular-webfont.eot?iefix')
src: url('../fonts/Anivers_Regular-webfont.eot');
src: url('../fonts/Anivers_Regular-webfont.eot?iefix')
format('eot'),
url('/static/dashboard/fonts/Anivers_Regular-webfont.woff')
url('../fonts/Anivers_Regular-webfont.woff')
format('woff'),
url('/static/dashboard/fonts/Anivers_Regular-webfont.ttf')
url('../fonts/Anivers_Regular-webfont.ttf')
format('truetype'),
url('/static/dashboard/fonts/Anivers_Regular-webfont.svg#webfont3JLVF59W')
url('../fonts/Anivers_Regular-webfont.svg#webfont3JLVF59W')
format('svg');
font-weight: normal;
font-style: normal;
@ -96,7 +96,7 @@ dt {
margin-bottom: 0;
margin-right: 10px;
padding: 0;
background-image: url(/static/dashboard/img/drop_arrow.png);
background-image: url(../img/drop_arrow.png);
background-color: $gray-lighter;
background-repeat: no-repeat;
border: 1px solid $gray-light;
@ -144,7 +144,7 @@ dt {
max-width: 200px;
vertical-align: top;
white-space: nowrap;
background-image: url(/static/dashboard/img/profile_drop.png);
background-image: url(../img/profile_drop.png);
background-repeat: no-repeat;
background-position: right center;
}
@ -185,7 +185,7 @@ h2 {
/* Login Splash Page */
#splash .login {
background: url(/static/dashboard/img/logo-splash.png) no-repeat center 35px;
background: url(../img/logo-splash.png) no-repeat center 35px;
position: absolute;
top: 80px;
left: 50%;
@ -258,7 +258,7 @@ h1.brand {
}
h1.brand a {
background: url(/static/dashboard/img/logo.png) top left no-repeat;
background: url(../img/logo.png) top left no-repeat;
display: block;
float: left;
width: 216px;
@ -297,7 +297,7 @@ a.current_item:hover h4 {
.sidebar .switcher_bar a.dropdown-toggle {
display: block;
padding: 5px 0;
background-image: url(/static/dashboard/img/drop_arrow.png);
background-image: url(../img/drop_arrow.png);
border: 1px solid #c0d9e4;
background-color: #e9f5fa;
background-repeat: no-repeat;
@ -490,10 +490,10 @@ a.current_item:hover h4 {
background-position: 98% center;
}
.table th.headerSortDown {
background-image: url(/static/dashboard/img/drop_arrow.png);
background-image: url(../img/drop_arrow.png);
}
.table th.headerSortUp {
background-image: url(/static/dashboard/img/up_arrow.png);
background-image: url(../img/up_arrow.png);
}
.table tr.summation td:first-child,
.table tr.summation td:last-child {
@ -659,7 +659,7 @@ td.loading {
}
@mixin btn-icon-inline_edit($x, $y, $top: 1px, $left: 5px,
$icons: "/static/bootstrap/img/glyphicons-halflings.png") {
$icons: "../../bootstrap/img/glyphicons-halflings.png") {
padding: 9px 12px 9px 12px;
position: relative;
border-radius: 0px;
@ -690,7 +690,7 @@ td.inline_edit_available div.table_cell_wrapper .table_cell_action button.ajax-i
}
@mixin status-icon($x, $y, $top: 1px, $left: 5px,
$icons: "/static/bootstrap/img/glyphicons-halflings.png") {
$icons: "../../bootstrap/img/glyphicons-halflings.png") {
padding: 9px 12px 9px 12px;
position: relative;
border-radius: 0px;
@ -782,7 +782,7 @@ div.table_cell_wrapper {
z-index: 100;
}
.loading {
@include status-icon(0px, 0px, 0px, 0px, '/static/dashboard/img/spinner.gif');
@include status-icon(0px, 0px, 0px, 0px, '../img/spinner.gif');
padding: 0;
position:absolute;
top: 0px;
@ -1264,7 +1264,7 @@ tr.terminated {
font-weight: bold;
color: #555;
cursor: pointer;
background-image: url(/static/dashboard/img/right_droparrow.png);
background-image: url(../img/right_droparrow.png);
background-repeat: no-repeat;
background-position: 130px center;
}
@ -1273,7 +1273,7 @@ tr.terminated {
width: 334px;
margin-bottom: 10px;
border-bottom: solid 1px $border-color;
background-image: url(/static/dashboard/img/drop_arrow.png);
background-image: url(../img/drop_arrow.png);
}
.nav-tabs a {
@ -1328,7 +1328,7 @@ form .form-group.required > label:after {
}
#region_selector li:first-child p{
background: #ededed url(/static/dashboard/img/drop_arrow.png) no-repeat 106px 9px !important;
background: #ededed url(../img/drop_arrow.png) no-repeat 106px 9px !important;
display: block;
border: 1px solid #e1e1e1;
padding: 5px;
@ -1560,10 +1560,10 @@ label.log-length {
width: 160px;
}
input {
background: url(/static/dashboard/img/search.png) no-repeat 95px 5px;
background: url(../img/search.png) no-repeat 95px 5px;
}
input[type="text"]:disabled {
background: url(/static/dashboard/img/search.png) no-repeat 95px 5px $gray-lighter;
background: url(../img/search.png) no-repeat 95px 5px $gray-lighter;
}
.fake_table_header {
background-color: $body-bg;
@ -1724,7 +1724,7 @@ label.log-length {
border-radius: 3px;
cursor: move;
padding-left: 23px;
background: $body-bg url(/static/dashboard/img/drag.png) no-repeat 11px 50%;
background: $body-bg url(../img/drag.png) no-repeat 11px 50%;
em {
font-size: 0.5em;
line-height: 1em;
@ -2140,7 +2140,7 @@ label.log-length {
border-radius: 3px;
cursor: move;
padding-left: 23px;
background: $body-bg url(/static/dashboard/img/drag.png) no-repeat 11px 50%;
background: $body-bg url(../img/drag.png) no-repeat 11px 50%;
em {
font-size: 0.5em;
line-height: 1em;
@ -2238,11 +2238,11 @@ label.log-length {
}
&.tablesorter-headerAsc {
background-image: url(/static/dashboard/img/up_arrow.png);
background-image: url(../img/up_arrow.png);
}
&.tablesorter-headerDesc {
background-image: url(/static/dashboard/img/drop_arrow.png);
background-image: url(../img/drop_arrow.png);
}
}
@ -2261,5 +2261,5 @@ span.password-reveal-button {
// Work around a bug in Bootstrap SCSS.
// https://github.com/twbs/bootstrap-sass/issues/105
// TODO(rdopieralski) Remove when fixed.
background-image: url(/static/bootstrap/img/glyphicons-halflings.png);
background-image: url(../../bootstrap/img/glyphicons-halflings.png);
}