-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #463 from webu/bugfix/js-m2m
generic JS usable when a row is duplicated when file is a part of a ManyToMany
- Loading branch information
Showing
4 changed files
with
37 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ | |
document.getElementById(id_name).innerHTML = chosenName; | ||
win.close(); | ||
}; | ||
})(jQuery); | ||
})(django.jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(function($) { | ||
var filer_clear = function(e){ | ||
var clearer = $(this), | ||
hidden_input = clearer.closest('.filerFile').find('input.vForeignKeyRawIdAdminField'), | ||
base_id = '#'+hidden_input.attr('id'), | ||
thumbnail = $(base_id+'_thumbnail_img'), | ||
description = $(base_id+'_description_txt'), | ||
static_prefix = clearer.attr('src').replace('admin/img/icon_deletelink.gif', 'filer/'); | ||
clearer.hide(); | ||
hidden_input.removeAttr("value"); | ||
thumbnail.attr("src", static_prefix+"icons/nofile_48x48.png"); | ||
description.html(""); | ||
} | ||
|
||
$(document).ready(function(){ | ||
$('.filerFile .vForeignKeyRawIdAdminField').attr('type', 'hidden'); | ||
//if this file is included multiple time, we ensure that filer_clear is attached only once. | ||
$(document).off('click.filer', '.filerFile .filerClearer', filer_clear).on('click.filer', '.filerFile .filerClearer', filer_clear); | ||
}); | ||
})(django.jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters