mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Merge pull request #231 from whs/master
Moved inline css/javascripts out to their own files
This commit is contained in:
commit
f0defe80fa
4 changed files with 38 additions and 21 deletions
15
constance/static/admin/css/constance.css
Normal file
15
constance/static/admin/css/constance.css
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#result_list .changed {
|
||||
background-color: #ffc;
|
||||
}
|
||||
#changelist table thead th .text {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
#changelist table tbody td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
#changelist-form ul.errorlist {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.help {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
17
constance/static/admin/js/constance.js
Normal file
17
constance/static/admin/js/constance.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(function($) {
|
||||
'use strict';
|
||||
|
||||
$(function() {
|
||||
$('#content-main').on('click', '.reset-link', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var field = $('#' + this.dataset.fieldId);
|
||||
|
||||
if (field.attr('type') === 'checkbox') {
|
||||
field.prop('checked', this.dataset.default === 'true');
|
||||
} else {
|
||||
field.val(this.dataset.default);
|
||||
}
|
||||
});
|
||||
});
|
||||
})(django.jQuery);
|
||||
|
|
@ -6,23 +6,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/changelists.css' %}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/forms.css' %}" />
|
||||
{{ media.css }}
|
||||
<style>
|
||||
#result_list .changed {
|
||||
background-color: #ffc;
|
||||
}
|
||||
#changelist table thead th .text {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
#changelist table tbody td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
#changelist-form ul.errorlist {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.help {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/constance.css' %}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
|
|
@ -30,6 +14,7 @@
|
|||
<script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
|
||||
{{ block.super }}
|
||||
{{ media.js }}
|
||||
<script type="text/javascript" src="{% static 'admin/js/constance.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block bodyclass %}change-list{% endblock %}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
{{ item.form_field.errors }}
|
||||
{{ item.form_field }}
|
||||
<br>
|
||||
<a href="#" onClick="
|
||||
document.getElementById('{{ item.form_field.auto_id }}').{% if item.is_checkbox %}checked =
|
||||
{% if item.raw_default %} true {% else %} false {% endif %}
|
||||
{% else %}value = '{{ item.default|escapejs }}'{% endif %}; return false;">Reset to default</a>
|
||||
<a href="#" class="reset-link" data-field-id="{{ item.form_field.auto_id }}" data-default="{% spaceless %}
|
||||
{% if item.is_checkbox %}{% if item.raw_default %} true {% else %} false {% endif %}
|
||||
{% else %}{{ item.default }}{% endif %}
|
||||
{% endspaceless %}">Reset to default</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if item.modified %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue