Verified Commit 3674f522 authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

Use django-media package

parent dc3cdbfe
Pipeline #15192 passed with stages
in 12 minutes and 4 seconds
......@@ -231,20 +231,6 @@ http {
proxy_set_header Remote-Groups $groups;
}
# Legacy django media
location ^~ /media/ {
alias /opt/noc/django/contrib/admin/static/;
gzip on;
gzip_types text/css text/javascript application/x-javascript application/json text/x-js application/javascript;
}
# Legacy static resources
location ^~ /static/ {
alias /opt/noc/static/;
gzip on;
gzip_types text/css text/javascript application/x-javascript application/json text/x-js application/javascript;
}
# UI files
location ^~ /ui/ {
alias /opt/noc/ui/;
......@@ -259,7 +245,6 @@ http {
gzip_types text/css text/javascript application/x-javascript application/json;
}
location /ui/grafana {
proxy_pass http://grafana;
auth_request /api/auth/auth/;
......
......@@ -599,7 +599,7 @@ class TableSection(ReportSection):
"<tr><td colspan=%d style='margin: 0" % s_span,
"padding: 2px 5px 3px 5px;font-size: 11px;text-align:left",
"font-weight:bold",
"background: #7CA0C7 url(/media/admin/img/default-bg.gif) top left repeat-x",
"background: #7CA0C7 url(/ui/pkg/django-media/admin/img/default-bg.gif) top left repeat-x",
"color:white;'>",
]
),
......
......@@ -44,7 +44,7 @@ class NOCForm(forms.Form):
"""
class Media:
css = {"all": ["/media/admin/css/forms.css"]}
css = {"all": ["/ui/pkg/django-media/admin/css/forms.css"]}
def __init__(self, *args, **kwargs):
super(NOCForm, self).__init__(*args, **kwargs)
......
......@@ -95,7 +95,7 @@ function ts_on_search(s) {
</script>
<div class="tablesorter-container">
<div class="tablesorter-search-row">
<label for="tablesorter-search"><img src="/media/admin/img/icon_searchbox.png" alt="Search" /></label>
<label for="tablesorter-search"><img src="/ui/pkg/django-media/admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" id="tablesorter-search" onkeyup="ts_on_search(this);"/>
</div>
"""
......@@ -170,9 +170,9 @@ def bool_icon(value):
if value is None:
return "?"
elif value:
return SafeString("<img src='/media/admin/img/icon-yes.gif' alt='Yes' />")
return SafeString("<img src='/ui/pkg/django-media/admin/img/icon-yes.gif' alt='Yes' />")
else:
return SafeString("<img src='/media/admin/img/icon-no.gif' alt='No' />")
return SafeString("<img src='/ui/pkg/django-media/admin/img/icon-no.gif' alt='No' />")
register.filter("bool_icon", bool_icon)
......@@ -76,6 +76,10 @@
{
"name": "jquery.tokeninput",
"version": "1.1.1"
},
{
"name": "django-media",
"version": "1.11.22"
}
]
}
......@@ -369,9 +369,9 @@ document.currentPrefix = "{{ prefix.prefix }}";
$(".s_img").each(function(i){
ip=$(this).attr("id").substring(2);
if ((ip in result) && result[ip])
src="/media/admin/img/icon-yes.gif";
src="/ui/pkg/django-media/admin/img/icon-yes.gif";
else
src="/media/admin/img/icon-no.gif";
src="/ui/pkg/django-media/admin/img/icon-no.gif";
$(this).attr("src",src);
})
}
......
......@@ -15,7 +15,7 @@
{% for name,required,rel in fields %}
<tr class="{%cycle 'row1' 'row2'%}" >
<td>{{name}}</td>
<td><img src="/media/admin/img/icon-{%if required %}yes{%else%}no{%endif%}.gif"></td>
<td><img src="/ui/pkg/django-media/admin/img/icon-{%if required %}yes{%else%}no{%endif%}.gif"></td>
<td>{{rel}}</td>
</tr>
{% endfor %}
......
......@@ -14,7 +14,7 @@
<form id="changelist-search" action="{% url 'main:refbook:view' rb.id %}" method="get">{% csrf_token %}
<div>
<input type="hidden" name="page" value="{{page}}" />
<label for="searchbar"><img src="/media/admin/img/icon_searchbox.png" alt="Search" /></label>
<label for="searchbar"><img src="/ui/pkg/django-media/admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" size="40" name="query" value="{{query}}" id="searchbar" />
<input type="submit" value="Go" />
</div>
......
......@@ -67,7 +67,7 @@ MEDIA_URL = ""
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
STATIC_URL = "/media/"
STATIC_URL = "/ui/pkg/django-media/"
# Make this unique, and don"t share it with anybody.
SECRET_KEY = config.secret_key
......@@ -86,7 +86,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"noc.core.middleware.context.messages",
)
#
MIDDLEWARE = [
......
......@@ -9,20 +9,21 @@
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}/media/admin/css/base.css{% endblock %}" />
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}/ui/pkg/django-media/admin/css/base.css{% endblock %}" />
<link rel="stylesheet" type="text/css" href="/ui/web/css/django/main.css" />
<link rel="stylesheet" type="text/css" href="/ui/pkg/fontawesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="/ui/web/css/colors.css" />
<link rel="stylesheet" type="text/css" href="/ui/web/css/print.css" />
<script TYPE="text/javascript" SRC="/ui/pkg/jquery/jquery.min.js"></script>
{% block extrastyle %}{% endblock %}
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}/media/admin/css/ie.css{% endblock %}" /><![endif]-->
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}/media/admin/css/rtl.css{% endblock %}" />{% endif %}
<script type="text/javascript">window.__admin_media_prefix__ = "/media/admin/";</script>
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}/ui/pkg/django-media/admin/css/ie.css{% endblock %}" /><![endif]-->
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}/ui/pkg/django-media/admin/css/rtl.css{% endblock %}" />{% endif %}
<script type="text/javascript">window.__admin_media_prefix__ = "/ui/pkg/django-media/admin/";</script>
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
{% block extrahead %}{% endblock %}
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
</head>
{% load i18n %}
</head>
<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
onmousemove="window.top && window.top.NOCIdleHandler && window.top.NOCIdleHandler();"
......
{% extends "template.html" %}
{% block extrastyle %}
<link rel="stylesheet" type="text/css" href="/media/admin/css/base.css" />
<link rel="stylesheet" type="text/css" href="/media/admin/css/forms.css" />
<link rel="stylesheet" type="text/css" href="/media/admin/css/widgets.css" />
<link rel="stylesheet" type="text/css" href="/ui/pkg/django-media/admin/css/base.css" />
<link rel="stylesheet" type="text/css" href="/ui/pkg/django-media/admin/css/forms.css" />
<link rel="stylesheet" type="text/css" href="/ui/pkg/django-media/admin/css/widgets.css" />
<script>
function gettext(x) {
return x;
}
function get_format(fmt) {
switch(fmt) {
case 'FIRST_DAY_OF_WEEK':
......@@ -31,7 +32,7 @@ django = {
jQuery: $
};
</script>
<script type="text/javascript" src="/media/admin/js/core.js"></script>
<script type="text/javascript" src="/ui/pkg/django-media/admin/js/core.js"></script>
{% endblock %}
{% block content %}
<h1>{{app.title}}</h1>
......
......@@ -39,7 +39,7 @@ function sa_app_on_search(s) {
.sa-app-search-row {
padding: 3px;
border-bottom: 1px solid #ddd;
background: #e1e1e1 url(/media/admin/img/nav-bg.gif) top left repeat-x;
background: #e1e1e1 url(/ui/pkg/django-media/admin/img/nav-bg.gif) top left repeat-x;
color: #666;
}
......@@ -68,7 +68,7 @@ function sa_app_on_search(s) {
<h2>Selected Objects</h2>
<div>
<div class="sa-app-search-row">
<label for="sa-app-search"><img src="/media/admin/img/icon_searchbox.png" alt="Search" /></label>
<label for="sa-app-search"><img src="/ui/pkg/django-media/admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" id="sa-app-search" onkeyup="sa_app_on_search(this);"/>
Select all shown:
<input type="checkbox" checked onclick="toggle();" />
......
@import url("/media/admin/css/base.css");
@import url("/media/admin/css/dashboard.css");
@import url("/ui/pkg/django-media/admin/css/base.css");
@import url("/ui/pkg/django-media/admin/css/dashboard.css");
#content {
/*
......@@ -59,7 +59,7 @@ div.breadcrumbs ul li:after {
.object-tags li {
display: block;
float: left;
background:url(/media/admin/img/tool-left.gif) 0 0 no-repeat;
background:url(/ui/pkg/django-media/admin/img/tool-left.gif) 0 0 no-repeat;
padding:0 0 0 8px;
margin-left:2px;
height:16px;
......@@ -69,7 +69,7 @@ div.breadcrumbs ul li:after {
display: block;
float: left;
color: white;
background:#999 url(/media/admin/img/tool-right.gif) 100% 0 no-repeat;
background:#999 url(/ui/pkg/django-media/admin/img/tool-right.gif) 100% 0 no-repeat;
padding: .1em 14px .1em 8px;
height: 14px;
}
......@@ -117,7 +117,7 @@ table tbody tr.selected {
#noc-popup-header {
font-weight: bold;
background: #7CA0C7 url(/media/admin/img/default-bg.gif) top left repeat-x;
background: #7CA0C7 url(/ui/pkg/django-media/admin/img/default-bg.gif) top left repeat-x;
color: white;
padding: 4px;
padding-right: 10px;
......
......@@ -45,7 +45,7 @@ table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSo
.tablesorter-search-row {
padding: 3px;
border-bottom: 1px solid #ddd;
background: #e1e1e1 url(/media/admin/img/nav-bg.gif) top left repeat-x;
background: #e1e1e1 url(/ui/pkg/django-media/admin/img/nav-bg.gif) top left repeat-x;
color: #666;
}
......@@ -64,5 +64,5 @@ table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSo
.tablesorter-container {
border: 1px solid #ccc;
background: white url(/media/admin/img/changelist-bg.gif) top right repeat-y !important;
background: white url(/ui/pkg/django-media/admin/img/changelist-bg.gif) top right repeat-y !important;
}
......@@ -7,7 +7,9 @@
# ---------------------------------------------------------------------
# Third-party modules
from django.conf.urls import url
from django.http import HttpResponseServerError
from django.views.i18n import JavaScriptCatalog
# NOC modules
from noc.lib.app.site import site
......@@ -18,9 +20,11 @@ from noc.core.debug import error_report
#
site.autodiscover()
#
# Install URL handlers
# Install URL handlers, including django's translations
#
urlpatterns = site.urls
urlpatterns = site.urls + [
url(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalog")
]
def handler500(request):
......
Supports Markdown
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