This commit is contained in:
d42 2018-04-27 23:19:59 +02:00
parent fe073182f1
commit cbc3a79138
1 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,3 @@
var xD = $;
var initDjangoHStoreWidget = function(hstore_field_name, inline_prefix) { var initDjangoHStoreWidget = function(hstore_field_name, inline_prefix) {
// ignore inline templates // ignore inline templates
// if hstore_field_name contains "__prefix__" // if hstore_field_name contains "__prefix__"
@ -7,8 +5,6 @@ var initDjangoHStoreWidget = function(hstore_field_name, inline_prefix) {
return; return;
} }
var $ = django.jQuery;
// processing inlines // processing inlines
if(hstore_field_name.indexOf('inline') > -1){ if(hstore_field_name.indexOf('inline') > -1){
var inlineClass = $('#id_'+hstore_field_name).parents('.inline-related, .grp-group').attr('class'); var inlineClass = $('#id_'+hstore_field_name).parents('.inline-related, .grp-group').attr('class');
@ -122,8 +118,8 @@ var initDjangoHStoreWidget = function(hstore_field_name, inline_prefix) {
$hstore.delegate('a.hs-add-row, .hs-add-row a', 'click', function(e) { $hstore.delegate('a.hs-add-row, .hs-add-row a', 'click', function(e) {
e.preventDefault(); e.preventDefault();
$hstore.find('.hstore-rows').append(empty_row); $hstore.find('.hstore-rows').append(empty_row);
xD('.django-select2').djangoSelect2() $('.django-select2').djangoSelect2()
xD('select').on( 'select2:close', function () { $('select').on( 'select2:close', function () {
$(this).focus(); $(this).focus();
}); });
}); });
@ -161,7 +157,7 @@ var initDjangoHStoreWidget = function(hstore_field_name, inline_prefix) {
hstore_rows.show(); hstore_rows.show();
add_row.show(); add_row.show();
xD('.django-select2').djangoSelect2() $('.django-select2').djangoSelect2()
} }
else{ else{
raw_textarea.show(); raw_textarea.show();