Files
mayan-edms/3rd_party_apps/grappelli/templates/admin/prepopulated_fields_js.html
2011-02-03 20:31:38 -04:00

18 lines
820 B
HTML
Executable File

<script type="text/javascript">
(function( $ ) {
{% for field in prepopulated_fields %}
$("#{{ field.field.auto_id }}").bind('change.grappelli', function() {
$(this).data('changed', true);
});
{% for dependency in field.dependencies %}
$("#{{ dependency.auto_id }}").bind('keyup.grappelli', function() {
var e = $("#{{ field.field.auto_id }}");
if (!e.data('changed')) {
e.val(URLify({% for innerdep in field.dependencies %}$("#{{ innerdep.auto_id }}").val(){% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length|default_if_none:"50" }}));
}
});
{% endfor %}
{% endfor %}
})(django.jQuery);
</script>