mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[soc2009/admin-ui] Fix for ticket #11718: "When there is an error in a SelectorInline, there is no way to tell which inline has the error"
The selector with the error is now highlighted and selected on reload. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/admin-ui@11461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ed30463b6c
commit
687a5af25a
@ -345,6 +345,12 @@ li.inline-selector-item:hover {
|
|||||||
background-color: #C1DBFD;
|
background-color: #C1DBFD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selector-error {
|
||||||
|
font-weight: bold;
|
||||||
|
border: 2px solid #F00000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.inline-detail {
|
.inline-detail {
|
||||||
float: right;
|
float: right;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
@ -96,19 +96,33 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
/* Selector */
|
/* Selector */
|
||||||
$('.inline-detail .selector-item-detail').hide();
|
function select_inline(inline) {
|
||||||
$('.inline-detail .selector-item-detail:first').show();
|
|
||||||
$('.inline-selector .inline-selector-item:first').addClass('inline-selected');
|
|
||||||
|
|
||||||
$('.inline-selector-item').click(function () {
|
|
||||||
$('.inline-detail .selector-item-detail').hide();
|
$('.inline-detail .selector-item-detail').hide();
|
||||||
$('.inline-selector .inline-selector-item').removeClass('inline-selected');
|
$('.inline-selector .inline-selector-item').removeClass('inline-selected');
|
||||||
|
|
||||||
$(this).addClass('inline-selected');
|
$(inline).addClass('inline-selected');
|
||||||
|
|
||||||
var div_to_show = '#' + $(this).find('a').attr('title');
|
var div_to_show = '#' + $(inline).find('a').attr('title');
|
||||||
$(div_to_show).show();
|
$(div_to_show).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.inline-detail .selector-item-detail').hide();
|
||||||
|
$('.inline-detail .selector-item-detail:first').show();
|
||||||
|
$('.inline-selector .inline-selector-item:first').addClass('inline-selected');
|
||||||
|
$('.form-row.errors').each(function() {
|
||||||
|
var id = $(this).parents('.selector-item-detail').attr('id').substring({{ inline_admin_formset.opts.verbose_name|length}});
|
||||||
|
$("#{{ inline_admin_formset.opts.verbose_name}}" + id + "-selector").addClass('selector-error');
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($('.form-row.errors').html()) {
|
||||||
|
select_inline('.selector-error:first');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
select_inline('.inline-selector-item:first');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.inline-selector-item').click(function () {
|
||||||
|
select_inline(this);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user