PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/django/contrib/admin/templates/mako/admin/prepopulated_fields_js.html

https://code.google.com/p/mango-py/
HTML | 25 lines | 22 code | 3 blank | 0 comment | 0 complexity | f9e44c8353418bcda88183a039a91657 MD5 | raw file
 1<%def name="prepopulated_fields(values, prepopulated_fields)">
 2<script type="text/javascript">
 3(function($) {
 4    var field = null;
 5
 6% for field in prepopulated_fields:
 7    field = {
 8        id: '#${ field['field'].auto_id }',
 9        dependency_ids: [],
10        dependency_list: [],
11        maxLength: ${ field['field'].field.max_length or 50 }
12    };
13% for dependency in field['dependencies']:
14    field['dependency_ids'].push('#${ dependency.auto_id }');
15    field['dependency_list'].push('.${ dependency.name }');
16% endfor
17
18    $('.empty-form .${ field['field'].name }').addClass('prepopulated_field');
19    $(field.id).data('dependency_list', field['dependency_list'])
20               .prepopulate($(field['dependency_ids'].join(',')), field.maxLength);
21% endfor
22})(django.jQuery);
23</script>
24</%def>
25