#19314: JavaScript for Widget in added inline
-------------------------------+------------------------------------
     Reporter:  per856         |                    Owner:  per856
         Type:  New feature    |                   Status:  assigned
    Component:  contrib.admin  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:  admin forms    |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------
Changes (by per856):

 * has_patch:  0 => 1


Comment:

 Patch: https://github.com/django/django/pull/542

 My Widget uses this JS, which makes use of this patch:

 {{{
 jQuery(document).ready(function ($) {
         var setup = {
         basePath: '{% static "js/wymeditor/" %}',
         updateSelector: 'input[type=submit],',
         updateEvent: 'click',
         lang: '{{ language }}',
         skin: 'default',
         logoHtml: ''
     };
     {% if "__prefix__" not in name %}
         $('#id_{{ name }}').wymeditor(setup);
         {% else %}
         /* This is used in an empty form in the admin, that is used to
 clone new inline forms.
          * Django feature #19314 adds the admin_add_row event that is used
 here.
          */
         django.jQuery(document).unbind('admin_add_row.{{ name }}');
         django.jQuery(document).bind('admin_add_row.{{ name }}',
 function(event, row_element) {
         $('.{{ name }}', row_element).wymeditor(setup);
     });
     {% endif %}
 });
 }}}

 For the code above to work, the widget's render function adds {{{
 {'class': name} }}} to the attrs of the parent TextArea widget.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19314#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to